Skip to content

Commit

Permalink
DAO-561 Will now show transfer to info (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Freshenext authored Jul 19, 2024
1 parent b5d4005 commit 3723733
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/app/proposals/LatestProposalsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ interface ProposalNameColumnProps {
}

const ProposalNameColumn = ({ name, proposalId }: ProposalNameColumnProps) => (
<Link href={`/proposals/${proposalId}`} target="_blank">
{name}
</Link>
<Link href={`/proposals/${proposalId}`}>{name}</Link>
)

const VotesColumn = ({ proposalId }: Omit<ProposalNameColumnProps, 'name'>) => {
Expand Down
6 changes: 5 additions & 1 deletion src/app/proposals/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ export interface EventArgumentsParameter {
voteStart: bigint
voteEnd: bigint
proposer: string
targets: string[]
values: bigint[]
}
timeStamp: string
}

export const getEventArguments = ({
args: { description, proposalId, proposer },
args: { description, proposalId, proposer, targets, values },
timeStamp,
}: EventArgumentsParameter) => ({
name: description.split(';')[0],
proposer,
description: description.split(';')[1],
proposalId: proposalId.toString(),
Starts: new Date(parseInt(timeStamp, 16) * 1000).toISOString().split('T')[0],
transferTo: targets[0] ?? '',
transferToValue: values[0] ?? '',
})
27 changes: 19 additions & 8 deletions src/pages/proposals/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import { useAccount } from 'wagmi'
import { Vote, VoteProposalModal } from '../../components/Modal/VoteProposalModal'
import { VoteSubmittedModal } from '../../components/Modal/VoteSubmittedModal'
import { useVotingPower } from '@/app/proposals/hooks/useVotingPower'
import { shortAddress } from '@/lib/utils'
import { shortAddress, truncateMiddle } from '@/lib/utils'
import { getEventArguments } from '@/app/proposals/shared/utils'
import { useGetProposalVotes } from '@/app/proposals/hooks/useGetProposalVotes'
import { useGetProposalSnapshot } from '@/app/proposals/hooks/useGetProposalSnapshot'
import { formatUnits } from 'viem'

export default function ProposalView() {
const {
Expand Down Expand Up @@ -148,14 +149,24 @@ const PageWithProposal = (proposal: PageWithProposal) => {
<Header variant="h1" className="text-[24px]">
Actions
</Header>
<div className="flex flex-row justify-between border border-white border-opacity-40 rounded-lg px-[16px] py-[11px]">
<div className="border border-white border-opacity-40 rounded-lg px-[16px] py-[11px]">
<div className="flex flex-col">
<Paragraph variant="semibold" className="text-[16px]">
Transfer
</Paragraph>
<Paragraph variant="semibold" className="text-[16px]">
To
</Paragraph>
<div className="flex justify-between">
<Paragraph variant="semibold" className="text-[16px]">
Transfer
</Paragraph>
<Paragraph variant="semibold" className="text-[16px]">
{formatUnits(proposal.transferToValue, 18)}
</Paragraph>
</div>
<div className="flex justify-between">
<Paragraph variant="semibold" className="text-[16px]">
To
</Paragraph>
<Paragraph variant="semibold" className="text-[16px]">
{truncateMiddle(proposal.transferTo)}
</Paragraph>
</div>
</div>
<div>
{/* <Paragraph variant="semibold" className="text-[16px]">
Expand Down

0 comments on commit 3723733

Please sign in to comment.