From 3b8fdd10590b2be14a4d5c55474e9dcce09d8265 Mon Sep 17 00:00:00 2001 From: zhirongwang Date: Wed, 3 Dec 2025 22:31:40 -0800 Subject: [PATCH 1/9] feat(presence-avatar-list): add BP tooltip to presenceAvatarList (WEBAPP-41740) --- src/features/presence/PresenceAvatarList.tsx | 108 +++++++++++++------ 1 file changed, 75 insertions(+), 33 deletions(-) diff --git a/src/features/presence/PresenceAvatarList.tsx b/src/features/presence/PresenceAvatarList.tsx index 3cb30bfd1a..c1072ac81f 100644 --- a/src/features/presence/PresenceAvatarList.tsx +++ b/src/features/presence/PresenceAvatarList.tsx @@ -1,6 +1,12 @@ import * as React from 'react'; import classNames from 'classnames'; import noop from 'lodash/noop'; +import { + Tooltip as BPTooltip, + TooltipProvider, + BlueprintModernizationProvider, + BlueprintModernizationContext, +} from '@box/blueprint-web'; // @ts-ignore flow import import PresenceAvatar from './PresenceAvatar'; import PresenceAvatarTooltipContent from './PresenceAvatarTooltipContent'; @@ -27,6 +33,7 @@ export type Props = { maxDisplayedAvatars?: number; onAvatarMouseEnter?: (id: string) => void; onAvatarMouseLeave?: () => void; + isPreviewModernizationEnabled?: boolean; }; function PresenceAvatarList(props: Props, ref: React.Ref): JSX.Element | null { @@ -40,9 +47,10 @@ function PresenceAvatarList(props: Props, ref: React.Ref): JSX.E maxDisplayedAvatars = 3, onAvatarMouseEnter = noop, onAvatarMouseLeave = noop, + isPreviewModernizationEnabled = false, ...rest } = props; - + const blueprintContext = React.useContext(BlueprintModernizationContext); const [activeTooltip, setActiveTooltip] = React.useState(null); const hideTooltip = (): void => { @@ -63,39 +71,60 @@ function PresenceAvatarList(props: Props, ref: React.Ref): JSX.E return null; } - return ( + const renderAvatar = (collaborator: Collaborator) => { + const { id, avatarUrl, name, isActive, interactedAt, interactionType } = collaborator; + + const avatarElement = ( +