diff --git a/admin/src/pages/public/SchedulingPollPage.tsx b/admin/src/pages/public/SchedulingPollPage.tsx index 7c35e5d2..81836362 100644 --- a/admin/src/pages/public/SchedulingPollPage.tsx +++ b/admin/src/pages/public/SchedulingPollPage.tsx @@ -15,6 +15,7 @@ import { Space, Divider, Alert, + Collapse, } from 'antd'; import { CalendarOutlined, @@ -22,6 +23,7 @@ import { EnvironmentOutlined, CheckCircleOutlined, SendOutlined, + EyeOutlined, } from '@ant-design/icons'; import axios from 'axios'; import dayjs from 'dayjs'; @@ -58,6 +60,7 @@ export default function SchedulingPollPage() { const [votes, setVotes] = useState>({}); const [submitting, setSubmitting] = useState(false); const [hasVoted, setHasVoted] = useState(false); + const [voteSuccess, setVoteSuccess] = useState(false); // Comment form state const [commentName, setCommentName] = useState(user?.name || ''); @@ -98,6 +101,7 @@ export default function SchedulingPollPage() { useEffect(() => { fetchPoll(); }, [fetchPoll]); const handleVoteChange = (optionId: string, value: PollVoteValue) => { + setVoteSuccess(false); setVotes((prev) => ({ ...prev, [optionId]: value })); }; @@ -128,6 +132,7 @@ export default function SchedulingPollPage() { message.success(hasVoted ? 'Votes updated' : 'Votes submitted'); setHasVoted(true); + setVoteSuccess(true); fetchPoll(); } catch (err: any) { message.error(err.response?.data?.error?.message || 'Failed to submit votes'); @@ -287,6 +292,66 @@ export default function SchedulingPollPage() { )} ))} + + {/* Mobile: collapsible voter responses */} + {(poll.voters?.length ?? 0) > 0 && ( + + + View Responses ({poll.voters?.length}) + + ), + children: ( +
+ {poll.voters?.map((voter, i) => ( +
+ {voter.name} +
+ {poll.options?.map((opt) => { + const value = voter.votes[opt.id] as PollVoteValue | undefined; + return value ? ( + + {dayjs(opt.date).format('M/D')} {VOTE_VALUE_LABELS[value]} + + ) : null; + })} +
+
+ ))} + {/* Score summary */} + + Scores +
+ {poll.options?.map((opt) => ( + 0 ? 'green' : 'default'} + style={{ fontSize: 11 }} + > + {dayjs(opt.date).format('M/D')}: {opt.score ?? 0} + + ))} +
+
+ ), + }]} + /> + )} ) : ( /* Desktop: voting matrix */ @@ -437,6 +502,18 @@ export default function SchedulingPollPage() { > {hasVoted ? 'Update Votes' : 'Submit Votes'} + + {voteSuccess && ( + } + style={{ marginTop: 12 }} + closable + onClose={() => setVoteSuccess(false)} + /> + )} )}