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: voting list #148

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

feat: voting list #148

wants to merge 19 commits into from

Conversation

alter-eggo
Copy link
Contributor

@alter-eggo alter-eggo commented Nov 7, 2024

This pr adds vebal voting list
Screenshot 2024-11-07 at 13 34 50

Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mono-beets-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 8:27am
mono-frontend-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 8:27am
mono-test-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 8:27am

@alter-eggo alter-eggo marked this pull request as ready for review November 7, 2024 12:55
packages/lib/modules/vebal/vote/gauge/useGaugeVotes.tsx Outdated Show resolved Hide resolved
packages/lib/modules/vebal/vote/VoteRateTooltip.tsx Outdated Show resolved Hide resolved
Comment on lines 32 to 36
const {
data: votingIncentives,
isLoading: votingIncentivesLoading,
error: votingIncentivesError,
} = useHiddenHandVotingIncentives()
Copy link
Contributor

@garethfuller garethfuller Nov 7, 2024

Choose a reason for hiding this comment

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

Any fetching that can be done server-side, e.g to external APIs or our own can be done in the RSC/layout component and passed into providers as inputs.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should be fetching data in this component and passing it into providers.

Copy link
Collaborator

@agualis agualis left a comment

Choose a reason for hiding this comment

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

Minor style issue:
Screenshot 2024-11-21 at 13 50 06

the botton of the two gauge "g"s is cut by the margin of the table.

apps/frontend-v3/app/(app)/vebal/manage/layout.tsx Outdated Show resolved Hide resolved
<PoolListTokenPills pool={pool} px="sm" py="2" />
<PoolListTokenPills
chain={pool.chain}
displayTokens={pool.displayTokens}
Copy link
Collaborator

Choose a reason for hiding this comment

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

displayTokens are deprecated in the API.
Depending on what we need here, we can probably reuse some helpers from pool.helpers or we can implement the same logic that the api implements for displayTokens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

used getPoolDisplayTokens

@@ -45,11 +45,13 @@ export function PoolListTableRow({ pool, keyValue, ...rest }: Props) {
</GridItem>
<GridItem>
<PoolListTokenPills
chain={pool.chain}
displayTokens={pool.displayTokens}
Copy link
Collaborator

Choose a reason for hiding this comment

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

displayTokens is deprecated.

@@ -45,11 +45,13 @@ export function PoolListTableRow({ pool, keyValue, ...rest }: Props) {
</GridItem>
<GridItem>
<PoolListTokenPills
chain={pool.chain}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that you replaced pool={pool} prop to spread its used fields so that you can reuse PoolListTokenPills component in the voting list.

Instead of spreading the fields: chain, displayTokens, type... into the props I would create a new TS subtype that both the PoolListTableRow and the VotingListRow can satisfy.

For example:

type PoolTokenData = {
chain: GqlChain, 
displayTokens: ...
type: ...
}

that way its's easier to understand the purpose of that group of pool fields.

})
}, [gaugeAddresses, thisWeekTimestamp, nextWeekTimestamp, isConnected, userAddress])

const { results, refetchAll, isLoading } = useMulticall(gaugeRequests, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, I think that we should try to avoid useMulticall as much as possible and replace it with useReadContracts, which offers better TS inference experience and it will be easier to refactor in the future if wagmi changes.

useMulticall was a workaround at the beginning of the project, but it lacks of good TS experience cause it uses:
.reduce((o, { id, ...rest }) => set(o, id, rest), {}) which is not TS safe.

There are already some examples of complex queries using useReadContracts in the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

# Conflicts:
#	packages/lib/modules/pool/PoolList/PoolListTable/PoolListTableRow.tsx
# Conflicts:
#	apps/beets-frontend-v3/app/(app)/pools/[chain]/[variant]/[id]/layout.tsx
#	apps/beets-frontend-v3/app/(app)/portfolio/[chain]/page.tsx
#	apps/frontend-v3/app/(app)/pools/[chain]/[variant]/[id]/layout.tsx
#	apps/frontend-v3/app/(app)/portfolio/[chain]/page.tsx
#	packages/lib/config/networks/mainnet.ts
#	packages/lib/modules/pool/PoolDetail/PoolMyLiquidity.tsx
#	packages/lib/modules/pool/PoolList/PoolListTable/PoolListTableRow.tsx
#	packages/lib/modules/pool/PoolList/PoolListTokenPills.tsx
#	packages/lib/modules/pool/PoolName.tsx
#	packages/lib/modules/pool/pool.utils.ts
#	packages/lib/modules/portfolio/PortfolioTable/PortfolioTableRow.tsx
#	packages/lib/modules/tokens/TokenRow/TokenRow.tsx
#	packages/lib/shared/services/api/pools.graphql
@uiuxxx
Copy link
Contributor

uiuxxx commented Dec 19, 2024

@alter-eggo
Copy link
Contributor Author

thanks @uiuxxx will fix it in sep pr

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.

4 participants