From 33bc19978c79627f5b4bf8128fbfc93ff97af956 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 21 Sep 2024 08:09:41 +0530 Subject: [PATCH] Inline --- .../SharedCollectionOption.tsx | 60 ------------------- .../Collections/CollectionOptions/index.tsx | 54 ++++++++++++++++- 2 files changed, 53 insertions(+), 61 deletions(-) delete mode 100644 web/apps/photos/src/components/Collections/CollectionOptions/SharedCollectionOption.tsx diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/SharedCollectionOption.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/SharedCollectionOption.tsx deleted file mode 100644 index 12c4efda8d..0000000000 --- a/web/apps/photos/src/components/Collections/CollectionOptions/SharedCollectionOption.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { OverflowMenuOption } from "@ente/shared/components/OverflowMenu/option"; -import ArchiveOutlined from "@mui/icons-material/ArchiveOutlined"; -import LogoutIcon from "@mui/icons-material/Logout"; -import TvIcon from "@mui/icons-material/Tv"; -import Unarchive from "@mui/icons-material/Unarchive"; -import { t } from "i18next"; -import { CollectionActions } from "."; - -interface Iprops { - isArchived: boolean; - handleCollectionAction: ( - action: CollectionActions, - loader?: boolean, - ) => (...args: any[]) => Promise; -} - -export function SharedCollectionOption({ - isArchived, - handleCollectionAction, -}: Iprops) { - return ( - <> - {isArchived ? ( - } - > - {t("UNARCHIVE_COLLECTION")} - - ) : ( - } - > - {t("ARCHIVE_COLLECTION")} - - )} - } - onClick={handleCollectionAction( - CollectionActions.CONFIRM_LEAVE_SHARED_ALBUM, - false, - )} - > - {t("LEAVE_ALBUM")} - - } - 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 3aab7d3732..2a9a7ccc31 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx @@ -6,10 +6,14 @@ import { FlexWrapper, HorizontalFlex } from "@ente/shared/components/Container"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; 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 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 TvIcon from "@mui/icons-material/Tv"; +import Unarchive from "@mui/icons-material/Unarchive"; import { Box, IconButton, Tooltip } from "@mui/material"; import { t } from "i18next"; import { AppContext } from "pages/_app"; @@ -34,7 +38,6 @@ import { isArchivedCollection, isPinnedCollection } from "utils/magicMetadata"; import { SetCollectionNamerAttributes } from "../CollectionNamer"; import { AlbumCollectionOption } from "./AlbumCollectionOption"; import CollectionSortOrderMenu from "./CollectionSortOrderMenu"; -import { SharedCollectionOption } from "./SharedCollectionOption"; interface CollectionOptionsProps { setCollectionNamerAttributes: SetCollectionNamerAttributes; @@ -617,3 +620,52 @@ const OnlyDownloadCollectionOption: React.FC< {downloadOptionText} ); + +interface SharedCollectionOptionProps { + isArchived: boolean; + handleCollectionAction: ( + action: CollectionActions, + loader?: boolean, + ) => (...args: any[]) => Promise; +} + +const SharedCollectionOption: React.FC = ({ + isArchived, + handleCollectionAction, +}) => ( + <> + {isArchived ? ( + } + > + {t("UNARCHIVE_COLLECTION")} + + ) : ( + } + > + {t("ARCHIVE_COLLECTION")} + + )} + } + onClick={handleCollectionAction( + CollectionActions.CONFIRM_LEAVE_SHARED_ALBUM, + false, + )} + > + {t("LEAVE_ALBUM")} + + } + onClick={handleCollectionAction( + CollectionActions.SHOW_ALBUM_CAST_DIALOG, + false, + )} + > + {t("CAST_ALBUM_TO_TV")} + + +);