// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import classNames from 'classnames'; import { getBadgeImageFileLocalPath } from '../badges/getBadgeImageFileLocalPath'; import { Modal } from './Modal'; import { BadgeImageTheme } from '../badges/BadgeImageTheme'; import type { PreferredBadgeSelectorType } from '../state/selectors/badges'; import type { LocalizerType } from '../types/Util'; const CLASS_NAME = 'OutgoingGiftBadgeModal'; export type PropsType = { recipientTitle: string; i18n: LocalizerType; badgeId: string; hideOutgoingGiftBadgeModal: () => unknown; getPreferredBadge: PreferredBadgeSelectorType; }; export function OutgoingGiftBadgeModal({ recipientTitle, i18n, badgeId, hideOutgoingGiftBadgeModal, getPreferredBadge, }: PropsType): JSX.Element { const badge = getPreferredBadge([{ id: badgeId }]); const badgeSize = 140; const badgeImagePath = getBadgeImageFileLocalPath( badge, badgeSize, BadgeImageTheme.Transparent ); const badgeElement = badge ? ( {badge.name} ) : (
); return (
{i18n('modal--giftBadge--title')}
{i18n('modal--giftBadge--description', { name: recipientTitle })}
{badgeElement}
{i18n('message--giftBadge')}
); }