Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move

Manav Rathic809d572f795
diff --git a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
index 5ddc03b26c..7a2cbd2453 100644
--- a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
@@ -1,3 +1,4 @@
+import type { Collection } from "@/media/collection";
import { SpaceBetweenFlex } from "@ente/shared/components/Container";
import ArchiveOutlined from "@mui/icons-material/ArchiveOutlined";
import Favorite from "@mui/icons-material/FavoriteRounded";
@@ -6,11 +7,7 @@ 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,
- CollectionSummaryType,
-} from "types/collection";
+import { CollectionSummary, CollectionSummaryType } from "types/collection";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
import { shouldShowOptions } from "utils/collection";
import { CollectionInfo } from "./CollectionInfo";
diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
index 75ec3b4626..2bf59abf55 100644
--- a/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx
@@ -1,5 +1,6 @@
import { boxSeal } from "@/base/crypto/libsodium";
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import { VerticallyCentered } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import EnteButton from "@ente/shared/components/EnteButton";
@@ -12,7 +13,6 @@ import { Link, Typography } from "@mui/material";
import { t } from "i18next";
import { useEffect, useState } from "react";
import { Trans } from "react-i18next";
-import { Collection } from "types/collection";
import { v4 as uuidv4 } from "uuid";
import { loadSender } from "../../../utils/useCastSender";
diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx
index f43bed216d..030f54ed18 100644
--- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx
@@ -1,4 +1,5 @@
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import { ItemVisibility } from "@/media/file-metadata";
import { HorizontalFlex } from "@ente/shared/components/Container";
import OverflowMenu from "@ente/shared/components/OverflowMenu/menu";
@@ -12,7 +13,7 @@ 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, CollectionSummaryType } from "types/collection";
+import { CollectionSummaryType } from "types/collection";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
import {
ALL_SECTION,
diff --git a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx
index cdbc901b2e..4132360aad 100644
--- a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx
@@ -1,3 +1,4 @@
+import type { Collection } from "@/media/collection";
import { FlexWrapper } from "@ente/shared/components/Container";
import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton";
import { DialogContent, useMediaQuery } from "@mui/material";
@@ -6,7 +7,6 @@ import { t } from "i18next";
import { useEffect, useState } from "react";
import { createUnCategorizedCollection } from "services/collectionService";
import {
- Collection,
CollectionSummaries,
CollectionSummary,
CollectionSummaryType,
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipant.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipant.tsx
index 080d1c667a..d42243a813 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipant.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/AddParticipant.tsx
@@ -1,8 +1,8 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { Titlebar } from "@/base/components/Titlebar";
+import { COLLECTION_ROLE, type Collection } from "@/media/collection";
import { DialogProps, Stack } from "@mui/material";
import { t } from "i18next";
-import { COLLECTION_ROLE, Collection } from "types/collection";
import { GalleryContext } from "pages/gallery";
import { useContext, useMemo } from "react";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
index 9f7f407da4..6ebcfce510 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageEmailShare.tsx
@@ -5,6 +5,11 @@ import {
MenuSectionTitle,
} from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
+import {
+ COLLECTION_ROLE,
+ type Collection,
+ type CollectionUser,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import Add from "@mui/icons-material/Add";
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
@@ -18,7 +23,6 @@ import { AppContext } from "pages/_app";
import { GalleryContext } from "pages/gallery";
import { useContext, useRef, useState } from "react";
import { unshareCollection } from "services/collectionService";
-import { COLLECTION_ROLE, Collection, CollectionUser } from "types/collection";
import AddParticipant from "./AddParticipant";
import ManageParticipant from "./ManageParticipant";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
index 3c41f65533..f448af9102 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx
@@ -2,6 +2,7 @@ import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
import log from "@/base/log";
+import type { Collection, CollectionUser } from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import BlockIcon from "@mui/icons-material/Block";
import DoneIcon from "@mui/icons-material/Done";
@@ -14,7 +15,6 @@ import { GalleryContext } from "pages/gallery";
import { useContext } from "react";
import { Trans } from "react-i18next";
import { shareCollection } from "services/collectionService";
-import { Collection, CollectionUser } from "types/collection";
import { handleSharingErrors } from "utils/error/ui";
interface Iprops {
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/index.tsx
index 3137bcc8aa..151b482c5c 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/emailShare/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/emailShare/index.tsx
@@ -1,5 +1,5 @@
+import { COLLECTION_ROLE, type Collection } from "@/media/collection";
import { useRef, useState } from "react";
-import { COLLECTION_ROLE, Collection } from "types/collection";
import {
MenuItemDivider,
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/index.tsx
index e9a709566a..f970df0589 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/index.tsx
@@ -1,12 +1,9 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { Titlebar } from "@/base/components/Titlebar";
+import type { Collection } from "@/media/collection";
import { DialogProps, Stack } from "@mui/material";
import { t } from "i18next";
-import {
- Collection,
- CollectionSummary,
- CollectionSummaryType,
-} from "types/collection";
+import { 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/publicShare/EnablePublicShareOptions.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/EnablePublicShareOptions.tsx
index 3a1cea2a29..e6b49845b2 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/EnablePublicShareOptions.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/EnablePublicShareOptions.tsx
@@ -3,6 +3,7 @@ import {
MenuItemGroup,
MenuSectionTitle,
} from "@/base/components/Menu";
+import type { Collection, PublicURL } from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import DownloadSharp from "@mui/icons-material/DownloadSharp";
import LinkIcon from "@mui/icons-material/Link";
@@ -15,7 +16,6 @@ import {
createShareableURL,
updateShareableURL,
} from "services/collectionService";
-import { Collection, PublicURL } from "types/collection";
import { handleSharingErrors } from "utils/error/ui";
interface Iprops {
collection: Collection;
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/index.tsx
index e71f482cf6..805fb5d233 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/index.tsx
@@ -1,5 +1,5 @@
+import type { Collection, PublicURL } from "@/media/collection";
import { useEffect, useState } from "react";
-import { Collection, PublicURL } from "types/collection";
import { appendCollectionKeyToShareURL } from "utils/collection";
import EnablePublicShareOptions from "./EnablePublicShareOptions";
import CopyLinkModal from "./copyLinkModal";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx
index 0e5b769056..99517c4cd2 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx
@@ -1,12 +1,16 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import ChevronRight from "@mui/icons-material/ChevronRight";
import { DialogProps, Stack } from "@mui/material";
import { t } from "i18next";
import { useMemo, useState } from "react";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
import { getDeviceLimitOptions } from "utils/collection";
interface Iprops {
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
index 92008cc75a..a1b759a491 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/downloadAccess.tsx
@@ -1,9 +1,13 @@
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { t } from "i18next";
import { AppContext } from "pages/_app";
import { useContext } from "react";
import { Trans } from "react-i18next";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
interface Iprops {
publicShareProp: PublicURL;
collection: Collection;
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/index.tsx
index a8f2f96ca0..98a39646b4 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/index.tsx
@@ -1,6 +1,11 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import RemoveCircleOutline from "@mui/icons-material/RemoveCircleOutline";
@@ -12,7 +17,6 @@ import {
deleteShareableURL,
updateShareableURL,
} from "services/collectionService";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
import { SetPublicShareProp } from "types/publicCollection";
import { handleSharingErrors } from "utils/error/ui";
import { ManageDeviceLimit } from "./deviceLimit";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx
index e2efaca504..8487240274 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx
@@ -1,13 +1,17 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { formatDateTime } from "@ente/shared/time/format";
import ChevronRight from "@mui/icons-material/ChevronRight";
import { DialogProps, Stack } from "@mui/material";
import { t } from "i18next";
import { useMemo, useState } from "react";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
import { shareExpiryOptions } from "utils/collection";
import { isLinkExpired } from "../managePublicShare";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
index 2c5890e9ab..5c9855bdee 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/linkPassword/index.tsx
@@ -1,8 +1,12 @@
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { t } from "i18next";
import { AppContext } from "pages/_app";
import { useContext, useState } from "react";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
import { PublicLinkSetPassword } from "./setPassword";
interface Iprops {
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/publicCollect.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/publicCollect.tsx
index b97b6978c8..24f778ff26 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/publicCollect.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/manage/publicCollect.tsx
@@ -1,8 +1,12 @@
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
+import type {
+ Collection,
+ PublicURL,
+ UpdatePublicURL,
+} from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { Stack } from "@mui/material";
import { t } from "i18next";
-import { Collection, PublicURL, UpdatePublicURL } from "types/collection";
interface Iprops {
publicShareProp: PublicURL;
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/managePublicShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/managePublicShare.tsx
index a5e7342c29..d06bbd87b1 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/publicShare/managePublicShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/publicShare/managePublicShare.tsx
@@ -1,4 +1,5 @@
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
+import type { Collection, PublicURL } from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import ContentCopyIcon from "@mui/icons-material/ContentCopyOutlined";
@@ -8,7 +9,6 @@ import PublicIcon from "@mui/icons-material/Public";
import { Stack, Typography } from "@mui/material";
import { t } from "i18next";
import { useState } from "react";
-import { Collection, PublicURL } from "types/collection";
import { SetPublicShareProp } from "types/publicCollection";
import ManagePublicShareOptions from "./manage";
diff --git a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx
index c314a5aa05..4d557f211f 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx
@@ -3,6 +3,7 @@ import {
MenuItemGroup,
MenuSectionTitle,
} from "@/base/components/Menu";
+import { COLLECTION_ROLE } from "@/media/collection";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import AdminPanelSettingsIcon from "@mui/icons-material/AdminPanelSettings";
import ModeEditIcon from "@mui/icons-material/ModeEdit";
@@ -12,7 +13,7 @@ import Avatar from "components/pages/gallery/Avatar";
import { t } from "i18next";
import { GalleryContext } from "pages/gallery";
import { useContext } from "react";
-import { COLLECTION_ROLE, CollectionSummaryType } from "types/collection";
+import { CollectionSummaryType } from "types/collection";
export default function SharingDetails({ collection, type }) {
const galleryContext = useContext(GalleryContext);
diff --git a/web/apps/photos/src/components/Collections/index.tsx b/web/apps/photos/src/components/Collections/index.tsx
index 60519984da..03e75eaf87 100644
--- a/web/apps/photos/src/components/Collections/index.tsx
+++ b/web/apps/photos/src/components/Collections/index.tsx
@@ -1,3 +1,4 @@
+import type { Collection } from "@/media/collection";
import { useLocalState } from "@ente/shared/hooks/useLocalState";
import { LS_KEYS } from "@ente/shared/storage/localStorage";
import AllCollections from "components/Collections/AllCollections";
@@ -8,7 +9,7 @@ import CollectionShare from "components/Collections/CollectionShare";
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
import { useCallback, useEffect, useMemo, useState } from "react";
import { sortCollectionSummaries } from "services/collectionService";
-import { Collection, CollectionSummaries } from "types/collection";
+import { CollectionSummaries } from "types/collection";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
import {
ALL_SECTION,
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 3369ae9ea2..626ffc260a 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -1,5 +1,6 @@
import { assertionFailed } from "@/base/assert";
import { useIsMobileWidth } from "@/base/hooks";
+import type { Collection } from "@/media/collection";
import { FileType } from "@/media/file-type";
import {
isMLSupported,
@@ -65,7 +66,6 @@ import {
} from "react-select";
import AsyncSelect from "react-select/async";
import { getAutoCompleteSuggestions } from "services/searchService";
-import { type Collection } from "types/collection";
interface SearchBarProps {
/**
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index fc1977e392..c482364033 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -1,6 +1,7 @@
import { basename } from "@/base/file";
import log from "@/base/log";
import type { CollectionMapping, Electron, ZipItem } from "@/base/types/ipc";
+import type { Collection } from "@/media/collection";
import { exportMetadataDirectoryName } from "@/new/photos/services/export";
import type {
FileAndPath,
@@ -33,8 +34,6 @@ import type {
} from "services/upload/uploadManager";
import uploadManager from "services/upload/uploadManager";
import watcher from "services/watch";
-import { NotificationAttributes } from "types/Notification";
-import { Collection } from "types/collection";
import {
CollectionSelectorIntent,
SetCollectionSelectorAttributes,
@@ -42,6 +41,7 @@ import {
SetFiles,
SetLoading,
} from "types/gallery";
+import { NotificationAttributes } from "types/Notification";
import { getOrCreateAlbum } from "utils/collection";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
import {
diff --git a/web/apps/photos/src/components/pages/gallery/AvatarGroup.tsx b/web/apps/photos/src/components/pages/gallery/AvatarGroup.tsx
index df733fdded..a45bb6f771 100644
--- a/web/apps/photos/src/components/pages/gallery/AvatarGroup.tsx
+++ b/web/apps/photos/src/components/pages/gallery/AvatarGroup.tsx
@@ -1,6 +1,6 @@
+import type { Collection } from "@/media/collection";
import { styled } from "@mui/material";
import NumberAvatar from "@mui/material/Avatar";
-import { Collection } from "types/collection";
import Avatar from "./Avatar";
const AvatarContainer = styled("div")({
diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
index 01182abfa9..29087e87c5 100644
--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
@@ -1,4 +1,5 @@
import { SelectionBar } from "@/base/components/Navbar";
+import type { Collection } from "@/media/collection";
import { FluidContainer } from "@ente/shared/components/Container";
import ClockIcon from "@mui/icons-material/AccessTime";
import AddIcon from "@mui/icons-material/Add";
@@ -16,7 +17,6 @@ import { Box, IconButton, Stack, Tooltip } from "@mui/material";
import { t } from "i18next";
import { AppContext } from "pages/_app";
import { useContext } from "react";
-import { Collection } from "types/collection";
import {
CollectionSelectorIntent,
SetCollectionSelectorAttributes,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 7f40003f76..0b33378521 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -2,6 +2,7 @@ import { stashRedirect } from "@/accounts/services/redirect";
import { NavbarBase } from "@/base/components/Navbar";
import { useIsMobileWidth } from "@/base/hooks";
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import { WhatsNew } from "@/new/photos/components/WhatsNew";
import { shouldShowWhatsNew } from "@/new/photos/services/changelog";
import downloadManager from "@/new/photos/services/download";
@@ -105,11 +106,7 @@ 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,
- CollectionSummaryType,
-} from "types/collection";
+import { CollectionSummaries, CollectionSummaryType } from "types/collection";
import {
GalleryContextType,
SelectedState,
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index c11e49fd80..3b843c8bd8 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -2,6 +2,7 @@ import { NavbarBase, SelectionBar } from "@/base/components/Navbar";
import { sharedCryptoWorker } from "@/base/crypto";
import { useIsMobileWidth, useIsTouchscreen } from "@/base/hooks";
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import downloadManager from "@/new/photos/services/download";
import { EnteFile } from "@/new/photos/types/file";
import { mergeMetadata } from "@/new/photos/utils/file";
@@ -63,7 +64,6 @@ import {
verifyPublicCollectionPassword,
} from "services/publicCollectionService";
import uploadManager from "services/upload/uploadManager";
-import { Collection } from "types/collection";
import {
SelectedState,
SetFilesDownloadProgressAttributes,
diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts
index db5ce4bec5..80f7f741b4 100644
--- a/web/apps/photos/src/services/collectionService.ts
+++ b/web/apps/photos/src/services/collectionService.ts
@@ -1,6 +1,23 @@
import { encryptMetadataJSON, sharedCryptoWorker } from "@/base/crypto";
import log from "@/base/log";
import { apiURL } from "@/base/origins";
+import {
+ AddToCollectionRequest,
+ Collection,
+ CollectionMagicMetadata,
+ CollectionMagicMetadataProps,
+ CollectionPublicMagicMetadata,
+ CollectionShareeMagicMetadata,
+ CollectionToFileMap,
+ CollectionType,
+ CreatePublicAccessTokenRequest,
+ EncryptedCollection,
+ EncryptedFileKey,
+ MoveToCollectionRequest,
+ PublicURL,
+ RemoveFromCollectionRequest,
+ UpdatePublicURL,
+} from "@/media/collection";
import { ItemVisibility } from "@/media/file-metadata";
import { getLocalFiles } from "@/new/photos/services/files";
import { EnteFile } from "@/new/photos/types/file";
@@ -19,25 +36,10 @@ import { getActualKey } from "@ente/shared/user";
import type { User } from "@ente/shared/user/types";
import { t } from "i18next";
import {
- AddToCollectionRequest,
- Collection,
CollectionFilesCount,
- CollectionMagicMetadata,
- CollectionMagicMetadataProps,
- CollectionPublicMagicMetadata,
- CollectionShareeMagicMetadata,
CollectionSummaries,
CollectionSummary,
CollectionSummaryType,
- CollectionToFileMap,
- CollectionType,
- CreatePublicAccessTokenRequest,
- EncryptedCollection,
- EncryptedFileKey,
- MoveToCollectionRequest,
- PublicURL,
- RemoveFromCollectionRequest,
- UpdatePublicURL,
} from "types/collection";
import { FamilyData } from "types/user";
import {
diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.ts
index 84d48832a9..a130f9f729 100644
--- a/web/apps/photos/src/services/export/index.ts
+++ b/web/apps/photos/src/services/export/index.ts
@@ -1,5 +1,6 @@
import { ensureElectron } from "@/base/electron";
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import {
fileCreationPhotoDate,
fileLocation,
@@ -27,7 +28,6 @@ import QueueProcessor, {
RequestCanceller,
} from "@ente/shared/utils/queueProcessor";
import i18n from "i18next";
-import { Collection } from "types/collection";
import {
CollectionExportNames,
ExportProgress,
diff --git a/web/apps/photos/src/services/export/migration.ts b/web/apps/photos/src/services/export/migration.ts
index 9c1c011e32..2116ca258c 100644
--- a/web/apps/photos/src/services/export/migration.ts
+++ b/web/apps/photos/src/services/export/migration.ts
@@ -1,6 +1,7 @@
import { ensureElectron } from "@/base/electron";
import { nameAndExtension } from "@/base/file";
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import { FileType } from "@/media/file-type";
import { decodeLivePhoto } from "@/media/live-photo";
import downloadManager from "@/new/photos/services/download";
@@ -17,7 +18,6 @@ import { wait } from "@/utils/promise";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import type { User } from "@ente/shared/user/types";
import { getLocalCollections } from "services/collectionService";
-import { Collection } from "types/collection";
import {
CollectionExportNames,
ExportProgress,
diff --git a/web/apps/photos/src/services/fileService.ts b/web/apps/photos/src/services/fileService.ts
index 613e9bd85e..354bc04da7 100644
--- a/web/apps/photos/src/services/fileService.ts
+++ b/web/apps/photos/src/services/fileService.ts
@@ -1,6 +1,7 @@
import { encryptMetadataJSON } from "@/base/crypto";
import log from "@/base/log";
import { apiURL } from "@/base/origins";
+import type { Collection } from "@/media/collection";
import {
clearCachedThumbnailsIfChanged,
getLocalFiles,
@@ -19,7 +20,6 @@ import { batch } from "@/utils/array";
import HTTPService from "@ente/shared/network/HTTPService";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
import exportService from "services/export";
-import { Collection } from "types/collection";
import { SetFiles } from "types/gallery";
import { decryptFile, getLatestVersionFiles, sortFiles } from "utils/file";
import {
diff --git a/web/apps/photos/src/services/publicCollectionService.ts b/web/apps/photos/src/services/publicCollectionService.ts
index 8b1a522954..9deed90281 100644
--- a/web/apps/photos/src/services/publicCollectionService.ts
+++ b/web/apps/photos/src/services/publicCollectionService.ts
@@ -1,12 +1,15 @@
import { sharedCryptoWorker } from "@/base/crypto";
import log from "@/base/log";
import { apiURL } from "@/base/origins";
+import type {
+ Collection,
+ CollectionPublicMagicMetadata,
+} from "@/media/collection";
import { EncryptedEnteFile, EnteFile } from "@/new/photos/types/file";
import { mergeMetadata } from "@/new/photos/utils/file";
import { CustomError, parseSharingErrorCodes } from "@ente/shared/error";
import HTTPService from "@ente/shared/network/HTTPService";
import localForage from "@ente/shared/storage/localForage";
-import { Collection, CollectionPublicMagicMetadata } from "types/collection";
import { LocalSavedPublicCollectionFiles } from "types/publicCollection";
import { decryptFile, sortFiles } from "utils/file";
diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts
index 7dd3e289c2..215b15c2e6 100644
--- a/web/apps/photos/src/services/searchService.ts
+++ b/web/apps/photos/src/services/searchService.ts
@@ -1,4 +1,5 @@
import log from "@/base/log";
+import type { Collection } from "@/media/collection";
import { FileType } from "@/media/file-type";
import { createSearchQuery, search } from "@/new/photos/services/search";
import type {
@@ -15,7 +16,6 @@ import {
} from "@/new/photos/services/search/types";
import type { LocationTag } from "@/new/photos/services/user-entity";
import { type EnteFile } from "@/new/photos/types/file";
-import { type Collection } from "types/collection";
// Suggestions shown in the search dropdown when the user has typed something.
export const getAutoCompleteSuggestions =
diff --git a/web/apps/photos/src/services/trashService.ts b/web/apps/photos/src/services/trashService.ts
index 73d2f2a44f..fef3d4ee64 100644
--- a/web/apps/photos/src/services/trashService.ts
+++ b/web/apps/photos/src/services/trashService.ts
@@ -1,5 +1,6 @@
import log from "@/base/log";
import { apiURL } from "@/base/origins";
+import type { Collection } from "@/media/collection";
import {
getLocalTrash,
getTrashedFiles,
@@ -9,7 +10,6 @@ import { EncryptedTrashItem, Trash } from "@/new/photos/types/file";
import HTTPService from "@ente/shared/network/HTTPService";
import localForage from "@ente/shared/storage/localForage";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
-import { Collection } from "types/collection";
import { SetFiles } from "types/gallery";
import { decryptFile } from "utils/file";
import { getCollection } from "./collectionService";
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.ts
index 1028f84aed..d6c32f6cf5 100644
--- a/web/apps/photos/src/services/upload/uploadManager.ts
+++ b/web/apps/photos/src/services/upload/uploadManager.ts
@@ -4,6 +4,7 @@ import { lowercaseExtension, nameAndExtension } from "@/base/file";
import log from "@/base/log";
import type { Electron } from "@/base/types/ipc";
import { ComlinkWorker } from "@/base/worker/comlink-worker";
+import type { Collection } from "@/media/collection";
import { FileType } from "@/media/file-type";
import { potentialFileTypeFromExtension } from "@/media/live-photo";
import { getLocalFiles } from "@/new/photos/services/files";
@@ -26,7 +27,6 @@ import {
} from "services/publicCollectionService";
import { getDisableCFUploadProxyFlag } from "services/userService";
import watcher from "services/watch";
-import { Collection } from "types/collection";
import { SetFiles } from "types/gallery";
import { decryptFile, getUserOwnedFiles, sortFiles } from "utils/file";
import {
diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.ts
index bbac30cae7..e17e054978 100644
--- a/web/apps/photos/src/services/watch.ts
+++ b/web/apps/photos/src/services/watch.ts
@@ -11,6 +11,7 @@ import type {
FolderWatch,
FolderWatchSyncedFile,
} from "@/base/types/ipc";
+import type { Collection } from "@/media/collection";
import { getLocalFiles } from "@/new/photos/services/files";
import { UPLOAD_RESULT } from "@/new/photos/services/upload/types";
import { EncryptedEnteFile } from "@/new/photos/types/file";
@@ -19,7 +20,6 @@ import debounce from "debounce";
import uploadManager, {
type UploadItemWithCollection,
} from "services/upload/uploadManager";
-import { Collection } from "types/collection";
import { groupFilesBasedOnCollectionID } from "utils/file";
import { removeFromCollection } from "./collectionService";
diff --git a/web/apps/photos/src/types/collection.ts b/web/apps/photos/src/types/collection.ts
new file mode 100644
index 0000000000..3442ff98e9
--- /dev/null
+++ b/web/apps/photos/src/types/collection.ts
@@ -0,0 +1,33 @@
+import type { EnteFile } from "@/new/photos/types/file";
+
+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 interface CollectionSummary {
+ id: number;
+ name: string;
+ type: CollectionSummaryType;
+ coverFile: EnteFile;
+ latestFile: EnteFile;
+ fileCount: number;
+ updationTime: number;
+ order?: number;
+}
+
+export type CollectionSummaries = Map<number, CollectionSummary>;
+export type CollectionFilesCount = Map<number, number>;
diff --git a/web/apps/photos/src/types/gallery/index.ts b/web/apps/photos/src/types/gallery/index.ts
index 1f95e78a19..ce789d31a0 100644
--- a/web/apps/photos/src/types/gallery/index.ts
+++ b/web/apps/photos/src/types/gallery/index.ts
@@ -1,9 +1,9 @@
+import type { Collection } from "@/media/collection";
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";
-import { Collection } from "types/collection";
export type SelectedState = {
[k: number]: boolean;
diff --git a/web/apps/photos/src/types/publicCollection/index.ts b/web/apps/photos/src/types/publicCollection/index.ts
index 95c5607584..41039a67e5 100644
--- a/web/apps/photos/src/types/publicCollection/index.ts
+++ b/web/apps/photos/src/types/publicCollection/index.ts
@@ -1,6 +1,6 @@
+import type { PublicURL } from "@/media/collection";
import { EnteFile } from "@/new/photos/types/file";
import { TimeStampListItem } from "components/PhotoList";
-import { PublicURL } from "types/collection";
export interface PublicCollectionGalleryContextType {
token: string;
diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts
index 3d1a1398ce..084bbc97ea 100644
--- a/web/apps/photos/src/utils/collection.ts
+++ b/web/apps/photos/src/utils/collection.ts
@@ -1,5 +1,12 @@
import { ensureElectron } from "@/base/electron";
import log from "@/base/log";
+import {
+ COLLECTION_ROLE,
+ type Collection,
+ CollectionMagicMetadataProps,
+ CollectionPublicMagicMetadataProps,
+ CollectionType,
+} from "@/media/collection";
import { ItemVisibility } from "@/media/file-metadata";
import { getAllLocalFiles, getLocalFiles } from "@/new/photos/services/files";
import { EnteFile } from "@/new/photos/types/file";
@@ -25,13 +32,7 @@ import {
updatePublicCollectionMagicMetadata,
updateSharedCollectionMagicMetadata,
} from "services/collectionService";
-import {
- COLLECTION_ROLE,
- Collection,
- CollectionMagicMetadataProps,
- CollectionPublicMagicMetadataProps,
- CollectionSummaries,
-} from "types/collection";
+import { CollectionSummaries, CollectionSummaryType } from "types/collection";
import { SetFilesDownloadProgressAttributes } from "types/gallery";
import { downloadFilesWithProgress } from "utils/file";
import { isArchivedCollection, updateMagicMetadata } from "utils/magicMetadata";
diff --git a/web/apps/photos/src/utils/magicMetadata/index.ts b/web/apps/photos/src/utils/magicMetadata/index.ts
index 3f2132f82d..467e3cf04c 100644
--- a/web/apps/photos/src/utils/magicMetadata/index.ts
+++ b/web/apps/photos/src/utils/magicMetadata/index.ts
@@ -1,8 +1,8 @@
import { sharedCryptoWorker } from "@/base/crypto";
+import type { Collection } from "@/media/collection";
import { ItemVisibility } from "@/media/file-metadata";
import { EnteFile } from "@/new/photos/types/file";
import { MagicMetadataCore } from "@/new/photos/types/magicMetadata";
-import { Collection } from "types/collection";
export function isArchivedFile(item: EnteFile): boolean {
if (!item || !item.magicMetadata || !item.magicMetadata.data) {
diff --git a/web/apps/photos/src/types/collection/index.ts b/web/packages/media/collection.ts
similarity index 78%
rename from web/apps/photos/src/types/collection/index.ts
rename to web/packages/media/collection.ts
index 0258b34a71..3e60bde054 100644
--- a/web/apps/photos/src/types/collection/index.ts
+++ b/web/packages/media/collection.ts
@@ -1,34 +1,18 @@
import { ItemVisibility } from "@/media/file-metadata";
-import { EnteFile } from "@/new/photos/types/file";
+import type { EnteFile } from "@/new/photos/types/file";
import {
- EncryptedMagicMetadata,
- MagicMetadataCore,
+ type EncryptedMagicMetadata,
+ type MagicMetadataCore,
SUB_TYPE,
} from "@/new/photos/types/magicMetadata";
-export enum CollectionType {
- folder = "folder",
- favorites = "favorites",
- album = "album",
- uncategorized = "uncategorized",
-}
+// TODO: Audit this file
-export enum CollectionSummaryType {
+export enum CollectionType {
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 {
@@ -164,17 +148,3 @@ export interface CollectionPublicMagicMetadataProps {
export type CollectionPublicMagicMetadata =
MagicMetadataCore<CollectionPublicMagicMetadataProps>;
-
-export interface CollectionSummary {
- id: number;
- name: string;
- type: CollectionSummaryType;
- coverFile: EnteFile;
- latestFile: EnteFile;
- fileCount: number;
- updationTime: number;
- order?: number;
-}
-
-export type CollectionSummaries = Map<number, CollectionSummary>;
-export type CollectionFilesCount = Map<number, number>;
diff --git a/web/packages/media/types/file.ts b/web/packages/media/types/file.ts
deleted file mode 100644
index e69de29bb2..0000000000