diff --git a/components/poll-process-result-section.tsx b/components/poll-process-result-section.tsx index 7e75cd5..46544d0 100644 --- a/components/poll-process-result-section.tsx +++ b/components/poll-process-result-section.tsx @@ -107,7 +107,7 @@ const PollProcessResultSection = () => {
- +
{ - const { pollAppState } = usePollAppStore(); +const PollSummarySubCard = () => { + const { pollAppState, numOfOptions, pollResultSummary } = usePollAppStore(); const pollSummaryTop = useMemo(() => { - return pollSummary.indexOf(Math.max(...pollSummary)); - }, [pollSummary]); + return pollResultSummary.indexOf(Math.max(...pollResultSummary)); + }, [pollResultSummary]); const cardRef = useRef(null); @@ -50,21 +46,41 @@ const PollSummarySubCard = ({ pollSummary }: PollSummarySubCardProps) => { - {pollSummary.map((value, index) => { - return ( - - - {pollSummaryTop === index && pollAppState === 'stop' - ? '👑' - : ' '} - - {index + 1} - - {value ?? 0} - - - ); - })} + {pollResultSummary.length === 0 + ? new Array(numOfOptions).fill(0).map((value, index) => { + return ( + + + {pollSummaryTop === index && pollAppState === 'stop' + ? '👑' + : ' '} + + + {index + 1} + + + {value ?? 0} + + + ); + }) + : pollResultSummary.map((value, index) => { + return ( + + + {pollSummaryTop === index && pollAppState === 'stop' + ? '👑' + : ' '} + + + {index + 1} + + + {value ?? 0} + + + ); + })} diff --git a/components/ui/table.tsx b/components/ui/table.tsx index 619a0dc..d8fef00 100644 --- a/components/ui/table.tsx +++ b/components/ui/table.tsx @@ -58,7 +58,7 @@ const TableRow = React.forwardRef<