This commit is contained in:
Manav Rathi
2024-09-21 07:10:38 +05:30
parent a4fa8e0deb
commit 255302e3cd
2 changed files with 32 additions and 43 deletions

View File

@@ -1,42 +0,0 @@
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import { IconButton, Tooltip } from "@mui/material";
import { t } from "i18next";
import { CollectionSummaryType } from "types/collection";
import { CollectionActions } from "..";
interface Iprops {
handleCollectionAction: (
action: CollectionActions,
loader?: boolean,
) => (...args: any[]) => Promise<void>;
collectionSummaryType: CollectionSummaryType;
}
export function DownloadQuickOption({
handleCollectionAction,
collectionSummaryType,
}: Iprops) {
return (
<Tooltip
title={
collectionSummaryType === CollectionSummaryType.favorites
? t("DOWNLOAD_FAVORITES")
: collectionSummaryType ===
CollectionSummaryType.uncategorized
? t("DOWNLOAD_UNCATEGORIZED")
: collectionSummaryType ===
CollectionSummaryType.hiddenItems
? t("DOWNLOAD_HIDDEN_ITEMS")
: t("DOWNLOAD_COLLECTION")
}
>
<IconButton
onClick={handleCollectionAction(
CollectionActions.DOWNLOAD,
false,
)}
>
<FileDownloadOutlinedIcon />
</IconButton>
</Tooltip>
);
}

View File

@@ -1,12 +1,12 @@
import { FlexWrapper } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import PeopleIcon from "@mui/icons-material/People";
import { IconButton, Tooltip } from "@mui/material";
import { t } from "i18next";
import { CollectionSummaryType } from "types/collection";
import { CollectionActions } from "..";
import { DownloadQuickOption } from "./DownloadQuickOption";
interface QuickOptionsProps {
handleCollectionAction: (
@@ -90,6 +90,37 @@ const showDownloadQuickOption = (type: CollectionSummaryType) => {
);
};
interface DownloadQuickOptionProps {
handleCollectionAction: (
action: CollectionActions,
loader?: boolean,
) => (...args: any[]) => Promise<void>;
collectionSummaryType: CollectionSummaryType;
}
const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({
handleCollectionAction,
collectionSummaryType,
}) => (
<Tooltip
title={
collectionSummaryType === CollectionSummaryType.favorites
? t("DOWNLOAD_FAVORITES")
: collectionSummaryType === CollectionSummaryType.uncategorized
? t("DOWNLOAD_UNCATEGORIZED")
: collectionSummaryType === CollectionSummaryType.hiddenItems
? t("DOWNLOAD_HIDDEN_ITEMS")
: t("DOWNLOAD_COLLECTION")
}
>
<IconButton
onClick={handleCollectionAction(CollectionActions.DOWNLOAD, false)}
>
<FileDownloadOutlinedIcon />
</IconButton>
</Tooltip>
);
const showShareQuickOption = (type: CollectionSummaryType) => {
return (
type === CollectionSummaryType.folder ||