@@ -3,7 +3,7 @@ import { Link, useParams } from 'react-router-dom';
33import { AuthPrompt } from './AuthPrompt' ;
44import { MarkdownText } from './MarkdownText' ;
55import type { AssetUploadResponse , PollDetailResponse , PollWinnerResponse , SessionState } from '../types' ;
6- import { formatWindow , pollStatusLabel , shouldShowVotingMethod , votingMethodLabel } from '../utils/format' ;
6+ import { formatWindow , pollStatusLabel , shouldShowTotalVotes , shouldShowVotingMethod , votingMethodLabel } from '../utils/format' ;
77
88export type PollDetailPageProps = {
99 sessionState : SessionState ;
@@ -78,6 +78,7 @@ export function PollDetailPage({ sessionState, fetchDetail, assetCache }: PollDe
7878 }
7979
8080 const isTie = detail . winners . length > 1 && detail . winners . every ( ( w ) => w . votes === detail . winners [ 0 ] . votes ) ;
81+ const showTotalVotes = shouldShowTotalVotes ( detail . status ) ;
8182 const showVotingMethod = shouldShowVotingMethod ( detail . status , detail . votingMethod ) ;
8283
8384 const winnerTitle = ( winner : PollWinnerResponse ) => {
@@ -127,10 +128,12 @@ export function PollDetailPage({ sessionState, fetchDetail, assetCache }: PollDe
127128 < p className = "muted" > Selections</ p >
128129 < p className = "metric" > Up to { detail . maxSelections } </ p >
129130 </ div >
130- < div >
131- < p className = "muted" > Total votes</ p >
132- < p className = "metric" > { detail . totalVotes } </ p >
133- </ div >
131+ { showTotalVotes && (
132+ < div >
133+ < p className = "muted" > Total votes</ p >
134+ < p className = "metric" > { detail . totalVotes } </ p >
135+ </ div >
136+ ) }
134137 < div >
135138 < p className = "muted" > Visibility</ p >
136139 < p className = "metric" > { detail . hideEntriesUntilVoting ? 'Hidden until voting' : 'Entries visible' } </ p >
0 commit comments