Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / applications / drive / src / app / components / SharedPage / Layout / SharedPageFooter.tsx
blobc0dccfb11f2abb6234266b530c964683a44b4439
1 import { useActiveBreakpoint } from '@proton/components';
2 import clsx from '@proton/utils/clsx';
4 import type { useBookmarksPublicView } from '../../../store';
5 import { useDownload, useDownloadScanFlag } from '../../../store';
6 import { SaveToDriveButton } from '../Bookmarks/SaveToDriveButton';
7 import type { DownloadButtonProps } from './DownloadButton';
8 import { DownloadButton } from './DownloadButton';
9 import ReportAbuseButton from './ReportAbuseButton';
11 interface Props extends DownloadButtonProps {
12     bookmarksPublicView: ReturnType<typeof useBookmarksPublicView>;
13     partialView?: boolean;
14     hideSaveToDrive?: boolean;
16 const SharedPageFooter = ({ rootItem, items, bookmarksPublicView, hideSaveToDrive, partialView }: Props) => {
17     const { viewportWidth } = useActiveBreakpoint();
18     const { hasDownloads } = useDownload();
19     const isDownloadScanEnabled = useDownloadScanFlag();
20     const { isLoading, addBookmark, isAlreadyBookmarked, customPassword } = bookmarksPublicView;
22     if (viewportWidth['<=small']) {
23         return (
24             <div
25                 className={clsx(
26                     !hideSaveToDrive &&
27                         !partialView &&
28                         'fixed bottom-0 p-4 flex flex-wrap justify-center bg-weak w-full gap-4'
29                 )}
30             >
31                 {/* // Hide download button if transfer modal is present */}
32                 {!!items.length && !hasDownloads && (
33                     <DownloadButton
34                         rootItem={rootItem}
35                         items={items}
36                         isScanAndDownload={isDownloadScanEnabled}
37                         color="weak"
38                     />
39                 )}
40                 {!hideSaveToDrive && !partialView && (
41                     <SaveToDriveButton
42                         loading={isLoading}
43                         onClick={addBookmark}
44                         alreadyBookmarked={isAlreadyBookmarked}
45                         customPassword={customPassword}
46                     />
47                 )}
48             </div>
49         );
50     }
51     return <ReportAbuseButton className="ml-1 mb-4 fixed left-0 bottom-0" linkInfo={rootItem} />;
54 export default SharedPageFooter;