From 1aa940d4108f058587f60a1f8a4b0533e5d9f1c2 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 21 Sep 2024 08:11:10 +0530 Subject: [PATCH] Inline --- .../AlbumCollectionOption.tsx | 147 ------------------ .../Collections/CollectionOptions/index.tsx | 128 ++++++++++++++- 2 files changed, 127 insertions(+), 148 deletions(-) delete mode 100644 web/apps/photos/src/components/Collections/CollectionOptions/AlbumCollectionOption.tsx diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCollectionOption.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCollectionOption.tsx deleted file mode 100644 index a3ce073ed3..0000000000 --- a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCollectionOption.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { OverflowMenuOption } from "@ente/shared/components/OverflowMenu/option"; - -import ArchiveOutlined from "@mui/icons-material/ArchiveOutlined"; -import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined"; -import EditIcon from "@mui/icons-material/Edit"; -import PeopleIcon from "@mui/icons-material/People"; -import PushPinOutlined from "@mui/icons-material/PushPinOutlined"; -import SortIcon from "@mui/icons-material/Sort"; -import TvIcon from "@mui/icons-material/Tv"; -import Unarchive from "@mui/icons-material/Unarchive"; -import VisibilityOffOutlined from "@mui/icons-material/VisibilityOffOutlined"; -import VisibilityOutlined from "@mui/icons-material/VisibilityOutlined"; -import { UnPinIcon } from "components/icons/UnPinIcon"; -import { t } from "i18next"; -import { CollectionActions } from "."; - -interface Iprops { - isArchived: boolean; - isPinned: boolean; - isHidden: boolean; - handleCollectionAction: ( - action: CollectionActions, - loader?: boolean, - ) => (...args: any[]) => Promise; -} - -export function AlbumCollectionOption({ - isArchived, - isPinned, - isHidden, - handleCollectionAction, -}: Iprops) { - return ( - <> - } - > - {t("RENAME_COLLECTION")} - - } - > - {t("SORT_BY")} - - {isPinned ? ( - } - > - {t("UNPIN_ALBUM")} - - ) : ( - } - > - {t("PIN_ALBUM")} - - )} - {!isHidden && ( - <> - {isArchived ? ( - } - > - {t("UNARCHIVE_COLLECTION")} - - ) : ( - } - > - {t("ARCHIVE_COLLECTION")} - - )} - - )} - {isHidden ? ( - } - > - {t("UNHIDE_COLLECTION")} - - ) : ( - } - > - {t("HIDE_COLLECTION")} - - )} - } - onClick={handleCollectionAction( - CollectionActions.CONFIRM_DELETE, - false, - )} - > - {t("DELETE_COLLECTION")} - - } - > - {t("SHARE_COLLECTION")} - - } - onClick={handleCollectionAction( - CollectionActions.SHOW_ALBUM_CAST_DIALOG, - false, - )} - > - {t("CAST_ALBUM_TO_TV")} - - - ); -} diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx index 2a9a7ccc31..0f4b5ca97b 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx @@ -8,13 +8,19 @@ import OverflowMenu from "@ente/shared/components/OverflowMenu/menu"; import { OverflowMenuOption } from "@ente/shared/components/OverflowMenu/option"; import ArchiveOutlined from "@mui/icons-material/ArchiveOutlined"; import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined"; +import EditIcon from "@mui/icons-material/Edit"; import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined"; import LogoutIcon from "@mui/icons-material/Logout"; import MoreHoriz from "@mui/icons-material/MoreHoriz"; import PeopleIcon from "@mui/icons-material/People"; +import PushPinOutlined from "@mui/icons-material/PushPinOutlined"; +import SortIcon from "@mui/icons-material/Sort"; import TvIcon from "@mui/icons-material/Tv"; import Unarchive from "@mui/icons-material/Unarchive"; +import VisibilityOffOutlined from "@mui/icons-material/VisibilityOffOutlined"; +import VisibilityOutlined from "@mui/icons-material/VisibilityOutlined"; import { Box, IconButton, Tooltip } from "@mui/material"; +import { UnPinIcon } from "components/icons/UnPinIcon"; import { t } from "i18next"; import { AppContext } from "pages/_app"; import { GalleryContext } from "pages/gallery"; @@ -36,7 +42,6 @@ import { } from "utils/collection"; import { isArchivedCollection, isPinnedCollection } from "utils/magicMetadata"; import { SetCollectionNamerAttributes } from "../CollectionNamer"; -import { AlbumCollectionOption } from "./AlbumCollectionOption"; import CollectionSortOrderMenu from "./CollectionSortOrderMenu"; interface CollectionOptionsProps { @@ -669,3 +674,124 @@ const SharedCollectionOption: React.FC = ({ ); + +interface AlbumCollectionOptionsProps { + isArchived: boolean; + isPinned: boolean; + isHidden: boolean; + handleCollectionAction: ( + action: CollectionActions, + loader?: boolean, + ) => (...args: any[]) => Promise; +} + +const AlbumCollectionOption: React.FC = ({ + isArchived, + isPinned, + isHidden, + handleCollectionAction, +}) => ( + <> + } + > + {t("RENAME_COLLECTION")} + + } + > + {t("SORT_BY")} + + {isPinned ? ( + } + > + {t("UNPIN_ALBUM")} + + ) : ( + } + > + {t("PIN_ALBUM")} + + )} + {!isHidden && ( + <> + {isArchived ? ( + } + > + {t("UNARCHIVE_COLLECTION")} + + ) : ( + } + > + {t("ARCHIVE_COLLECTION")} + + )} + + )} + {isHidden ? ( + } + > + {t("UNHIDE_COLLECTION")} + + ) : ( + } + > + {t("HIDE_COLLECTION")} + + )} + } + onClick={handleCollectionAction( + CollectionActions.CONFIRM_DELETE, + false, + )} + > + {t("DELETE_COLLECTION")} + + } + > + {t("SHARE_COLLECTION")} + + } + onClick={handleCollectionAction( + CollectionActions.SHOW_ALBUM_CAST_DIALOG, + false, + )} + > + {t("CAST_ALBUM_TO_TV")} + + +);