1 import { format } from 'date-fns';
2 import { fromUnixTime } from 'date-fns';
3 import { c } from 'ttag';
5 import { Button } from '@proton/atoms';
6 import { Prompt, type PromptProps } from '@proton/components';
7 import getBoldFormattedText from '@proton/components/helpers/getBoldFormattedText';
8 import { BRAND_NAME } from '@proton/shared/lib/constants';
9 import { dateLocale } from '@proton/shared/lib/i18n';
10 import type { AuthDeviceOutput } from '@proton/shared/lib/keys/device';
12 interface Props extends Omit<PromptProps, 'title' | 'buttons' | 'children'> {
13 onConfirm: () => void;
14 pendingAuthDevice: AuthDeviceOutput;
17 const ConfirmRejectAuthDevice = ({ onClose, onConfirm, pendingAuthDevice, ...rest }: Props) => {
18 const name = pendingAuthDevice.Name;
19 const date = format(fromUnixTime(pendingAuthDevice.CreateTime), 'PPp', { locale: dateLocale });
22 title={c('Title').t`Reject device?`}
30 >{c('Action').t`Reject`}</Button>,
31 <Button onClick={onClose}>{c('Action').t`Cancel`}</Button>,
36 <p className="text-break">
37 {getBoldFormattedText(
39 .t`This will reject the device **${name}** that tried signing into your ${BRAND_NAME} account on **${date}**.`
46 export default ConfirmRejectAuthDevice;