From c82b5618b6e07423d5568442278b6c42c5ca67c9 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Mon, 31 Jul 2023 16:00:06 -0400 Subject: [PATCH] fix: show final tally result table if voting period is closed --- src/components/organisms/proposal-summary.tsx | 4 ++-- src/pages/proposal-page.tsx | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/organisms/proposal-summary.tsx b/src/components/organisms/proposal-summary.tsx index 8de7865..708d489 100644 --- a/src/components/organisms/proposal-summary.tsx +++ b/src/components/organisms/proposal-summary.tsx @@ -36,16 +36,16 @@ export const ProposalSummary = ({ proposal, userVote, votes, + votingClosed, }: { group: UIGroup onVote?: (option: VoteOptionType) => void proposal: UIProposal userVote?: Vote votes?: Vote[] + votingClosed?: boolean }) => { const cardBgDark = useColorModeValue('gray.100', 'gray.700') - const now = new Date() - const votingClosed = new Date(proposal.votingPeriodEnd || now).getTime() < now.getTime() const proposalFinalized = proposal.status.toString() === 'PROPOSAL_STATUS_ACCEPTED' || proposal.status.toString() === 'PROPOSAL_STATUS_REJECTED' diff --git a/src/pages/proposal-page.tsx b/src/pages/proposal-page.tsx index e5e3139..cd924e6 100644 --- a/src/pages/proposal-page.tsx +++ b/src/pages/proposal-page.tsx @@ -84,6 +84,12 @@ export default function ProposalPage() { throwError('Group not found') } + const now = new Date() + const votingClosed = + new Date( + isHistorical ? historicalProposal.votingPeriodEnd : proposal.votingPeriodEnd, + ).getTime() < now.getTime() + return ( @@ -99,8 +105,11 @@ export default function ProposalPage() { {isHistorical ? ( <> - - + - + {votingClosed ? ( + + ) : ( + + )} )}