// Copyright 2019-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; import classNames from 'classnames'; import { Avatar, Props as AvatarProps } from './Avatar'; import { useRestoreFocus } from '../util/hooks'; import { LocalizerType } from '../types/Util'; export type Props = { readonly i18n: LocalizerType; onEditProfile: () => unknown; onSetChatColor: () => unknown; onViewPreferences: () => unknown; onViewArchive: () => unknown; // Matches Popper's RefHandler type innerRef?: React.Ref; style: React.CSSProperties; } & AvatarProps; export const AvatarPopup = (props: Props): JSX.Element => { const { i18n, name, profileName, phoneNumber, title, onEditProfile, onSetChatColor, onViewPreferences, onViewArchive, style, } = 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 (

); };