From f6f0fe23df043f71099da5622a8d626ac8f8a46f Mon Sep 17 00:00:00 2001 From: Tim Vahlbrock Date: Sat, 26 Oct 2024 13:08:52 +0200 Subject: [PATCH] Show vote face pile only if there are less than five members in the room --- src/components/views/polls/PollOption.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/views/polls/PollOption.tsx b/src/components/views/polls/PollOption.tsx index c0b6beef97..0c624eac9b 100644 --- a/src/components/views/polls/PollOption.tsx +++ b/src/components/views/polls/PollOption.tsx @@ -18,6 +18,8 @@ import FacePile from "../elements/FacePile"; import StyledRadioButton from "../elements/StyledRadioButton"; import { UserVote } from "../messages/MPollBody"; +const MAXIMUM_MEMBERS_FOR_FACE_PILE = 5; + type PollOptionContentProps = { answer: PollAnswerSubevent; votes: UserVote[]; @@ -25,7 +27,7 @@ type PollOptionContentProps = { isWinner?: boolean; }; const PollOptionContent: React.FC = ({ isWinner, answer, votes, displayVoteCount }) => { - const votesText = displayVoteCount ? _t("timeline|m.poll|count_of_votes", { count: votes.length }) : ""; + const votesText = displayVoteCount ? : ""; const room = useContext(RoomContext).room!; const members = useRoomMembers(room); @@ -35,12 +37,15 @@ const PollOptionContent: React.FC = ({ isWinner, answer,
{isWinner && }
- votes.some((v) => v.sender === m.userId))} - size="24px" - overflow={false} - style={{ marginRight: "10px" }} - /> + {displayVoteCount + && members.length <= MAXIMUM_MEMBERS_FOR_FACE_PILE + && votes.some((v) => v.sender === m.userId))} + size="24px" + overflow={false} + style={{ marginRight: "10px" }} + /> + } {votesText}