Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PGIO-137): add pagination to My Bets #153

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ElRodrigote
Copy link
Contributor

Fixes: PGIO-137

Description

  • Updates the user position query to allow for skip and first parameters (needed to emulate pagination)
  • Creates the new <Pagination /> component, implements the new component where needed
  • Updates the Profile and My Bets pages to allow pagination when needed. Creates support for search params pagination.

Visual Evidence

https://www.loom.com/share/c2034270a73945299d6129d711c513af?sid=e8f0bafe-7e3f-4fd6-b0cb-1495ec27b871

Copy link

cloudflare-workers-and-pages bot commented Jan 15, 2025

Deploying presagio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7b6442e
Status: ✅  Deploy successful!
Preview URL: https://258e69d0.presagio.pages.dev
Branch Preview URL: https://feat-pgio-137-add-pagination.presagio.pages.dev

View logs

@Diogomartf
Copy link
Contributor

Design wise, let's move the pagination bellow, it's cleaner. Even tho I know it can be a lot of elements, will probably add search bet on that page at some point in the future.

…he search params cleanup and condition to display the pagination controls
@Diogomartf
Copy link
Contributor

Diogomartf commented Jan 15, 2025

Let's remove the BG color

image

@Diogomartf
Copy link
Contributor

The pagination from history seems very similar to yours (design wise), maybe we can use same component?

image

@ElRodrigote
Copy link
Contributor Author

The pagination from history seems very similar to yours (design wise), maybe we can use same component?

image

Just in case, if you mean the MarketActivity tab in the Market Details history, I already replaced the old component with the new SimplePagination one :D

@@ -37,13 +37,27 @@ import { useEnsName } from 'wagmi';
import { mainnetConfigForENS } from '@/providers/chain-config';
import { mainnet } from 'viem/chains';

import { AiAgent } from '@/types';

const ITEMS_PER_PAGE = 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 100 items? Can we show 10 per page? I see that all bets depends on this number, maybe we can fix the "all bets number problem" in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all the filters depends on the "All Bets", and the "All Bets" is the result from getting the query result from The Graph and then applying a filter in the FE, so our simulated pagination sometimes behave in an odd way.

Anyway, the other tabs are filters, so they'll never be > All bets

import { TabBody, TabGroup, TabHeader } from '@swapr/ui';
import { useAccount } from 'wagmi';
import { BetsListPanel, BetsListTab } from '@/app/components';
import { useRouter } from 'next/navigation';

const ITEMS_PER_PAGE = 50;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we show 10 items per page?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 10?

Seems low, at least 25 would be good.

@berteotti
Copy link
Contributor

Something isn't working properly with page size.

10 page size:
image

25 page size:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants