From e51cde1770272eb339c76db4aa1a7addd1f46056 Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:33:58 -0700 Subject: [PATCH] Animate call link join requests --- .../CallingPendingParticipants.scss | 5 +- ts/components/CallScreen.tsx | 2 +- .../CallingPendingParticipants.stories.tsx | 20 ++++ ts/components/CallingPendingParticipants.tsx | 97 ++++++++++++++++--- ts/util/lint/exceptions.json | 8 ++ 5 files changed, 117 insertions(+), 15 deletions(-) diff --git a/stylesheets/components/CallingPendingParticipants.scss b/stylesheets/components/CallingPendingParticipants.scss index 245fbbaabf..bfed0a9b9b 100644 --- a/stylesheets/components/CallingPendingParticipants.scss +++ b/stylesheets/components/CallingPendingParticipants.scss @@ -14,10 +14,13 @@ width: 364px; padding-inline: 0; padding-block-start: 0; - background: $color-gray-78; outline: 0; } +.CallingPendingParticipants--Expandable { + background: $color-gray-78; +} + .CallingPendingParticipants--Expanded { padding-block-end: 2px; } diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index d491e7062c..b56bb92d97 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -858,7 +858,7 @@ export function CallScreen({ renderRaisedHandsToast={renderRaisedHandsToast} i18n={i18n} /> - {pendingParticipants.length ? ( + {isCallLinkAdmin ? ( (0); + React.useEffect(() => { + const interval = setInterval(() => { + setCountIndex((countIndex + 1) % counts.length); + }, 1000); + + return () => clearInterval(interval); + }, [countIndex, counts.length]); + + return ( + + ); +} + export function ExpandedOne(): JSX.Element { return ( (); + lastParticipantRef.current = participants[0] ?? lastParticipantRef.current; + const participantCount = participants.length; + const prevParticipantCount = usePrevious(participantCount, participantCount); + + const [isVisible, setIsVisible] = useState(participantCount > 0); const [isExpanded, setIsExpanded] = useState(defaultIsExpanded ?? false); const [confirmDialogState, setConfirmDialogState] = - React.useState(ConfirmDialogState.None); - const [serviceIdsStagedForAction, setServiceIdsStagedForAction] = - React.useState>([]); + useState(ConfirmDialogState.None); + const [serviceIdsStagedForAction, setServiceIdsStagedForAction] = useState< + Array + >([]); const expandedListRef = useRef(null); @@ -120,7 +147,7 @@ export function CallingPendingParticipants({ }, [serviceIdsStagedForAction, batchUserAction, hideConfirmDialog]); const renderApprovalButtons = useCallback( - (participant: ConversationType) => { + (participant: ConversationType, isEnabled: boolean = true) => { if (participant.serviceId == null) { return null; } @@ -130,7 +157,7 @@ export function CallingPendingParticipants({ - {renderApprovalButtons(participant)} + {renderApprovalButtons(participant, participantCount > 0)} - {participants.length > 1 && ( + {isExpandable && (
)} - + ); } diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index b932b0f9f2..9506526bdb 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -3126,5 +3126,13 @@ "line": " message.innerHTML = window.i18n('icu:optimizingApplication');", "reasonCategory": "usageTrusted", "updated": "2021-09-17T21:02:59.414Z" + }, + { + "rule": "React-useRef", + "path": "ts/components/CallingPendingParticipants.tsx", + "line": " const lastParticipantRef = React.useRef();", + "reasonCategory": "usageTrusted", + "updated": "2024-09-20T02:11:27.851Z", + "reasonDetail": "For fading out, to keep showing the last known participant" } ]