Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 51 additions & 10 deletions pages/governance/proposal/[proposalId].governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ const CenterAlignedImage = styled('img')({
maxWidth: '100%',
});

const formatTime = (timestamp: number): string =>
dayjs.unix(timestamp).format('D MMM YYYY, HH:mm UTC Z');

const StyledLink = styled('a')({
color: 'inherit',
});
Expand All @@ -104,7 +107,6 @@ export default function ProposalPage({
const [loading, setLoading] = useState(!proposal || !isProposalStateImmutable(proposal));
const { breakpoints } = useTheme();
const xsmUp = useMediaQuery(breakpoints.up('xsm'));

const mightBeStale = !proposal || !isProposalStateImmutable(proposal);

async function updateProposal() {
Expand Down Expand Up @@ -150,6 +152,10 @@ export default function ProposalPage({
diff: 0,
};

const proposalHasExpired: boolean = proposal
? dayjs() > dayjs.unix(proposal.expirationTimestamp)
: false;

return (
<>
{ipfs && (
Expand Down Expand Up @@ -418,9 +424,7 @@ export default function ProposalPage({
captionVariant="description"
>
<Box sx={{ textAlign: 'right' }}>
<Typography>
~ {dayjs.unix(proposal.creationTimestamp).format('DD MMM YYYY, hh:mm a')}
</Typography>
<Typography>{formatTime(proposal.creationTimestamp)}</Typography>
<Typography variant="caption" color="text.muted">
{proposal.proposalCreated}
</Typography>
Expand All @@ -439,23 +443,60 @@ export default function ProposalPage({
captionVariant="description"
>
<Box sx={{ textAlign: 'right' }}>
<Typography>
~ {dayjs.unix(proposal.startTimestamp).format('DD MMM YYYY, hh:mm a')}
</Typography>
<Typography>{formatTime(proposal.startTimestamp)}</Typography>
<Typography variant="caption" color="text.muted">
{proposal.startBlock}
</Typography>
</Box>
</Row>
{proposalHasExpired ? (
<Row
caption={
<>
<Trans>Ended</Trans>
<Typography variant="caption" color="text.muted">
Block
</Typography>
</>
}
sx={{ height: 48 }}
captionVariant="description"
>
<Box sx={{ textAlign: 'right' }}>
<Typography>{formatTime(proposal.expirationTimestamp)}</Typography>
<Typography variant="caption" color="text.muted">
{proposal.endBlock}
</Typography>
</Box>
</Row>
) : (
<Row
caption={
<>
<Trans>Ends</Trans>
<Typography variant="caption" color="text.muted">
Block
</Typography>
</>
}
sx={{ height: 48 }}
captionVariant="description"
>
<Box sx={{ textAlign: 'right' }}>
<Typography>{formatTime(proposal.expirationTimestamp)}</Typography>
<Typography variant="caption" color="text.muted">
{proposal.endBlock}
</Typography>
</Box>
</Row>
)}
{proposal.executed && (
<Row
caption={<Trans>Executed</Trans>}
sx={{ height: 48 }}
captionVariant="description"
>
<Typography>
{dayjs.unix(proposal.executionTime).format('DD MMM YYYY, hh:mm a')}
</Typography>
<Typography>{formatTime(proposal.executionTime)}</Typography>
</Row>
)}
{ipfs?.author && (
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/messages.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,14 @@ msgstr "Enabling E-Mode only allows you to borrow assets belonging to the select
msgid "Enabling this asset as collateral increases your borrowing power and Health Factor. However, it can get liquidated if your health factor drops below 1."
msgstr "Enabling this asset as collateral increases your borrowing power and Health Factor. However, it can get liquidated if your health factor drops below 1."

#: pages/governance/proposal/[proposalId].governance.tsx
msgid "Ended"
msgstr "Ended"

#: pages/governance/proposal/[proposalId].governance.tsx
msgid "Ends"
msgstr "Ends"

#: src/layouts/components/LanguageSwitcher.tsx
msgid "English"
msgstr "English"
Expand Down