diff --git a/packages/web/src/components/board/poll-display.tsx b/packages/web/src/components/board/poll-display.tsx index 3661fee..20a0dd7 100644 --- a/packages/web/src/components/board/poll-display.tsx +++ b/packages/web/src/components/board/poll-display.tsx @@ -159,6 +159,7 @@ export function PollDisplay({ postId, poll, onRefresh }: PollDisplayProps) { }; const canVote = !poll.isExpired; + const showResults = poll.hasVoted || poll.isExpired; const handleShowVoters = (option: PollOption) => { setSelectedOption(option); @@ -179,10 +180,12 @@ export function PollDisplay({ postId, poll, onRefresh }: PollDisplayProps) { {formatExpiresAt(poll.expiresAt)} - - - {poll.totalVotes}명 참여 - + {showResults && ( + + + {poll.totalVotes}명 참여 + + )} {poll.isAnonymous && ( @@ -211,7 +214,7 @@ export function PollDisplay({ postId, poll, onRefresh }: PollDisplayProps) { }`} > {/* Progress bar background */} - {option.percentage > 0 && ( + {showResults && option.percentage > 0 && (
-
+
{option.voted && ( @@ -229,14 +232,16 @@ export function PollDisplay({ postId, poll, onRefresh }: PollDisplayProps) { {poll.pollType === 'date' ? formatPollDate(option.optionText) : option.optionText}
- - {option.voteCount}표 ({option.percentage}%) - + {showResults && ( + + {option.voteCount}표 ({option.percentage}%) + + )}
{/* Progress bar */} - {option.percentage > 0 && ( -
+ {showResults && option.percentage > 0 && ( +
0 && ( + {showResults && !poll.isAnonymous && option.voters.length > 0 && (
{option.voters.slice(0, 5).map((voter) => ( @@ -305,6 +310,12 @@ export function PollDisplay({ postId, poll, onRefresh }: PollDisplayProps) {
)} + {!showResults && canVote && ( +
+ 투표 후 결과를 확인할 수 있습니다 +
+ )} + {poll.isExpired && !poll.hasVoted && (
마감된 투표입니다