import React from 'react'; import Tooltip from '../ui/Tooltip'; import Warning from '../icons/Warning'; import { useTranslation } from 'react-i18next'; export interface Props { memoriName: string; blockedUntil?: string; notEnoughCredits?: boolean; showGiverInfo?: boolean; showTitle?: boolean; marginLeft?: boolean; } const BlockedMemoriBadge = ({ memoriName, blockedUntil, notEnoughCredits = false, showGiverInfo = false, showTitle = false, marginLeft = false, }: Props) => { const { t } = useTranslation(); const blockedUntilDate = new Date(blockedUntil || Date.now()); return notEnoughCredits || blockedUntilDate > new Date(Date.now()) ? ( {t('notEnoughCredits')} ) : ( <> {!showGiverInfo && t('memoriBlockedAnon', { name: memoriName, date: new Intl.DateTimeFormat('it', { day: 'numeric', month: 'long', year: 'numeric', }).format(blockedUntilDate), })} {showGiverInfo && t('memoriBlockedUntil', { date: new Intl.DateTimeFormat('it', { day: 'numeric', month: 'long', year: 'numeric', }).format(blockedUntilDate), })} {showGiverInfo && ` ${t('memoriBlockedReasonExceedChats')}`} {showGiverInfo &&
} {showGiverInfo && `\n${t('memoriBlockedGiverHelper')}`} ) } >
{showTitle && ( {t('memoriBlockedTitle')} )}
) : null; }; export default BlockedMemoriBadge;