// Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; import classNames from 'classnames'; import type { Props as AvatarProps } from './Avatar'; import { Avatar } from './Avatar'; import { useRestoreFocus } from '../hooks/useRestoreFocus'; import type { LocalizerType, ThemeType } from '../types/Util'; import { Emojify } from './conversation/Emojify'; export type Props = { readonly i18n: LocalizerType; readonly theme: ThemeType; hasPendingUpdate: boolean; startUpdate: () => unknown; onEditProfile: () => unknown; onViewPreferences: () => unknown; onViewArchive: () => unknown; // Matches Popper's RefHandler type innerRef?: React.Ref; style: React.CSSProperties; name?: string; } & Omit; export function AvatarPopup(props: Props): JSX.Element { const { hasPendingUpdate, i18n, name, onEditProfile, onViewArchive, onViewPreferences, phoneNumber, profileName, startUpdate, style, title, } = props; const shouldShowNumber = Boolean(name || profileName); // Note: mechanisms to dismiss this view are all in its host, MainHeader // Focus first button after initial render, restore focus on teardown const [focusRef] = useRestoreFocus(); return (

{hasPendingUpdate && ( )}
); }