Skip to content

Commit

Permalink
Merge pull request #3209 from OlympusDAO/develop
Browse files Browse the repository at this point in the history
[Release] - Fix Proposal Rendering
  • Loading branch information
brightiron authored Oct 1, 2024
2 parents 8746514 + a3c651b commit 9dfe844
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/views/Governance/Components/ProposalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ProposalContainer = ({
const { data: proposal, isLoading } = useGetProposalDetails({ proposalId });
const { data: parameters } = useGetContractParameters();

const formattedTitle = title?.split(/#+\s|\n/g)[1];
const formattedTitle = title;

const dateFormat = new Intl.DateTimeFormat([], {
month: "short",
Expand Down
14 changes: 8 additions & 6 deletions src/views/Governance/hooks/useGetProposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,27 @@ export const useGetProposals = () => {
blockNumber,
);

console.log("ProposalCreated events found:", proposalCreatedEvents.length);

// Process each event
for (const item of proposalCreatedEvents) {
const timestamp = (await archiveProvider.getBlock(item.blockNumber)).timestamp;

if (item.decode) {
const details = { ...item.decode(item.data), values: item.args[3] } as ProposalCreatedEventObject;

// Stop if we hit proposal ID 1
if (Number(details.id) === 1) {
foundProposalId1 = true;
break;
}

proposals.push({
createdAtBlock: new Date(timestamp * 1000),
details,
title: details.description.split(/#+\s|\n/g)[1] || `${details.description.slice(0, 20)}...`,
txHash: item.transactionHash,
});

// Stop if we hit proposal ID 1
if (Number(details.id) === 1) {
foundProposalId1 = true;
break;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/Governance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const Governance = () => {
<ProposalContainer
key={index}
proposalId={Number(item?.details.id)}
title={item?.details.description}
title={item.title}
createdAt={item?.createdAtBlock}
active
setProposals={setActiveProposals}
Expand Down

0 comments on commit 9dfe844

Please sign in to comment.