Show vote face pile only if there are less than five members in the room
This commit is contained in:
parent
4c90e4775d
commit
f6f0fe23df
1 changed files with 12 additions and 7 deletions
|
@ -18,6 +18,8 @@ import FacePile from "../elements/FacePile";
|
||||||
import StyledRadioButton from "../elements/StyledRadioButton";
|
import StyledRadioButton from "../elements/StyledRadioButton";
|
||||||
import { UserVote } from "../messages/MPollBody";
|
import { UserVote } from "../messages/MPollBody";
|
||||||
|
|
||||||
|
const MAXIMUM_MEMBERS_FOR_FACE_PILE = 5;
|
||||||
|
|
||||||
type PollOptionContentProps = {
|
type PollOptionContentProps = {
|
||||||
answer: PollAnswerSubevent;
|
answer: PollAnswerSubevent;
|
||||||
votes: UserVote[];
|
votes: UserVote[];
|
||||||
|
@ -25,7 +27,7 @@ type PollOptionContentProps = {
|
||||||
isWinner?: boolean;
|
isWinner?: boolean;
|
||||||
};
|
};
|
||||||
const PollOptionContent: React.FC<PollOptionContentProps> = ({ isWinner, answer, votes, displayVoteCount }) => {
|
const PollOptionContent: React.FC<PollOptionContentProps> = ({ 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 room = useContext(RoomContext).room!;
|
||||||
const members = useRoomMembers(room);
|
const members = useRoomMembers(room);
|
||||||
|
|
||||||
|
@ -35,12 +37,15 @@ const PollOptionContent: React.FC<PollOptionContentProps> = ({ isWinner, answer,
|
||||||
<div className="mx_PollOption_optionVoteCount">
|
<div className="mx_PollOption_optionVoteCount">
|
||||||
{isWinner && <TrophyIcon className="mx_PollOption_winnerIcon" />}
|
{isWinner && <TrophyIcon className="mx_PollOption_winnerIcon" />}
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
<FacePile
|
{displayVoteCount
|
||||||
members={members.filter((m) => votes.some((v) => v.sender === m.userId))}
|
&& members.length <= MAXIMUM_MEMBERS_FOR_FACE_PILE
|
||||||
size="24px"
|
&& <FacePile
|
||||||
overflow={false}
|
members={members.filter((m) => votes.some((v) => v.sender === m.userId))}
|
||||||
style={{ marginRight: "10px" }}
|
size="24px"
|
||||||
/>
|
overflow={false}
|
||||||
|
style={{ marginRight: "10px" }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
{votesText}
|
{votesText}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue