Skip to content

Commit

Permalink
Merge pull request #3215 from OlympusDAO/addBlockNumberGov
Browse files Browse the repository at this point in the history
add block number tooltip. block time to date should be 12 sec
  • Loading branch information
brightiron authored Oct 9, 2024
2 parents 211b13d + e115bc4 commit 44c23e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
28 changes: 16 additions & 12 deletions src/views/Governance/Components/Status.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Typography } from "@mui/material";
import { Box, Tooltip, Typography } from "@mui/material";
import { Paper } from "@olympusdao/component-library";
import { useGetCanceledTime } from "src/views/Governance/hooks/useGetCanceledTime";
import { useGetExecutedTime } from "src/views/Governance/hooks/useGetExecutedTime";
Expand Down Expand Up @@ -29,19 +29,23 @@ export const Status = ({ proposalId }: { proposalId: number }) => {
<Typography fontSize="12px">{proposal?.createdAtBlock?.toLocaleString()}</Typography>
<Typography fontWeight="500">Published Onchain</Typography>
</div>
<div>
<Typography fontSize="12px">{proposalDetails?.startDate?.toLocaleString()}</Typography>
<Typography fontWeight="500">Voting Period Starts</Typography>
</div>
{(proposalDetails?.endDate || placeholderEndDate) && (
<Tooltip title={`Block ${proposalDetails?.startBlock}`}>
<div>
<Typography fontSize="12px">
{proposalDetails.endDate
? proposalDetails?.endDate?.toLocaleString()
: placeholderEndDate?.toLocaleString()}
</Typography>
<Typography fontWeight="500">Voting Period Ends</Typography>
<Typography fontSize="12px">{proposalDetails?.startDate?.toLocaleString()}</Typography>
<Typography fontWeight="500">Voting Period Starts</Typography>
</div>
</Tooltip>
{(proposalDetails?.endDate || placeholderEndDate) && (
<Tooltip title={`Block ${proposalDetails.endBlock}`}>
<div>
<Typography fontSize="12px">
{proposalDetails.endDate
? proposalDetails?.endDate?.toLocaleString()
: placeholderEndDate?.toLocaleString()}
</Typography>
<Typography fontWeight="500">Voting Period Ends </Typography>
</div>
</Tooltip>
)}
{proposalDetails?.status === "Queued" && (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/views/Governance/hooks/useGetProposalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const useGetProposalDetails = ({ proposalId }: { proposalId: number }) =>
const blockTime = await archiveProvider.getBlock("latest");
const endDateBlockTimestamp = await archiveProvider.getBlock(Number(proposalDetails.endBlock));
const startDateBlockTimestamp = await archiveProvider.getBlock(Number(proposalDetails.startBlock));
const startDate = getDateFromBlock(Number(proposalDetails.startBlock), blockTime.number, 15, blockTime.timestamp);
const endDate = getDateFromBlock(Number(proposalDetails.endBlock), blockTime.number, 15, blockTime.timestamp);
const startDate = getDateFromBlock(Number(proposalDetails.startBlock), blockTime.number, 12, blockTime.timestamp);
const endDate = getDateFromBlock(Number(proposalDetails.endBlock), blockTime.number, 12, blockTime.timestamp);

return {
id: proposalDetails.id.toNumber(),
Expand Down

0 comments on commit 44c23e7

Please sign in to comment.