diff --git a/frontend/src/components/UserDashboard.tsx b/frontend/src/components/UserDashboard.tsx new file mode 100644 index 0000000..fe2f124 --- /dev/null +++ b/frontend/src/components/UserDashboard.tsx @@ -0,0 +1,158 @@ +import type { Proposal, VoteRecord } from '../types'; +import { formatTokenAmount } from '../utils'; + +interface Props { + walletAddress: string; + tokenBalance: bigint | null; + decimals: number; + proposals: Proposal[]; + votedMap: Map; + onCreateProposal: () => void; + onDisconnect: () => void; +} + +const VOTE_ICON: Record = { Yes: '✅', No: '❌', Abstain: '⬜' }; + +export function UserDashboard({ + walletAddress, + tokenBalance, + decimals, + proposals, + votedMap, + onCreateProposal, + onDisconnect, +}: Props) { + const active = proposals.filter(p => p.state === 'Active'); + const voted = proposals.filter(p => votedMap.has(p.id)); + const unvoted = active.filter(p => !votedMap.has(p.id)); + + return ( + + ); +}