Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move

Manav Rathi211d2ac4a9c7
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index f9e0e5c728..9bdbbd60eb 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -3,6 +3,7 @@ import log from "@/base/log";
import type { CollectionMapping, Electron, ZipItem } from "@/base/types/ipc";
import type { Collection } from "@/media/collection";
import { CollectionMappingChoiceDialog } from "@/new/photos/components/CollectionMappingChoiceDialog";
+import { CollectionSelectorIntent } from "@/new/photos/components/CollectionSelectionDialog";
import { exportMetadataDirectoryName } from "@/new/photos/services/export";
import type {
FileAndPath,
@@ -13,7 +14,6 @@ import { firstNonEmpty } from "@/utils/array";
import { ensure } from "@/utils/ensure";
import { CustomError } from "@ente/shared/error";
import DiscFullIcon from "@mui/icons-material/DiscFull";
-import { CollectionSelectorIntent } from "components/Collections/CollectionSelector";
import UserNameInputDialog from "components/UserNameInputDialog";
import { t } from "i18next";
import isElectron from "is-electron";
diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
index bae62e864f..3e919266c7 100644
--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
@@ -1,5 +1,6 @@
import { SelectionBar } from "@/base/components/Navbar";
import type { Collection } from "@/media/collection";
+import { CollectionSelectorIntent } from "@/new/photos/components/CollectionSelectionDialog";
import type { GalleryBarMode } from "@/new/photos/components/Gallery/BarImpl";
import { FluidContainer } from "@ente/shared/components/Container";
import ClockIcon from "@mui/icons-material/AccessTime";
@@ -15,7 +16,6 @@ import UnArchiveIcon from "@mui/icons-material/Unarchive";
import VisibilityOffOutlined from "@mui/icons-material/VisibilityOffOutlined";
import VisibilityOutlined from "@mui/icons-material/VisibilityOutlined";
import { Box, IconButton, Stack, Tooltip } from "@mui/material";
-import { CollectionSelectorIntent } from "components/Collections/CollectionSelector";
import { t } from "i18next";
import { AppContext } from "pages/_app";
import { useContext } from "react";
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 318bab8408..90ae18afb4 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -3,6 +3,10 @@ import { NavbarBase } from "@/base/components/Navbar";
import { useIsMobileWidth } from "@/base/hooks";
import log from "@/base/log";
import type { Collection } from "@/media/collection";
+import {
+ CollectionSelectionDialog,
+ CollectionSelectorAttributes,
+} from "@/new/photos/components/CollectionSelectionDialog";
import {
PeopleEmptyState,
SearchResultsHeader,
@@ -67,10 +71,6 @@ import AuthenticateUserModal from "components/AuthenticateUserModal";
import CollectionNamer, {
CollectionNamerAttributes,
} from "components/Collections/CollectionNamer";
-import {
- CollectionSelector,
- CollectionSelectorAttributes,
-} from "components/Collections/CollectionSelector";
import { GalleryBarAndListHeader } from "components/Collections/GalleryBarAndListHeader";
import ExportModal from "components/ExportModal";
import {
@@ -1172,7 +1172,7 @@ export default function Gallery() {
onHide={setCollectionNamerView.bind(null, false)}
attributes={collectionNamerAttributes}
/>
- <CollectionSelector
+ <CollectionSelectionDialog
open={collectionSelectorView}
onClose={closeCollectionSelector}
collectionSummaries={collectionSummaries}
diff --git a/web/apps/photos/src/types/gallery/index.ts b/web/apps/photos/src/types/gallery/index.ts
index 1db05da364..b9720b71aa 100644
--- a/web/apps/photos/src/types/gallery/index.ts
+++ b/web/apps/photos/src/types/gallery/index.ts
@@ -1,8 +1,8 @@
import type { Collection } from "@/media/collection";
+import { CollectionSelectorAttributes } from "@/new/photos/components/CollectionSelectionDialog";
import { type SelectionContext } from "@/new/photos/components/Gallery";
import { EnteFile } from "@/new/photos/types/file";
import type { User } from "@ente/shared/user/types";
-import { CollectionSelectorAttributes } from "components/Collections/CollectionSelector";
import { FilesDownloadProgressAttributes } from "components/FilesDownloadProgress";
import { TimeStampListItem } from "components/PhotoList";
diff --git a/web/apps/photos/src/components/Collections/CollectionSelector.tsx b/web/packages/new/photos/components/CollectionSelectionDialog.tsx
similarity index 96%
rename from web/apps/photos/src/components/Collections/CollectionSelector.tsx
rename to web/packages/new/photos/components/CollectionSelectionDialog.tsx
index 12109da32a..ae1c800f51 100644
--- a/web/apps/photos/src/components/Collections/CollectionSelector.tsx
+++ b/web/packages/new/photos/components/CollectionSelectionDialog.tsx
@@ -47,6 +47,10 @@ export interface CollectionSelectorAttributes {
interface CollectionSelectorProps {
open: boolean;
onClose: () => void;
+ /**
+ * The same {@link CollectionSelectionDialog} can be used for multiple purposes by
+ * providing attributes specific to each use case.
+ */
attributes: CollectionSelectorAttributes;
collectionSummaries: CollectionSummaries;
/**
@@ -63,7 +67,7 @@ interface CollectionSelectorProps {
* A dialog allowing the user to select one of their existing collections or
* create a new one.
*/
-export const CollectionSelector: React.FC<CollectionSelectorProps> = ({
+export const CollectionSelectionDialog: React.FC<CollectionSelectorProps> = ({
attributes,
collectionSummaries,
collectionForCollectionID,