Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / drive / src / app / components / sections / SharedLinks / SharedLinksView.tsx
blobce355ac36137ad90ec12bb6491e06c1f3de5b6bd
1 import { useEffect } from 'react';
3 import { c } from 'ttag';
5 import { useAppTitle } from '@proton/components';
7 import { useActiveShare } from '../../../hooks/drive/useActiveShare';
8 import { useSharedLinksView } from '../../../store';
9 import { FileBrowserStateProvider } from '../../FileBrowser';
10 import ToolbarRow from '../ToolbarRow/ToolbarRow';
11 import SharedLinks from './SharedLinks';
12 import SharedLinksToolbar from './SharedLinksToolbar';
14 const SharedLinksView = () => {
15     useAppTitle(c('Title').t`Shared`);
16     const { activeShareId, setDefaultRoot } = useActiveShare();
17     useEffect(setDefaultRoot, []);
19     const sharedLinksView = useSharedLinksView(activeShareId);
21     return (
22         <FileBrowserStateProvider itemIds={sharedLinksView.items.map(({ linkId }) => linkId)}>
23             <ToolbarRow
24                 titleArea={<span className="text-strong pl-1">{c('Info').t`My Links`}</span>}
25                 toolbar={<SharedLinksToolbar shareId={activeShareId} items={sharedLinksView.items} />}
26             />
27             <SharedLinks shareId={activeShareId} sharedLinksView={sharedLinksView} />
28         </FileBrowserStateProvider>
29     );
32 export default SharedLinksView;