Handle plural text in bulk move confirmation
[ProtonMail-WebClient.git] / packages / pass / components / Item / Actions / ConfirmMoveItem.tsx
blob866406b6c0b5417b64d2ce2ee0127e8570672e41
1 import { type FC } from 'react';
2 import { useSelector } from 'react-redux';
4 import { c } from 'ttag';
6 import {
7     ConfirmationPrompt,
8     type ConfirmationPromptHandles,
9 } from '@proton/pass/components/Confirmation/ConfirmationPrompt';
10 import { WithVault } from '@proton/pass/components/Vault/WithVault';
11 import { selectItemSecureLinks } from '@proton/pass/store/selectors';
12 import type { ItemRevision } from '@proton/pass/types';
14 type Props = ConfirmationPromptHandles & {
15     item: ItemRevision;
16     shareId: string;
19 export const ConfirmMoveItem: FC<Props> = ({ item, open, shareId, onCancel, onConfirm }) => {
20     const hasLinks = Boolean(useSelector(selectItemSecureLinks(item.shareId, item.itemId)).length);
22     return (
23         <WithVault shareId={shareId} onFallback={onCancel}>
24             {({ content: { name: vaultName } }) => (
25                 <ConfirmationPrompt
26                     open={open}
27                     onConfirm={onConfirm}
28                     onCancel={onCancel}
29                     title={c('Title').t`Move item to "${vaultName}"?`}
30                     message={
31                         hasLinks
32                             ? c('Info').t`Moving an item to another vault will erase its history and all secure links.`
33                             : c('Info').t`Moving an item to another vault will erase its history.`
34                     }
35                 />
36             )}
37         </WithVault>
38     );