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 { useDriveSharingFlags, useSharedWithMeView } from '../../../store';
9 import { Actions, traceTelemetry } from '../../../utils/telemetry';
10 import { FileBrowserStateProvider } from '../../FileBrowser';
11 import ToolbarRow from '../ToolbarRow/ToolbarRow';
12 import SharedWithMe from './SharedWithMe';
13 import SharedWithMeToolbar from './SharedWithMeToolbar';
15 const SharedWithMeView = () => {
16 useAppTitle(c('Title').t`Shared with me`);
17 const { activeShareId, setDefaultRoot } = useActiveShare();
21 traceTelemetry(Actions.SignUpFlowAndRedirectCompleted).end();
24 const sharedWithMeView = useSharedWithMeView(activeShareId);
25 const hasSharedItems = !!sharedWithMeView.items.length;
27 const { isSharingInviteAvailable } = useDriveSharingFlags();
28 if (!hasSharedItems && !isSharingInviteAvailable) {
32 // rootShareId is unique per item in shared with me section, so we can use it as id key
34 <FileBrowserStateProvider itemIds={sharedWithMeView.items.map(({ rootShareId }) => rootShareId)}>
36 titleArea={<span className="text-strong pl-1">{c('Info').t`Shared with me`}</span>}
37 toolbar={<SharedWithMeToolbar shareId={activeShareId} items={sharedWithMeView.items} />}
39 <SharedWithMe shareId={activeShareId} sharedWithMeView={sharedWithMeView} />
40 </FileBrowserStateProvider>
44 export default SharedWithMeView;