1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import type { ModalStateProps } from '@proton/components';
15 } from '@proton/components';
16 import humanSize from '@proton/shared/lib/helpers/humanSize';
18 import { useLinksDetailsView } from '../../store';
19 import ModalContentLoader from './ModalContentLoader';
22 selectedItems: { rootShareId: string; linkId: string }[];
26 const FilesDetailsModal = ({ selectedItems, onClose, ...modalProps }: Props & ModalStateProps) => {
27 const { isLoading, hasError, count, size } = useLinksDetailsView(selectedItems);
29 let title = c('Title').t`Item details`;
30 let labelCount = c('Title').t`Number of items`;
32 const renderModalState = () => {
34 return <ModalContentLoader>{c('Info').t`Loading links`}</ModalContentLoader>;
40 <Alert type="error">{c('Info').t`Cannot load links`}</Alert>
48 <Label style={{ cursor: 'default' }}>{labelCount}</Label>
49 <Field className="pt-2">
50 <b data-testid="number-of-items">{count}</b>
54 <Label style={{ cursor: 'default' }}>{c('Title').t`Total size`}</Label>
55 <Field className="pt-2">
56 <b>{humanSize({ bytes: size })}</b>
64 <ModalTwo onClose={onClose} size="large" {...modalProps}>
65 <ModalTwoHeader title={title} />
68 <Button onClick={onClose}>{c('Action').t`Close`}</Button>
74 export default FilesDetailsModal;
75 export const useFilesDetailsModal = () => {
76 return useModalTwoStatic(FilesDetailsModal);