// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { ReactChild, ReactNode } from 'react'; import React from 'react'; import type { LocalizerType, ThemeType } from '../types/Util'; import type { ConversationType } from '../state/ducks/conversations'; import type { PreferredBadgeSelectorType } from '../state/selectors/badges'; import { ModalHost } from './ModalHost'; import { Button, ButtonVariant } from './Button'; import { Avatar, AvatarSize } from './Avatar'; import { ContactName } from './conversation/ContactName'; type PropsType = { children: ReactNode; i18n: LocalizerType; onClickPrimaryButton: () => void; onClose: () => void; primaryButtonText: string; title: string; } & ( | // We use this empty type for an "all or nothing" setup. // eslint-disable-next-line @typescript-eslint/ban-types {} | { onClickSecondaryButton: () => void; secondaryButtonText: string; } ); // TODO: This should use . See DESKTOP-1038. export function GroupDialog(props: Readonly): JSX.Element { const { children, i18n, onClickPrimaryButton, onClose, primaryButtonText, title, } = props; let secondaryButton: undefined | ReactChild; if ('secondaryButtonText' in props) { const { onClickSecondaryButton, secondaryButtonText } = props; secondaryButton = ( ); } return (
); } type ParagraphPropsType = { children: ReactNode; }; GroupDialog.Paragraph = ({ children, }: Readonly): JSX.Element => (

{children}

); type ContactsPropsType = { contacts: Array; getPreferredBadge: PreferredBadgeSelectorType; i18n: LocalizerType; theme: ThemeType; }; GroupDialog.Contacts = ({ contacts, getPreferredBadge, i18n, theme, }: Readonly) => (
    {contacts.map(contact => (
  • ))}
); function focusRef(el: HTMLElement | null) { if (el) { el.focus(); } }