// Copyright 2025 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import { tw } from '../../../axo/tw.js'; import { Modal } from '../../Modal.js'; import { Avatar, AvatarSize } from '../../Avatar.js'; import { ContactName } from '../ContactName.js'; import type { LocalizerType } from '../../../types/Util.js'; import type { PollVoteWithUserType, PollWithResolvedVotersType, } from '../../../state/selectors/message.js'; type PollVotesModalProps = { i18n: LocalizerType; poll: PollWithResolvedVotersType; onClose: () => void; }; export function PollVotesModal({ i18n, poll, onClose, }: PollVotesModalProps): JSX.Element { return (
{i18n('icu:PollVotesModal__questionLabel')}
{poll.question}
{poll.options.map((option, index) => { const voters = poll.votesByOption.get(index) || []; const optionKey = `option-${index}`; return (
{/* Option Header */}
{option}
{i18n('icu:PollVotesModal__voteCount', { count: voters.length, })}
{/* Voters List */}
{voters.map((vote: PollVoteWithUserType) => (
))}
); })} {poll.totalNumVotes === 0 && (
{i18n('icu:PollVotesModal__noVotes')}
)}
); }