Skip to content

armgit / ente

Public Imported from GitHub
0

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

refractor(web):move-photos-specfic-component-from-pkgs-p3

Aswin Asokfdd7066aaea9
diff --git a/web/packages/new/photos/components/CollectionSelector.tsx b/web/apps/photos/src/components/CollectionSelector.tsx
similarity index 99%
rename from web/packages/new/photos/components/CollectionSelector.tsx
rename to web/apps/photos/src/components/CollectionSelector.tsx
index 4cf9b84f33..3d1ea9ca28 100644
--- a/web/packages/new/photos/components/CollectionSelector.tsx
+++ b/web/apps/photos/src/components/CollectionSelector.tsx
@@ -1,3 +1,4 @@
+import { CollectionsSortOptions } from "@/components/CollectionsSortOptions";
import AddIcon from "@mui/icons-material/Add";
import CloseIcon from "@mui/icons-material/Close";
import FavoriteIcon from "@mui/icons-material/Favorite";
@@ -18,7 +19,6 @@ import {
} from "@mui/material";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import type { Collection } from "ente-media/collection";
-import { CollectionsSortOptions } from "ente-new/photos/components/CollectionsSortOptions";
import { BaseTileButton, ItemCard } from "ente-new/photos/components/Tiles";
import {
canAddToCollection,
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index f69a01886b..ade23426ac 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -1,4 +1,6 @@
// TODO: Audit this file.
+import { CollectionsSortOptions } from "@/components/CollectionsSortOptions";
+import { StarIcon } from "@/components/icons/StarIcon";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import CloseIcon from "@mui/icons-material/Close";
import PushPinIcon from "@mui/icons-material/PushPin";
@@ -22,8 +24,6 @@ import {
import { FilledIconButton } from "ente-base/components/mui";
import { SingleInputDialog } from "ente-base/components/SingleInputDialog";
import { useModalVisibility } from "ente-base/components/utils/modal";
-import { CollectionsSortOptions } from "ente-new/photos/components/CollectionsSortOptions";
-import { StarIcon } from "ente-new/photos/components/icons/StarIcon";
import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";
import {
ItemCard,
diff --git a/web/apps/photos/src/components/Collections/AllPeople.tsx b/web/apps/photos/src/components/Collections/AllPeople.tsx
index f2dd136009..25b323bf8c 100644
--- a/web/apps/photos/src/components/Collections/AllPeople.tsx
+++ b/web/apps/photos/src/components/Collections/AllPeople.tsx
@@ -1,3 +1,6 @@
+import { sortPeople, type PeopleSortBy } from "@/components/people-sort";
+import { PeopleSortOptions } from "@/components/PeopleSortOptions";
+import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import {
ArrowDownDoubleIcon,
ArrowUpDoubleIcon,
@@ -35,18 +38,12 @@ import {
import { SingleInputDialog } from "ente-base/components/SingleInputDialog";
import { useBaseContext } from "ente-base/context";
import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";
-import {
- sortPeople,
- type PeopleSortBy,
-} from "ente-new/photos/components/people-sort";
-import { PeopleSortOptions } from "ente-new/photos/components/PeopleSortOptions";
import {
ItemCard,
LargeTileButton,
LargeTileCreateNewButton,
LargeTileTextOverlay,
} from "ente-new/photos/components/Tiles";
-import { useWrapAsyncOperation } from "ente-new/photos/components/utils/use-wrap-async";
import {
addCGroup,
addClusterToCGroup,
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index a066444fda..8b6deee100 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -1,3 +1,5 @@
+import type { RemotePullOpts } from "@/components/gallery";
+import { StarIcon } from "@/components/icons/StarIcon";
import { downloadAndSaveCollectionFiles } from "@/services/save";
import {
CleanIcon,
@@ -42,12 +44,10 @@ import {
} from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
import { ItemVisibility } from "ente-media/file-metadata";
-import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import {
GalleryItemsHeaderAdapter,
GalleryItemsSummary,
} from "ente-new/photos/components/gallery/ListHeader";
-import { StarIcon } from "ente-new/photos/components/icons/StarIcon";
import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
cleanUncategorized,
diff --git a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
index 5fd5bd5026..d3b0782d6a 100644
--- a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
@@ -1,3 +1,4 @@
+import type { RemotePullOpts } from "@/components/gallery";
import type { SelectedState } from "@/utils/file";
import AddIcon from "@mui/icons-material/Add";
import CloseIcon from "@mui/icons-material/Close";
@@ -29,7 +30,6 @@ import {
ItemVisibility,
metadataHash,
} from "ente-media/file-metadata";
-import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import {
addToFavoritesCollection,
removeFromFavoritesCollection,
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 45616c0f82..68303d6f12 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -1,6 +1,7 @@
// TODO: Audit this file
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import Avatar from "@/components/Avatar";
+import type { RemotePullOpts } from "@/components/gallery";
import { PublicLinkCreated } from "@/components/share/PublicLinkCreated";
import { avatarTextColor } from "@/services/avatar";
import AddIcon from "@mui/icons-material/Add";
@@ -60,7 +61,6 @@ import type {
PublicURL,
} from "ente-media/collection";
import { CollectionSubType, type CollectionUser } from "ente-media/collection";
-import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
createPublicURL,
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index aad6cc3d9e..6509c96bec 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -7,6 +7,12 @@ import {
type CollectionShareProps,
} from "@/components/Collections/CollectionShare";
import type { FileListHeaderOrFooter } from "@/components/FileList";
+import {
+ GalleryBarImpl,
+ type GalleryBarImplProps,
+} from "@/components/gallery/BarImpl";
+import { PeopleHeader } from "@/components/gallery/PeopleHeader";
+import { sortPeople, type PeopleSortBy } from "@/components/people-sort";
import { useModalVisibility } from "ente-base/components/utils/modal";
import {
isSaveCancelled,
@@ -14,19 +20,10 @@ import {
type SaveGroup,
} from "ente-gallery/components/utils/save-groups";
import type { Collection } from "ente-media/collection";
-import {
- GalleryBarImpl,
- type GalleryBarImplProps,
-} from "ente-new/photos/components/gallery/BarImpl";
import {
GalleryItemsHeaderAdapter,
GalleryItemsSummary,
} from "ente-new/photos/components/gallery/ListHeader";
-import { PeopleHeader } from "ente-new/photos/components/gallery/PeopleHeader";
-import {
- sortPeople,
- type PeopleSortBy,
-} from "ente-new/photos/components/people-sort";
import {
collectionsSortBy,
haveOnlySystemCollections,
diff --git a/web/packages/new/photos/components/CollectionsSortOptions.tsx b/web/apps/photos/src/components/CollectionsSortOptions.tsx
similarity index 100%
rename from web/packages/new/photos/components/CollectionsSortOptions.tsx
rename to web/apps/photos/src/components/CollectionsSortOptions.tsx
diff --git a/web/packages/new/photos/components/FileContextMenu.tsx b/web/apps/photos/src/components/FileContextMenu.tsx
similarity index 97%
rename from web/packages/new/photos/components/FileContextMenu.tsx
rename to web/apps/photos/src/components/FileContextMenu.tsx
index f46ecae0d8..70a5660f1e 100644
--- a/web/packages/new/photos/components/FileContextMenu.tsx
+++ b/web/apps/photos/src/components/FileContextMenu.tsx
@@ -1,3 +1,5 @@
+import { StarBorderIcon } from "@/components/icons/StarIcon";
+import type { FileContextAction } from "@/utils/file-actions";
import {
AddSquareIcon,
ArrowRight02Icon,
@@ -23,8 +25,6 @@ import {
MenuItem,
styled,
} from "@mui/material";
-import { StarBorderIcon } from "ente-new/photos/components/icons/StarIcon";
-import type { FileContextAction } from "ente-new/photos/utils/file-actions";
import { t } from "i18next";
import React, { memo, useCallback, useMemo } from "react";
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 8e560fd04d..b38768d044 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -1,5 +1,15 @@
import Avatar from "@/components/Avatar";
+import {
+ FileContextMenu,
+ type ContextMenuPosition,
+} from "@/components/FileContextMenu";
+import type { GalleryBarMode } from "@/components/gallery/reducer";
+import { StarIcon } from "@/components/icons/StarIcon";
import type { SelectedState } from "@/utils/file";
+import {
+ getAvailableFileActions,
+ type FileContextAction,
+} from "@/utils/file-actions";
import {
handleSelectCreator,
handleSelectCreatorMulti,
@@ -18,12 +28,6 @@ import { downloadManager } from "ente-gallery/services/download";
import type { EnteFile } from "ente-media/file";
import { fileDurationString } from "ente-media/file-metadata";
import { FileType } from "ente-media/file-type";
-import {
- FileContextMenu,
- type ContextMenuPosition,
-} from "ente-new/photos/components/FileContextMenu";
-import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
-import { StarIcon } from "ente-new/photos/components/icons/StarIcon";
import {
LoadingThumbnail,
StaticThumbnail,
@@ -38,10 +42,6 @@ import {
PseudoCollectionID,
type CollectionSummary,
} from "ente-new/photos/services/collection-summary";
-import {
- getAvailableFileActions,
- type FileContextAction,
-} from "ente-new/photos/utils/file-actions";
import { batch } from "ente-utils/array";
import { t } from "i18next";
import React, {
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index b0e676c708..45f21cb0cc 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -1,4 +1,5 @@
import { CollectionMapDialog } from "@/components/Collections/CollectionMapDialog";
+import type { RemotePullOpts } from "@/components/gallery";
import { downloadAndSaveFiles } from "@/services/save";
import { uploadManager } from "@/services/upload-manager";
import { IconButton, Tooltip, styled } from "@mui/material";
@@ -16,7 +17,6 @@ import {
import type { Collection } from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
import { fileCreationPhotoDate, fileFileName } from "ente-media/file-metadata";
-import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import { moveToTrash } from "ente-new/photos/services/collection";
import type { CollectionSummary } from "ente-new/photos/services/collection-summary";
diff --git a/web/packages/new/photos/components/PeopleSortOptions.tsx b/web/apps/photos/src/components/PeopleSortOptions.tsx
similarity index 99%
rename from web/packages/new/photos/components/PeopleSortOptions.tsx
rename to web/apps/photos/src/components/PeopleSortOptions.tsx
index 37fc8742a5..a606d415a7 100644
--- a/web/packages/new/photos/components/PeopleSortOptions.tsx
+++ b/web/apps/photos/src/components/PeopleSortOptions.tsx
@@ -1,3 +1,4 @@
+import type { PeopleSortBy } from "@/components/people-sort";
import { ArrowDown02Icon, ArrowUp02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import SortIcon from "@mui/icons-material/Sort";
@@ -11,7 +12,6 @@ import {
type PaperProps,
} from "@mui/material";
import Menu, { type MenuProps } from "@mui/material/Menu";
-import type { PeopleSortBy } from "ente-new/photos/components/people-sort";
import { t } from "i18next";
import React, { useRef, useState } from "react";
diff --git a/web/apps/photos/src/components/PlanSelector.tsx b/web/apps/photos/src/components/PlanSelector.tsx
index 1c5429651a..db787b5206 100644
--- a/web/apps/photos/src/components/PlanSelector.tsx
+++ b/web/apps/photos/src/components/PlanSelector.tsx
@@ -1,3 +1,4 @@
+import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import CloseIcon from "@mui/icons-material/Close";
@@ -30,7 +31,6 @@ import { useBaseContext } from "ente-base/context";
import log from "ente-base/log";
import { bytesInGB, formattedStorageByteSize } from "ente-gallery/utils/units";
import { useUserDetailsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
-import { useWrapAsyncOperation } from "ente-new/photos/components/utils/use-wrap-async";
import type {
Bonus,
Plan,
diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
similarity index 98%
rename from web/packages/new/photos/components/SearchBar.tsx
rename to web/apps/photos/src/components/SearchBar.tsx
index a3eafbf8da..e9f007e50c 100644
--- a/web/packages/new/photos/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -1,3 +1,4 @@
+import { sidebarSearchOptionsForString } from "@/services/search/sidebar-search-registry";
import { Search01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import CalendarIcon from "@mui/icons-material/CalendarMonth";
@@ -23,7 +24,14 @@ import {
hlsGenerationStatusSnapshot,
isHLSGenerationSupported,
} from "ente-gallery/services/video";
+import { SearchPeopleList } from "ente-new/photos/components/PeopleList";
import { ItemCard, PreviewItemTile } from "ente-new/photos/components/Tiles";
+import { UnstyledButton } from "ente-new/photos/components/UnstyledButton";
+import {
+ useHLSGenerationStatusSnapshot,
+ useMLStatusSnapshot,
+ usePeopleStateSnapshot,
+} from "ente-new/photos/components/utils/use-snapshot";
import {
isMLSupported,
mlStatusSnapshot,
@@ -45,14 +53,6 @@ import {
type StylesConfig,
} from "react-select";
import AsyncSelect from "react-select/async";
-import { sidebarSearchOptionsForString } from "../services/search/sidebar-search-registry";
-import { SearchPeopleList } from "./PeopleList";
-import { UnstyledButton } from "./UnstyledButton";
-import {
- useHLSGenerationStatusSnapshot,
- useMLStatusSnapshot,
- usePeopleStateSnapshot,
-} from "./utils/use-snapshot";
export interface SearchBarProps {
/**
diff --git a/web/packages/new/photos/components/SelectedFileOptions.tsx b/web/apps/photos/src/components/SelectedFileOptions.tsx
similarity index 98%
rename from web/packages/new/photos/components/SelectedFileOptions.tsx
rename to web/apps/photos/src/components/SelectedFileOptions.tsx
index 389aa551e5..ca219a9819 100644
--- a/web/packages/new/photos/components/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/SelectedFileOptions.tsx
@@ -1,3 +1,11 @@
+import type { CollectionSelectorAttributes } from "@/components/CollectionSelector";
+import type { GalleryBarMode } from "@/components/gallery/reducer";
+import { StarBorderIcon } from "@/components/icons/StarIcon";
+import { StarOffIcon } from "@/components/icons/StarOffIcon";
+import {
+ getAvailableFileActions,
+ type FileContextAction,
+} from "@/utils/file-actions";
import {
AddSquareIcon,
ArrowRight02Icon,
@@ -23,15 +31,7 @@ import { SpacedRow } from "ente-base/components/containers";
import type { ButtonishProps } from "ente-base/components/mui";
import { useBaseContext } from "ente-base/context";
import type { Collection } from "ente-media/collection";
-import type { CollectionSelectorAttributes } from "ente-new/photos/components/CollectionSelector";
-import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
-import { StarBorderIcon } from "ente-new/photos/components/icons/StarIcon";
-import { StarOffIcon } from "ente-new/photos/components/icons/StarOffIcon";
import type { CollectionSummary } from "ente-new/photos/services/collection-summary";
-import {
- getAvailableFileActions,
- type FileContextAction,
-} from "ente-new/photos/utils/file-actions";
import { t } from "i18next";
/**
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index a14b5b0b09..ee34a64d19 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -3,11 +3,13 @@ import { DropdownInput } from "@/components/DropdownInput";
import { WatchFolder } from "@/components/WatchFolder";
import { ShapeIcon } from "@/components/icons/ShapeIcon";
import { AppLockSettings } from "@/components/sidebar/AppLockSettings";
+import { MLSettings } from "@/components/sidebar/MLSettings";
import { ReferralSettings } from "@/components/sidebar/ReferralSettings";
import { SessionsSettings } from "@/components/sidebar/SessionsSettings";
import { TwoFactorSettings } from "@/components/sidebar/TwoFactorSettings";
import { downloadAppDialogAttributes } from "@/components/utils/download";
import exportService from "@/services/export";
+import { performSidebarAction as performSidebarRegistryAction } from "@/services/search/sidebar-search-registry";
import {
Delete02Icon,
Download05Icon,
@@ -78,7 +80,6 @@ import {
isHLSGenerationSupported,
toggleHLSGeneration,
} from "ente-gallery/services/video";
-import { MLSettings } from "ente-new/photos/components/sidebar/MLSettings";
import {
useAppLockSnapshot,
useHLSGenerationStatusSnapshot,
@@ -95,7 +96,6 @@ import {
type CollectionSummaries,
} from "ente-new/photos/services/collection-summary";
import { isMLSupported } from "ente-new/photos/services/ml";
-import { performSidebarAction as performSidebarRegistryAction } from "ente-new/photos/services/search/sidebar-search-registry";
import type { SidebarActionID } from "ente-new/photos/services/search/types";
import {
pullSettings,
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 2e147046c2..0ade8c7ae5 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -4,6 +4,8 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-floating-promises */
import { CollectionMappingChoice } from "@/components/CollectionMappingChoice";
+import type { CollectionSelectorAttributes } from "@/components/CollectionSelector";
+import type { RemotePullOpts } from "@/components/gallery";
import { TakeoutOptions } from "@/components/TakeoutOptions";
import { UploadConfirmationDialog } from "@/components/UploadConfirmationDialog";
import { downloadAppDialogAttributes } from "@/components/utils/download";
@@ -71,8 +73,6 @@ import {
import { hasReliableCanvasReadback } from "ente-gallery/utils/upload/canvas-integrity";
import { CollectionSubType, type Collection } from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
-import type { CollectionSelectorAttributes } from "ente-new/photos/components/CollectionSelector";
-import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import { suppressAutoLockOnBlurForTrustedPrompt } from "ente-new/photos/services/app-lock";
import {
addOrCopyToCollection,
diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/apps/photos/src/components/gallery/BarImpl.tsx
similarity index 98%
rename from web/packages/new/photos/components/gallery/BarImpl.tsx
rename to web/apps/photos/src/components/gallery/BarImpl.tsx
index 0fa4ce6b48..0d288824f3 100644
--- a/web/packages/new/photos/components/gallery/BarImpl.tsx
+++ b/web/apps/photos/src/components/gallery/BarImpl.tsx
@@ -1,3 +1,7 @@
+import { CollectionsSortOptions } from "@/components/CollectionsSortOptions";
+import { StarIcon } from "@/components/icons/StarIcon";
+import type { PeopleSortBy } from "@/components/people-sort";
+import { PeopleSortOptions } from "@/components/PeopleSortOptions";
import { Link05Icon, PinIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import ArchiveIcon from "@mui/icons-material/Archive";
@@ -9,10 +13,6 @@ import { Overlay } from "ente-base/components/containers";
import { FilledIconButton } from "ente-base/components/mui";
import { Ellipsized2LineTypography } from "ente-base/components/Typography";
import { useIsSmallWidth } from "ente-base/components/utils/hooks";
-import { CollectionsSortOptions } from "ente-new/photos/components/CollectionsSortOptions";
-import { StarIcon } from "ente-new/photos/components/icons/StarIcon";
-import type { PeopleSortBy } from "ente-new/photos/components/people-sort";
-import { PeopleSortOptions } from "ente-new/photos/components/PeopleSortOptions";
import {
BarItemTile,
ItemCard,
@@ -28,6 +28,7 @@ import type {
CollectionSummaryAttribute,
CollectionsSortBy,
} from "ente-new/photos/services/collection-summary";
+import { isMLSupported } from "ente-new/photos/services/ml";
import type { Person } from "ente-new/photos/services/ml/people";
import { t } from "i18next";
import React, {
@@ -44,7 +45,6 @@ import {
areEqual,
type ListChildComponentProps,
} from "react-window";
-import { isMLSupported } from "../../services/ml";
import type { GalleryBarMode } from "./reducer";
export interface GalleryBarImplProps {
diff --git a/web/packages/new/photos/components/gallery/GalleryEmptyState.tsx b/web/apps/photos/src/components/gallery/GalleryEmptyState.tsx
similarity index 100%
rename from web/packages/new/photos/components/gallery/GalleryEmptyState.tsx
rename to web/apps/photos/src/components/gallery/GalleryEmptyState.tsx
diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/apps/photos/src/components/gallery/PeopleHeader.tsx
similarity index 98%
rename from web/packages/new/photos/components/gallery/PeopleHeader.tsx
rename to web/apps/photos/src/components/gallery/PeopleHeader.tsx
index d194766790..7e66a88f45 100644
--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx
+++ b/web/apps/photos/src/components/gallery/PeopleHeader.tsx
@@ -1,3 +1,4 @@
+import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import AddIcon from "@mui/icons-material/Add";
import CheckIcon from "@mui/icons-material/Check";
import ClearIcon from "@mui/icons-material/Clear";
@@ -42,6 +43,17 @@ import {
} from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import log from "ente-base/log";
+import {
+ GalleryItemsHeaderAdapter,
+ GalleryItemsSummary,
+} from "ente-new/photos/components/gallery/ListHeader";
+import { SuggestionFaceList } from "ente-new/photos/components/PeopleList";
+import {
+ ItemCard,
+ LargeTileButton,
+ LargeTileCreateNewButton,
+ LargeTileTextOverlay,
+} from "ente-new/photos/components/Tiles";
import {
addCGroup,
addClusterToCGroup,
@@ -53,6 +65,7 @@ import {
suggestionsAndChoicesForPerson,
unpinCGroup,
} from "ente-new/photos/services/ml";
+import type { FaceCluster } from "ente-new/photos/services/ml/cluster";
import type {
CGroupPerson,
ClusterPerson,
@@ -63,17 +76,7 @@ import type {
} from "ente-new/photos/services/ml/people";
import { t } from "i18next";
import React, { useEffect, useReducer, useState } from "react";
-import type { FaceCluster } from "../../services/ml/cluster";
-import { SuggestionFaceList } from "../PeopleList";
-import {
- ItemCard,
- LargeTileButton,
- LargeTileCreateNewButton,
- LargeTileTextOverlay,
-} from "../Tiles";
-import { useWrapAsyncOperation } from "../utils/use-wrap-async";
import type { GalleryBarImplProps } from "./BarImpl";
-import { GalleryItemsHeaderAdapter, GalleryItemsSummary } from "./ListHeader";
type PeopleHeaderProps = Pick<
GalleryBarImplProps,
diff --git a/web/packages/new/photos/components/gallery/helpers.ts b/web/apps/photos/src/components/gallery/helpers.ts
similarity index 95%
rename from web/packages/new/photos/components/gallery/helpers.ts
rename to web/apps/photos/src/components/gallery/helpers.ts
index 5328d581c2..f8930521d2 100644
--- a/web/packages/new/photos/components/gallery/helpers.ts
+++ b/web/apps/photos/src/components/gallery/helpers.ts
@@ -10,19 +10,19 @@
* is a needed for fast refresh to work.
*/
+import type { CollectionOp } from "@/components/SelectedFileOptions";
import { getUserRecoveryKey } from "ente-accounts/services/recovery-key";
import log from "ente-base/log";
import type { Collection } from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
-import type { CollectionOp } from "ente-new/photos/components/SelectedFileOptions";
import {
addOrCopyToCollection,
+ createUncategorizedCollection,
moveFromCollection,
moveToCollection,
restoreToCollection,
} from "ente-new/photos/services/collection";
-import { createUncategorizedCollection } from "../../services/collection";
-import { PseudoCollectionID } from "../../services/collection-summary";
+import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";
/**
* Ensure that the keys in local storage are not malformed by verifying that the
diff --git a/web/packages/new/photos/components/gallery/index.tsx b/web/apps/photos/src/components/gallery/index.tsx
similarity index 95%
rename from web/packages/new/photos/components/gallery/index.tsx
rename to web/apps/photos/src/components/gallery/index.tsx
index 5fbb6a3a3e..aa86defd8b 100644
--- a/web/packages/new/photos/components/gallery/index.tsx
+++ b/web/apps/photos/src/components/gallery/index.tsx
@@ -7,6 +7,8 @@
* there.
*/
+import { EnableML, FaceConsent } from "@/components/sidebar/MLSettings";
+import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import CheckIcon from "@mui/icons-material/Check";
import SortIcon from "@mui/icons-material/Sort";
import {
@@ -20,14 +22,15 @@ import {
import { CenteredFill, SpacedRow } from "ente-base/components/containers";
import { OverflowMenuOption } from "ente-base/components/OverflowMenu";
import { useModalVisibility } from "ente-base/components/utils/modal";
+import {
+ GalleryItemsHeaderAdapter,
+ GalleryItemsSummary,
+} from "ente-new/photos/components/gallery/ListHeader";
+import { useMLStatusSnapshot } from "ente-new/photos/components/utils/use-snapshot";
+import { enableML } from "ente-new/photos/services/ml";
import type { SearchSuggestion } from "ente-new/photos/services/search/types";
import { t } from "i18next";
import React, { useRef, useState } from "react";
-import { enableML } from "../../services/ml";
-import { EnableML, FaceConsent } from "../sidebar/MLSettings";
-import { useMLStatusSnapshot } from "../utils/use-snapshot";
-import { useWrapAsyncOperation } from "../utils/use-wrap-async";
-import { GalleryItemsHeaderAdapter, GalleryItemsSummary } from "./ListHeader";
export { GalleryEmptyState } from "./GalleryEmptyState";
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/apps/photos/src/components/gallery/reducer.ts
similarity index 99%
rename from web/packages/new/photos/components/gallery/reducer.ts
rename to web/apps/photos/src/components/gallery/reducer.ts
index c615b8acf1..82a47a638c 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/apps/photos/src/components/gallery/reducer.ts
@@ -19,28 +19,29 @@ import {
import type { MagicMetadata } from "ente-media/magic-metadata";
import {
createCollectionNameByID,
+ findDefaultHiddenCollectionIDs,
isArchivedCollection,
+ isDefaultHiddenCollection,
isHiddenCollection,
} from "ente-new/photos/services/collection";
-import { sortTrashItems, type TrashItem } from "ente-new/photos/services/trash";
-import { splitByPredicate } from "ente-utils/array";
-import { includes } from "ente-utils/type-guards";
-import { t } from "i18next";
-import React, { useReducer } from "react";
-import {
- findDefaultHiddenCollectionIDs,
- isDefaultHiddenCollection,
-} from "../../services/collection";
import {
CollectionSummarySortPriority,
PseudoCollectionID,
type CollectionSummary,
type CollectionSummaryAttribute,
type CollectionSummaryType,
-} from "../../services/collection-summary";
-import type { PeopleState, Person } from "../../services/ml/people";
-import type { SearchSuggestion } from "../../services/search/types";
-import type { FamilyData, UserDetails } from "../../services/user-details";
+} from "ente-new/photos/services/collection-summary";
+import type { PeopleState, Person } from "ente-new/photos/services/ml/people";
+import type { SearchSuggestion } from "ente-new/photos/services/search/types";
+import { sortTrashItems, type TrashItem } from "ente-new/photos/services/trash";
+import type {
+ FamilyData,
+ UserDetails,
+} from "ente-new/photos/services/user-details";
+import { splitByPredicate } from "ente-utils/array";
+import { includes } from "ente-utils/type-guards";
+import { t } from "i18next";
+import React, { useReducer } from "react";
/**
* Specifies what the bar at the top of the gallery is displaying currently.
diff --git a/web/packages/new/photos/components/icons/StarIcon.tsx b/web/apps/photos/src/components/icons/StarIcon.tsx
similarity index 100%
rename from web/packages/new/photos/components/icons/StarIcon.tsx
rename to web/apps/photos/src/components/icons/StarIcon.tsx
diff --git a/web/packages/new/photos/components/icons/StarOffIcon.tsx b/web/apps/photos/src/components/icons/StarOffIcon.tsx
similarity index 100%
rename from web/packages/new/photos/components/icons/StarOffIcon.tsx
rename to web/apps/photos/src/components/icons/StarOffIcon.tsx
diff --git a/web/packages/new/photos/components/people-sort.ts b/web/apps/photos/src/components/people-sort.ts
similarity index 100%
rename from web/packages/new/photos/components/people-sort.ts
rename to web/apps/photos/src/components/people-sort.ts
diff --git a/web/packages/new/photos/components/sidebar/MLSettings.tsx b/web/apps/photos/src/components/sidebar/MLSettings.tsx
similarity index 97%
rename from web/packages/new/photos/components/sidebar/MLSettings.tsx
rename to web/apps/photos/src/components/sidebar/MLSettings.tsx
index 09d89b6b75..e3567730c6 100644
--- a/web/packages/new/photos/components/sidebar/MLSettings.tsx
+++ b/web/apps/photos/src/components/sidebar/MLSettings.tsx
@@ -1,3 +1,4 @@
+import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import {
Box,
Button,
@@ -17,17 +18,16 @@ import {
type NestedSidebarDrawerVisibilityProps,
} from "ente-base/components/mui/SidebarDrawer";
import { useBaseContext } from "ente-base/context";
+import { useMLStatusSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
disableML,
enableML,
type MLStatus,
} from "ente-new/photos/services/ml";
+import { openURL } from "ente-new/photos/utils/web";
import { t } from "i18next";
import React, { useEffect, useState } from "react";
import { Trans } from "react-i18next";
-import { openURL } from "../../utils/web";
-import { useMLStatusSnapshot } from "../utils/use-snapshot";
-import { useWrapAsyncOperation } from "../utils/use-wrap-async";
export const MLSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
open,
diff --git a/web/packages/new/photos/components/utils/use-wrap-async.ts b/web/apps/photos/src/components/utils/use-wrap-async.ts
similarity index 94%
rename from web/packages/new/photos/components/utils/use-wrap-async.ts
rename to web/apps/photos/src/components/utils/use-wrap-async.ts
index ebae892663..c91d7a84e5 100644
--- a/web/packages/new/photos/components/utils/use-wrap-async.ts
+++ b/web/apps/photos/src/components/utils/use-wrap-async.ts
@@ -1,6 +1,6 @@
import { useBaseContext } from "ente-base/context";
+import { usePhotosAppContext } from "ente-new/photos/types/context";
import { useCallback } from "react";
-import { usePhotosAppContext } from "../../types/context";
/**
* Wrap a function returning a promise in a loading bar and error handler.
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 4fb2466703..4b4f3e9557 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -5,6 +5,10 @@
import type { AddToAlbumPhase } from "@/components/AlbumAddedNotification";
import { AlbumAddedNotification } from "@/components/AlbumAddedNotification";
import { AuthenticateUser } from "@/components/AuthenticateUser";
+import {
+ CollectionSelector,
+ type CollectionSelectorAttributes,
+} from "@/components/CollectionSelector";
import { GalleryBarAndListHeader } from "@/components/Collections/GalleryBarAndListHeader";
import { PickCoverPhotoDialog } from "@/components/Collections/PickCoverPhotoDialog";
import { Export } from "@/components/Export";
@@ -14,9 +18,30 @@ import { FileListWithViewer } from "@/components/FileListWithViewer";
import { FixCreationTime } from "@/components/FixCreationTime";
import { PlanSelector } from "@/components/PlanSelector";
import { QuickLinkCreatedNotification } from "@/components/QuickLinkCreatedNotification";
+import { SearchBar, type SearchBarProps } from "@/components/SearchBar";
+import {
+ SelectedFileOptions,
+ type CollectionOp,
+ type FileOp,
+} from "@/components/SelectedFileOptions";
import { Sidebar } from "@/components/Sidebar";
import { Upload } from "@/components/Upload";
import { WhatsNew } from "@/components/WhatsNew";
+import {
+ GalleryEmptyState,
+ PeopleEmptyState,
+ SearchResultsHeader,
+ type RemotePullOpts,
+} from "@/components/gallery";
+import {
+ findCollectionCreatingUncategorizedIfNeeded,
+ performCollectionOp,
+ validateKey,
+} from "@/components/gallery/helpers";
+import {
+ useGalleryReducer,
+ type GalleryBarMode,
+} from "@/components/gallery/reducer";
import {
notifyOthersFilesDialogAttributes,
notifyUnsupportedSharedFavoritesDialogAttributes,
@@ -71,35 +96,7 @@ import { CollectionSubType, type Collection } from "ente-media/collection";
import type { EnteFile } from "ente-media/file";
import { ItemVisibility, metadataHash } from "ente-media/file-metadata";
import { AssignPersonDialog } from "ente-new/photos/components/AssignPersonDialog";
-import {
- CollectionSelector,
- type CollectionSelectorAttributes,
-} from "ente-new/photos/components/CollectionSelector";
import { EditLocationDialog } from "ente-new/photos/components/EditLocationDialog";
-import {
- SearchBar,
- type SearchBarProps,
-} from "ente-new/photos/components/SearchBar";
-import {
- SelectedFileOptions,
- type CollectionOp,
- type FileOp,
-} from "ente-new/photos/components/SelectedFileOptions";
-import {
- GalleryEmptyState,
- PeopleEmptyState,
- SearchResultsHeader,
- type RemotePullOpts,
-} from "ente-new/photos/components/gallery";
-import {
- findCollectionCreatingUncategorizedIfNeeded,
- performCollectionOp,
- validateKey,
-} from "ente-new/photos/components/gallery/helpers";
-import {
- useGalleryReducer,
- type GalleryBarMode,
-} from "ente-new/photos/components/gallery/reducer";
import {
usePeopleStateSnapshot,
useSettingsSnapshot,
@@ -138,6 +135,7 @@ import {
performFileOp,
type SelectedState,
} from "@/utils/file";
+import type { FileContextAction } from "@/utils/file-actions";
import {
quickLinkNameForFiles,
resolveQuickLinkURL,
@@ -162,7 +160,6 @@ import {
verifyStripeSubscription,
} from "ente-new/photos/services/user-details";
import { usePhotosAppContext } from "ente-new/photos/types/context";
-import type { FileContextAction } from "ente-new/photos/utils/file-actions";
import { PromiseQueue } from "ente-utils/promise";
import { t } from "i18next";
import { useRouter, type NextRouter } from "next/router";
diff --git a/web/packages/new/photos/services/search/sidebar-search-registry.ts b/web/apps/photos/src/services/search/sidebar-search-registry.ts
similarity index 98%
rename from web/packages/new/photos/services/search/sidebar-search-registry.ts
rename to web/apps/photos/src/services/search/sidebar-search-registry.ts
index 8b7251193b..6c770cdfaa 100644
--- a/web/packages/new/photos/services/search/sidebar-search-registry.ts
+++ b/web/apps/photos/src/services/search/sidebar-search-registry.ts
@@ -1,9 +1,12 @@
import { isDesktop } from "ente-base/app";
import { isHLSGenerationSupported } from "ente-gallery/services/video";
+import { isMLSupported } from "ente-new/photos/services/ml";
+import type {
+ SearchOption,
+ SidebarActionID,
+} from "ente-new/photos/services/search/types";
import { wait } from "ente-utils/promise";
import { t } from "i18next";
-import { isMLSupported } from "../ml";
-import type { SearchOption, SidebarActionID } from "./types";
export interface SidebarAction {
id: SidebarActionID;
diff --git a/web/packages/new/photos/utils/file-actions.ts b/web/apps/photos/src/utils/file-actions.ts
similarity index 98%
rename from web/packages/new/photos/utils/file-actions.ts
rename to web/apps/photos/src/utils/file-actions.ts
index 20676c58fb..aed755e7f0 100644
--- a/web/packages/new/photos/utils/file-actions.ts
+++ b/web/apps/photos/src/utils/file-actions.ts
@@ -1,4 +1,4 @@
-import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
+import type { GalleryBarMode } from "@/components/gallery/reducer";
import {
PseudoCollectionID,
type CollectionSummary,
diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts
index 2f10f0de69..857335b6ca 100644
--- a/web/apps/photos/src/utils/file/index.ts
+++ b/web/apps/photos/src/utils/file/index.ts
@@ -1,10 +1,10 @@
+import type { SelectionContext } from "@/components/gallery";
+import type { FileOp } from "@/components/SelectedFileOptions";
import { downloadAndSaveFiles } from "@/services/save";
import type { AddSaveGroup } from "ente-gallery/components/utils/save-groups";
import type { EnteFile } from "ente-media/file";
import { fileFileName, ItemVisibility } from "ente-media/file-metadata";
import { FileType } from "ente-media/file-type";
-import type { SelectionContext } from "ente-new/photos/components/gallery";
-import type { FileOp } from "ente-new/photos/components/SelectedFileOptions";
import {
addToFavoritesCollection,
deleteFromTrash,
diff --git a/web/apps/photos/src/utils/photoFrame/index.ts b/web/apps/photos/src/utils/photoFrame/index.ts
index 13f8ff0b76..6daa2161f7 100644
--- a/web/apps/photos/src/utils/photoFrame/index.ts
+++ b/web/apps/photos/src/utils/photoFrame/index.ts
@@ -1,7 +1,7 @@
// TODO: Audit this file
+import type { SelectionContext } from "@/components/gallery";
+import type { GalleryBarMode } from "@/components/gallery/reducer";
import type { SelectedState, SetSelectedState } from "@/utils/file";
-import type { SelectionContext } from "ente-new/photos/components/gallery";
-import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
// TODO: All this is unnecessarily complex, and needs reworking.
export const handleSelectCreator =
diff --git a/web/apps/photos/tests/file-actions.test.ts b/web/apps/photos/tests/file-actions.test.ts
index 7c42ec5043..c334eba472 100644
--- a/web/apps/photos/tests/file-actions.test.ts
+++ b/web/apps/photos/tests/file-actions.test.ts
@@ -1,6 +1,6 @@
import type { CollectionSummary } from "ente-new/photos/services/collection-summary";
-import { getAvailableFileActions } from "ente-new/photos/utils/file-actions";
import { describe, expect, test } from "vitest";
+import { getAvailableFileActions } from "../src/utils/file-actions";
describe("getAvailableFileActions", () => {
test("uses shared actions for an incoming uncategorized collection", () => {