diff --git a/src/components/organisms/proposal-final-tally-table.tsx b/src/components/organisms/proposal-final-tally-table.tsx new file mode 100644 index 0000000..ff441af --- /dev/null +++ b/src/components/organisms/proposal-final-tally-table.tsx @@ -0,0 +1,34 @@ +import { TallyResult } from '@regen-network/api/types/codegen/cosmos/group/v1/types' + +import { Table, TableContainer, Tbody, Td, Th, Thead, Tr } from '@/atoms' +import { TableTitlebar } from '@/molecules/table-titlebar' + +export const ProposalFinalTallyTable = ({ + finalTallyResult, +}: { + finalTallyResult: TallyResult +}) => { + return ( + + + + + + + + + + + + + + + + + + + +
YesNoAbstainNo with veto
{finalTallyResult.yesCount}{finalTallyResult.noCount}{finalTallyResult.abstainCount}{finalTallyResult.noWithVetoCount}
+
+ ) +} diff --git a/src/hooks/use-query.ts b/src/hooks/use-query.ts index 6bb114e..1c7dac3 100644 --- a/src/hooks/use-query.ts +++ b/src/hooks/use-query.ts @@ -115,7 +115,12 @@ export function useHistoricalProposal(proposalId?: string) { groupVersion: proposal.groupVersion, groupPolicyVersion: proposal.groupPolicyVersion, status: ProposalStatus[proposal.status as keyof typeof ProposalStatus], - finalTallyResult: proposal.finalTallyResult, + finalTallyResult: { + yesCount: proposal.finalTallyResult.yes_count, + noCount: proposal.finalTallyResult.no_count, + abstainCount: proposal.finalTallyResult.abstain_count, + noWithVetoCount: proposal.finalTallyResult.no_with_veto_count, + }, messages: proposal.messages, submitTime: proposal.submitTime, votingPeriodEnd: proposal.votingPeriodEnd, diff --git a/src/pages/proposal-page.tsx b/src/pages/proposal-page.tsx index b280cf7..bd94bca 100644 --- a/src/pages/proposal-page.tsx +++ b/src/pages/proposal-page.tsx @@ -18,6 +18,7 @@ import { useTxToasts } from 'hooks/use-toasts' import { Button, PageContainer, RouteLink, Stack } from '@/atoms' import { Loading } from '@/molecules/loading' import { ProposalDetails } from '@/organisms/proposal-details' +import { ProposalFinalTallyTable } from '@/organisms/proposal-final-tally-table' import { ProposalSummary } from '@/organisms/proposal-summary' import { ProposalVotesTable } from '@/organisms/proposal-votes-table' @@ -59,6 +60,8 @@ export default function ProposalPage() { !isLoadingGroup && !isLoadingHistoricalProposal ) { + const { finalTallyResult } = historicalProposal + console.log({ finalTallyResult }) return ( @@ -78,6 +81,7 @@ export default function ProposalPage() { group={group} /> + )