From a4a2623074f8a9f8fd804a61cf345e7a614da470 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 11 Sep 2024 17:17:06 +0530 Subject: [PATCH] Move --- .../Collections/CollectionInfoWithOptions.tsx | 8 ++++-- .../CollectionListBar/CollectionCard.tsx | 3 +-- .../QuickOptions/DownloadQuickOption.tsx | 2 +- .../QuickOptions/ShareQuickOption.tsx | 2 +- .../CollectionOptions/QuickOptions/index.tsx | 2 +- .../Collections/CollectionOptions/index.tsx | 3 +-- .../Collections/CollectionSelector/index.tsx | 2 +- .../Collections/CollectionShare/index.tsx | 7 +++-- .../CollectionShare/sharingDetails.tsx | 3 +-- web/apps/photos/src/pages/gallery.tsx | 7 +++-- .../photos/src/services/collectionService.ts | 4 +-- web/apps/photos/src/types/collection/index.ts | 26 ++++++++++++++++++- web/apps/photos/src/utils/collection.ts | 24 ----------------- 13 files changed, 50 insertions(+), 43 deletions(-) diff --git a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx index e960ab87fe..5ddc03b26c 100644 --- a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx +++ b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx @@ -6,9 +6,13 @@ import PeopleIcon from "@mui/icons-material/People"; import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer"; import CollectionOptions from "components/Collections/CollectionOptions"; import type { Dispatch, SetStateAction } from "react"; -import { Collection, CollectionSummary } from "types/collection"; +import { + Collection, + CollectionSummary, + CollectionSummaryType, +} from "types/collection"; import { SetFilesDownloadProgressAttributesCreator } from "types/gallery"; -import { CollectionSummaryType, shouldShowOptions } from "utils/collection"; +import { shouldShowOptions } from "utils/collection"; import { CollectionInfo } from "./CollectionInfo"; import { CollectionInfoBarWrapper } from "./styledComponents"; diff --git a/web/apps/photos/src/components/Collections/CollectionListBar/CollectionCard.tsx b/web/apps/photos/src/components/Collections/CollectionListBar/CollectionCard.tsx index 50b4378929..efbf3510fd 100644 --- a/web/apps/photos/src/components/Collections/CollectionListBar/CollectionCard.tsx +++ b/web/apps/photos/src/components/Collections/CollectionListBar/CollectionCard.tsx @@ -5,8 +5,7 @@ import PeopleIcon from "@mui/icons-material/People"; import PushPin from "@mui/icons-material/PushPin"; import { Box, Typography, styled } from "@mui/material"; import Tooltip from "@mui/material/Tooltip"; -import { CollectionSummary } from "types/collection"; -import { CollectionSummaryType } from "utils/collection"; +import { CollectionSummary, CollectionSummaryType } from "types/collection"; import CollectionCard from "../CollectionCard"; import { ActiveIndicator, diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/DownloadQuickOption.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/DownloadQuickOption.tsx index 06b7fcfe0d..7b26342ac8 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/DownloadQuickOption.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/DownloadQuickOption.tsx @@ -1,7 +1,7 @@ import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined"; import { IconButton, Tooltip } from "@mui/material"; import { t } from "i18next"; -import { CollectionSummaryType } from "utils/collection"; +import { CollectionSummaryType } from "types/collection"; import { CollectionActions } from ".."; interface Iprops { handleCollectionAction: ( diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/ShareQuickOption.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/ShareQuickOption.tsx index 9532f94df6..4d9565c32a 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/ShareQuickOption.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/ShareQuickOption.tsx @@ -1,7 +1,7 @@ import PeopleIcon from "@mui/icons-material/People"; import { IconButton, Tooltip } from "@mui/material"; import { t } from "i18next"; -import { CollectionSummaryType } from "utils/collection"; +import { CollectionSummaryType } from "types/collection"; import { CollectionActions } from ".."; interface Iprops { diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx index 1087c83ab5..eac6046631 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx @@ -1,7 +1,7 @@ import { FlexWrapper } from "@ente/shared/components/Container"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; +import { CollectionSummaryType } from "types/collection"; import { - CollectionSummaryType, showDownloadQuickOption, showEmptyTrashQuickOption, showShareQuickOption, diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx index 65b3a0f3cf..f43bed216d 100644 --- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx @@ -12,14 +12,13 @@ import { useContext, useRef, useState } from "react"; import { Trans } from "react-i18next"; import * as CollectionAPI from "services/collectionService"; import * as TrashService from "services/trashService"; -import { Collection } from "types/collection"; +import { Collection, CollectionSummaryType } from "types/collection"; import { SetFilesDownloadProgressAttributesCreator } from "types/gallery"; import { ALL_SECTION, changeCollectionOrder, changeCollectionSortOrder, changeCollectionVisibility, - CollectionSummaryType, downloadCollectionHelper, downloadDefaultHiddenCollectionHelper, HIDDEN_ITEMS_SECTION, diff --git a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx index fd9a8525bd..cdbc901b2e 100644 --- a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx @@ -9,11 +9,11 @@ import { Collection, CollectionSummaries, CollectionSummary, + CollectionSummaryType, } from "types/collection"; import { CollectionSelectorIntent } from "types/gallery"; import { COLLECTION_SORT_ORDER, - CollectionSummaryType, DUMMY_UNCATEGORIZED_COLLECTION, isAddToAllowedCollection, isMoveToAllowedCollection, diff --git a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/index.tsx index 1cc063b6d0..e9a709566a 100644 --- a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionShare/index.tsx @@ -2,8 +2,11 @@ import { EnteDrawer } from "@/base/components/EnteDrawer"; import { Titlebar } from "@/base/components/Titlebar"; import { DialogProps, Stack } from "@mui/material"; import { t } from "i18next"; -import { Collection, CollectionSummary } from "types/collection"; -import { CollectionSummaryType } from "utils/collection"; +import { + Collection, + CollectionSummary, + CollectionSummaryType, +} from "types/collection"; import EmailShare from "./emailShare"; import PublicShare from "./publicShare"; import SharingDetails from "./sharingDetails"; diff --git a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx index 889dc4084f..c314a5aa05 100644 --- a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx +++ b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx @@ -12,8 +12,7 @@ import Avatar from "components/pages/gallery/Avatar"; import { t } from "i18next"; import { GalleryContext } from "pages/gallery"; import { useContext } from "react"; -import { COLLECTION_ROLE } from "types/collection"; -import { CollectionSummaryType } from "utils/collection"; +import { COLLECTION_ROLE, CollectionSummaryType } from "types/collection"; export default function SharingDetails({ collection, type }) { const galleryContext = useContext(GalleryContext); diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx index e882ea4196..7f40003f76 100644 --- a/web/apps/photos/src/pages/gallery.tsx +++ b/web/apps/photos/src/pages/gallery.tsx @@ -105,7 +105,11 @@ import { sync, triggerPreFileInfoSync } from "services/sync"; import { syncTrash } from "services/trashService"; import uploadManager from "services/upload/uploadManager"; import { isTokenValid } from "services/userService"; -import { Collection, CollectionSummaries } from "types/collection"; +import { + Collection, + CollectionSummaries, + CollectionSummaryType, +} from "types/collection"; import { GalleryContextType, SelectedState, @@ -118,7 +122,6 @@ import { ALL_SECTION, ARCHIVE_SECTION, COLLECTION_OPS_TYPE, - CollectionSummaryType, HIDDEN_ITEMS_SECTION, TRASH_SECTION, constructCollectionNameMap, diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts index 669d6cea15..db5ce4bec5 100644 --- a/web/apps/photos/src/services/collectionService.ts +++ b/web/apps/photos/src/services/collectionService.ts @@ -28,7 +28,9 @@ import { CollectionShareeMagicMetadata, CollectionSummaries, CollectionSummary, + CollectionSummaryType, CollectionToFileMap, + CollectionType, CreatePublicAccessTokenRequest, EncryptedCollection, EncryptedFileKey, @@ -43,8 +45,6 @@ import { ARCHIVE_SECTION, COLLECTION_LIST_SORT_BY, COLLECTION_SORT_ORDER, - CollectionSummaryType, - CollectionType, DUMMY_UNCATEGORIZED_COLLECTION, HIDDEN_ITEMS_SECTION, TRASH_SECTION, diff --git a/web/apps/photos/src/types/collection/index.ts b/web/apps/photos/src/types/collection/index.ts index 5a2fcef3cc..0258b34a71 100644 --- a/web/apps/photos/src/types/collection/index.ts +++ b/web/apps/photos/src/types/collection/index.ts @@ -5,7 +5,31 @@ import { MagicMetadataCore, SUB_TYPE, } from "@/new/photos/types/magicMetadata"; -import { CollectionSummaryType, CollectionType } from "utils/collection"; + +export enum CollectionType { + folder = "folder", + favorites = "favorites", + album = "album", + uncategorized = "uncategorized", +} + +export enum CollectionSummaryType { + folder = "folder", + favorites = "favorites", + album = "album", + archive = "archive", + trash = "trash", + uncategorized = "uncategorized", + all = "all", + outgoingShare = "outgoingShare", + incomingShareViewer = "incomingShareViewer", + incomingShareCollaborator = "incomingShareCollaborator", + sharedOnlyViaLink = "sharedOnlyViaLink", + archived = "archived", + defaultHidden = "defaultHidden", + hiddenItems = "hiddenItems", + pinned = "pinned", +} export enum COLLECTION_ROLE { VIEWER = "VIEWER", diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts index 32f2ff424e..3d1a1398ce 100644 --- a/web/apps/photos/src/utils/collection.ts +++ b/web/apps/photos/src/utils/collection.ts @@ -42,30 +42,6 @@ export const DUMMY_UNCATEGORIZED_COLLECTION = -3; export const HIDDEN_ITEMS_SECTION = -4; export const ALL_SECTION = 0; -export enum CollectionType { - folder = "folder", - favorites = "favorites", - album = "album", - uncategorized = "uncategorized", -} - -export enum CollectionSummaryType { - folder = "folder", - favorites = "favorites", - album = "album", - archive = "archive", - trash = "trash", - uncategorized = "uncategorized", - all = "all", - outgoingShare = "outgoingShare", - incomingShareViewer = "incomingShareViewer", - incomingShareCollaborator = "incomingShareCollaborator", - sharedOnlyViaLink = "sharedOnlyViaLink", - archived = "archived", - defaultHidden = "defaultHidden", - hiddenItems = "hiddenItems", - pinned = "pinned", -} export enum COLLECTION_LIST_SORT_BY { NAME, CREATION_TIME_ASCENDING,