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 ? ( + + ) : ( + + )} )}