From 52282bfccf2d8b7407a1dc91e2de726f9819f886 Mon Sep 17 00:00:00 2001 From: Hampus Date: Mon, 24 Aug 2026 12:55:22 +0200 Subject: [PATCH] refactor(app): collapse the wrapped voice avatar render branches into one (#1970) --- .../components/VoiceParticipantAvatarList.tsx | 82 ++++++++----------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/fluxer_app/src/features/voice/components/VoiceParticipantAvatarList.tsx b/fluxer_app/src/features/voice/components/VoiceParticipantAvatarList.tsx index 500f8545b..618cea58b 100644 --- a/fluxer_app/src/features/voice/components/VoiceParticipantAvatarList.tsx +++ b/fluxer_app/src/features/voice/components/VoiceParticipantAvatarList.tsx @@ -544,7 +544,7 @@ export const VoiceParticipantWrappedAvatarList: React.FC ( - // biome-ignore lint/a11y/noStaticElementInteractions: wrapped voice avatars expose a pointer-only context menu. -
handleContextMenu(event, entry)} - data-flx="voice.voice-participant-avatar-list.voice-participant-wrapped-avatar-list.wrap-avatar-slot" - > -
{ + const isCollapsed = slot.phase === 'exiting'; + const isEntering = slot.phase === 'entering'; + return ( + handleContextMenu(event, slot.entry)} + initial={shouldAnimateAvatarChanges && isEntering ? {width: 0, flexBasis: 0} : false} + animate={ + shouldAnimateAvatarChanges + ? {width: isCollapsed ? 0 : slotSize, flexBasis: isCollapsed ? 0 : slotSize} + : undefined + } + transition={WRAPPED_AVATAR_SLOT_TRANSITION} + onAnimationComplete={() => onSlotAnimationComplete(slot.key, slot.phase)} + data-flx="voice.voice-participant-avatar-list.voice-participant-wrapped-avatar-list.wrap-avatar-slot" > - {renderAvatar(entry)} -
-
- )); + + {renderAvatar(slot.entry)} + + + ); + }); return (
- {shouldAnimateAvatarChanges - ? animatedSlots.map((slot) => { - const isCollapsed = slot.phase === 'exiting'; - return ( - handleContextMenu(event, slot.entry)} - initial={slot.phase === 'entering' ? {width: 0, flexBasis: 0} : false} - animate={{ - width: isCollapsed ? 0 : slotSize, - flexBasis: isCollapsed ? 0 : slotSize, - }} - transition={WRAPPED_AVATAR_SLOT_TRANSITION} - onAnimationComplete={() => onSlotAnimationComplete(slot.key, slot.phase)} - data-flx="voice.voice-participant-avatar-list.voice-participant-wrapped-avatar-list.wrap-avatar-slot.motion" - > - - {renderAvatar(slot.entry)} - - - ); - }) - : finalAvatarNodes} + {avatarSlotNodes}
); },