@@ -7,12 +7,14 @@ import {VoteButtons} from 'web/components/votes/vote-buttons'
77import { getVoteCreator } from "web/lib/supabase/votes" ;
88import { useEffect , useState } from "react" ;
99import Link from "next/link" ;
10+ import { STATUS_CHOICES } from "common/votes/constants" ;
1011
1112export type Vote = rowFor < 'votes' > & {
1213 votes_for : number
1314 votes_against : number
1415 votes_abstain : number
1516 priority : number
17+ status ?: string
1618}
1719
1820export function VoteItem ( props : {
@@ -24,7 +26,7 @@ export function VoteItem(props: {
2426 useEffect ( ( ) => {
2527 getVoteCreator ( vote . creator_id ) . then ( setCreator )
2628 } , [ vote . creator_id ] )
27- // console.debug('creator', creator)
29+ // console.debug('creator', creator, vote )
2830 return (
2931 < Col className = { 'mb-4 rounded-lg border border-canvas-200 p-4' } >
3032 < Row className = { 'mb-2' } >
@@ -35,19 +37,28 @@ export function VoteItem(props: {
3537 </ Col >
3638 < Row className = { 'gap-2 mt-2 items-center justify-between w-full custom-link flex-wrap' } >
3739 { ! ! vote . priority ? < div > Priority: { vote . priority . toFixed ( 0 ) } %</ div > : < p > </ p > }
38- { ! vote . is_anonymous && creator ?. username && < Link href = { `/${ creator . username } ` } className = "custom-link" > { creator . username } </ Link > }
40+ { ! vote . is_anonymous && creator ?. username &&
41+ < Link href = { `/${ creator . username } ` } className = "custom-link" > { creator . username } </ Link > }
3942 </ Row >
40- < VoteButtons
41- voteId = { vote . id }
42- counts = { {
43- for : vote . votes_for ,
44- abstain : vote . votes_abstain ,
45- against : vote . votes_against ,
46- } }
47- onVoted = { onVoted }
48- />
4943 </ Col >
5044 </ Row >
45+ < Row className = "flex-wrap gap-2 items-center justify-between" >
46+ < VoteButtons
47+ voteId = { vote . id }
48+ counts = { {
49+ for : vote . votes_for ,
50+ abstain : vote . votes_abstain ,
51+ against : vote . votes_against ,
52+ } }
53+ onVoted = { onVoted }
54+ disabled = { vote . status !== 'voting_open' }
55+ />
56+ { vote . status && (
57+ < p className = "text-ink-500" >
58+ { STATUS_CHOICES [ vote . status ] }
59+ </ p >
60+ ) }
61+ </ Row >
5162 </ Col >
5263 )
5364}
0 commit comments