diff --git a/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx b/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx index 6b17bd860..93888b579 100644 --- a/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx +++ b/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx @@ -12,7 +12,7 @@ interface ProposalHeaderProps { daoId: string; setIsVotingModalOpen: (isOpen: boolean) => void; votingPower: string; - votes: GetAccountPowerQuery["votes"] | null; + votes: GetAccountPowerQuery["votesByProposalId"] | null; address: string | undefined; proposalStatus: string; } diff --git a/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx b/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx index 68396a574..5de265827 100644 --- a/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx +++ b/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx @@ -76,7 +76,7 @@ export const VotesTabContent = ({ > Voted
- {data?.votes?.totalCount} voters / {totalVotes} VP + {data?.votesByProposalId?.totalCount} voters / {totalVotes} VP
["items"][number] + NonNullable["items"][number] > & { votingPowerVariation?: VotingPowerVariation; isSubRow?: boolean; @@ -66,8 +66,9 @@ export const useVotes = ({ proposalId: proposalId!, limit, skip: 0, // Always fetch from beginning, we'll handle append in fetchMore - orderBy: orderBy as QueryInput_Votes_OrderBy, - orderDirection: orderDirection as QueryInput_Votes_OrderDirection, + orderBy: orderBy as QueryInput_VotesByProposalId_OrderBy, + orderDirection: + orderDirection as QueryInput_VotesByProposalId_OrderDirection, }; }, [proposalId, limit, orderBy, orderDirection]); @@ -160,21 +161,26 @@ export const useVotes = ({ // Initialize allVotes on first load or when data changes after reset useEffect(() => { - if (data?.votes?.items && allVotes.length === 0) { - const initialVotes = data.votes.items as VoteWithHistoricalPower[]; + if (data?.votesByProposalId?.items && allVotes.length === 0) { + const initialVotes = data.votesByProposalId + .items as VoteWithHistoricalPower[]; setAllVotes(initialVotes); // Fetch voting power for initial votes fetchVotingPowerForVotes(initialVotes); } - }, [data?.votes?.items, allVotes.length, fetchVotingPowerForVotes]); + }, [ + data?.votesByProposalId?.items, + allVotes.length, + fetchVotingPowerForVotes, + ]); // Use accumulated votes for infinite scroll const votes = allVotes; // Extract total count const totalCount = useMemo(() => { - return data?.votes?.totalCount || 0; - }, [data?.votes?.totalCount]); + return data?.votesByProposalId?.totalCount || 0; + }, [data?.votesByProposalId?.totalCount]); // Calculate if there are more pages const hasNextPage = useMemo(() => { @@ -195,10 +201,10 @@ export const useVotes = ({ skip: allVotes.length, // Skip already loaded votes }, updateQuery: (previousResult, { fetchMoreResult }) => { - if (!fetchMoreResult?.votes?.items) return previousResult; + if (!fetchMoreResult?.votesByProposalId?.items) return previousResult; // Append new votes to existing ones in the GraphQL cache - const newVotes = fetchMoreResult.votes + const newVotes = fetchMoreResult.votesByProposalId .items as VoteWithHistoricalPower[]; setAllVotes((prev) => [...prev, ...newVotes]); @@ -207,10 +213,13 @@ export const useVotes = ({ // Return the merged result for the cache return { - votes: { - ...fetchMoreResult.votes, - items: [...(previousResult.votes?.items || []), ...newVotes], - totalCount: fetchMoreResult.votes.totalCount || 0, + votesByProposalId: { + ...fetchMoreResult.votesByProposalId, + items: [ + ...(previousResult.votesByProposalId?.items || []), + ...newVotes, + ], + totalCount: fetchMoreResult.votesByProposalId.totalCount || 0, }, }; }, diff --git a/apps/dashboard/shared/constants/pages-constants.ts b/apps/dashboard/shared/constants/pages-constants.ts index 0c33561b9..633f5caf4 100644 --- a/apps/dashboard/shared/constants/pages-constants.ts +++ b/apps/dashboard/shared/constants/pages-constants.ts @@ -34,8 +34,8 @@ export const PAGES_CONSTANTS = { }, governanceImplementation: { title: "", - titleAbbreviation: "Gov Implementation", - page: "governance-implementation", + titleAbbreviation: "Governance", + page: "governance", description: undefined, subTitle: "Governance Implementation", subDescription: diff --git a/apps/dashboard/tsconfig.json b/apps/dashboard/tsconfig.json index 1c684b3fe..512226166 100644 --- a/apps/dashboard/tsconfig.json +++ b/apps/dashboard/tsconfig.json @@ -11,7 +11,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "react-jsx", + "jsx": "preserve", "incremental": true, "plugins": [ { diff --git a/apps/dashboard/widgets/HeaderNavMobile.tsx b/apps/dashboard/widgets/HeaderNavMobile.tsx index c03a2c7a1..5bcd70419 100644 --- a/apps/dashboard/widgets/HeaderNavMobile.tsx +++ b/apps/dashboard/widgets/HeaderNavMobile.tsx @@ -30,11 +30,6 @@ export const HeaderNavMobile = () => { title: PAGES_CONSTANTS.riskAnalysis.title, enabled: !!daoConfig.riskAnalysis, }, - // { - // page: PAGES_CONSTANTS.governanceImplementation.page, - // title: PAGES_CONSTANTS.governanceImplementation.titleAbbreviation, - // enabled: !!daoConfig.governanceImplementation, - // }, { page: PAGES_CONSTANTS.resilienceStages.page, title: PAGES_CONSTANTS.resilienceStages.title, @@ -50,6 +45,11 @@ export const HeaderNavMobile = () => { title: PAGES_CONSTANTS.holdersAndDelegates.title, enabled: true, }, + { + page: PAGES_CONSTANTS.governanceImplementation.page, + title: PAGES_CONSTANTS.governanceImplementation.titleAbbreviation, + enabled: !!daoConfig.governanceImplementation, + }, ]; return ( diff --git a/packages/graphql-client/generated.ts b/packages/graphql-client/generated.ts index 4377ec42f..581e51f70 100644 --- a/packages/graphql-client/generated.ts +++ b/packages/graphql-client/generated.ts @@ -16,12 +16,9 @@ export type Scalars = { Int: { input: number; output: number; } Float: { input: number; output: number; } BigInt: { input: any; output: any; } - /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ JSON: { input: any; output: any; } - /** Integers that will have a value of 0 or more. */ NonNegativeInt: { input: any; output: any; } ObjMap: { input: any; output: any; } - /** Integers that will have a value greater than 0. */ PositiveInt: { input: any; output: any; } }; @@ -498,6 +495,7 @@ export type QueryVotesOnchainsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -513,6 +511,7 @@ export type QueryVotingPowerHistorysArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -546,6 +545,12 @@ export type QueryVotingPowersArgs = { toValue?: InputMaybe; }; +export type ViewPageInfo = { + __typename?: 'ViewPageInfo'; + hasNextPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output']; +}; + export type Account = { __typename?: 'account'; balances?: Maybe; @@ -565,6 +570,7 @@ export type AccountBalancesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -575,6 +581,7 @@ export type AccountDelegatedFromBalancesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -585,6 +592,7 @@ export type AccountDelegationsFromArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -595,6 +603,7 @@ export type AccountDelegationsToArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -605,6 +614,7 @@ export type AccountPowersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -615,6 +625,7 @@ export type AccountProposalsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -625,6 +636,7 @@ export type AccountReceivedTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -635,6 +647,7 @@ export type AccountSentTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -645,6 +658,7 @@ export type AccountVotesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -1421,6 +1435,7 @@ export type ProposalsOnchainVotesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -2444,6 +2459,7 @@ export type TransactionDelegationsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -2454,6 +2470,7 @@ export type TransactionTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; diff --git a/packages/graphql-client/types.ts b/packages/graphql-client/types.ts index 978b15129..35ad33617 100644 --- a/packages/graphql-client/types.ts +++ b/packages/graphql-client/types.ts @@ -13,12 +13,9 @@ export type Scalars = { Int: { input: number; output: number; } Float: { input: number; output: number; } BigInt: { input: any; output: any; } - /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ JSON: { input: any; output: any; } - /** Integers that will have a value of 0 or more. */ NonNegativeInt: { input: any; output: any; } ObjMap: { input: any; output: any; } - /** Integers that will have a value greater than 0. */ PositiveInt: { input: any; output: any; } }; @@ -495,6 +492,7 @@ export type QueryVotesOnchainsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -510,6 +508,7 @@ export type QueryVotingPowerHistorysArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -543,6 +542,12 @@ export type QueryVotingPowersArgs = { toValue?: InputMaybe; }; +export type ViewPageInfo = { + __typename?: 'ViewPageInfo'; + hasNextPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output']; +}; + export type Account = { __typename?: 'account'; balances?: Maybe; @@ -562,6 +567,7 @@ export type AccountBalancesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -572,6 +578,7 @@ export type AccountDelegatedFromBalancesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -582,6 +589,7 @@ export type AccountDelegationsFromArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -592,6 +600,7 @@ export type AccountDelegationsToArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -602,6 +611,7 @@ export type AccountPowersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -612,6 +622,7 @@ export type AccountProposalsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -622,6 +633,7 @@ export type AccountReceivedTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -632,6 +644,7 @@ export type AccountSentTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -642,6 +655,7 @@ export type AccountVotesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -1418,6 +1432,7 @@ export type ProposalsOnchainVotesArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -2441,6 +2456,7 @@ export type TransactionDelegationsArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe; @@ -2451,6 +2467,7 @@ export type TransactionTransfersArgs = { after?: InputMaybe; before?: InputMaybe; limit?: InputMaybe; + offset?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; where?: InputMaybe;