|
@@ -1,82 +1,36 @@
|
|
-import {
|
|
|
|
- SESSION_KEYS,
|
|
|
|
- clearKeys,
|
|
|
|
- getKey,
|
|
|
|
-} from "@ente/shared/storage/sessionStorage";
|
|
|
|
-import { Typography, styled } from "@mui/material";
|
|
|
|
-import { t } from "i18next";
|
|
|
|
-import { useRouter } from "next/router";
|
|
|
|
-import {
|
|
|
|
- createContext,
|
|
|
|
- useContext,
|
|
|
|
- useEffect,
|
|
|
|
- useMemo,
|
|
|
|
- useRef,
|
|
|
|
- useState,
|
|
|
|
-} from "react";
|
|
|
|
-import {
|
|
|
|
- constructEmailList,
|
|
|
|
- createAlbum,
|
|
|
|
- getAllLatestCollections,
|
|
|
|
- getAllLocalCollections,
|
|
|
|
- getCollectionSummaries,
|
|
|
|
- getFavItemIds,
|
|
|
|
- getHiddenItemsSummary,
|
|
|
|
- getSectionSummaries,
|
|
|
|
-} from "services/collectionService";
|
|
|
|
-import { getLocalFiles, syncFiles } from "services/fileService";
|
|
|
|
-
|
|
|
|
-import { checkSubscriptionPurchase } from "utils/billing";
|
|
|
|
-
|
|
|
|
-import EnteSpinner from "@ente/shared/components/EnteSpinner";
|
|
|
|
-import {
|
|
|
|
- isFirstLogin,
|
|
|
|
- justSignedUp,
|
|
|
|
- setIsFirstLogin,
|
|
|
|
- setJustSignedUp,
|
|
|
|
-} from "@ente/shared/storage/localStorage/helpers";
|
|
|
|
-import CollectionSelector, {
|
|
|
|
- CollectionSelectorAttributes,
|
|
|
|
-} from "components/Collections/CollectionSelector";
|
|
|
|
-import FullScreenDropZone from "components/FullScreenDropZone";
|
|
|
|
-import { LoadingOverlay } from "components/LoadingOverlay";
|
|
|
|
-import PhotoFrame from "components/PhotoFrame";
|
|
|
|
-import Sidebar from "components/Sidebar";
|
|
|
|
-import SelectedFileOptions from "components/pages/gallery/SelectedFileOptions";
|
|
|
|
-import { useDropzone } from "react-dropzone";
|
|
|
|
-import {
|
|
|
|
- isTokenValid,
|
|
|
|
- syncMapEnabled,
|
|
|
|
- validateKey,
|
|
|
|
-} from "services/userService";
|
|
|
|
-import { preloadImage } from "utils/common";
|
|
|
|
-import {
|
|
|
|
- FILE_OPS_TYPE,
|
|
|
|
- constructFileToCollectionMap,
|
|
|
|
- getSelectedFiles,
|
|
|
|
- getUniqueFiles,
|
|
|
|
- handleFileOps,
|
|
|
|
- mergeMetadata,
|
|
|
|
- sortFiles,
|
|
|
|
-} from "utils/file";
|
|
|
|
-
|
|
|
|
import log from "@/next/log";
|
|
import log from "@/next/log";
|
|
import { APPS } from "@ente/shared/apps/constants";
|
|
import { APPS } from "@ente/shared/apps/constants";
|
|
import { CenteredFlex } from "@ente/shared/components/Container";
|
|
import { CenteredFlex } from "@ente/shared/components/Container";
|
|
|
|
+import EnteSpinner from "@ente/shared/components/EnteSpinner";
|
|
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
|
|
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
|
|
import { CustomError } from "@ente/shared/error";
|
|
import { CustomError } from "@ente/shared/error";
|
|
-import useFileInput from "@ente/shared/hooks/useFileInput";
|
|
|
|
|
|
+import { useFileInput } from "@ente/shared/hooks/useFileInput";
|
|
import useMemoSingleThreaded from "@ente/shared/hooks/useMemoSingleThreaded";
|
|
import useMemoSingleThreaded from "@ente/shared/hooks/useMemoSingleThreaded";
|
|
import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
|
|
import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore";
|
|
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
|
|
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
|
|
-import { getToken } from "@ente/shared/storage/localStorage/helpers";
|
|
|
|
|
|
+import {
|
|
|
|
+ getToken,
|
|
|
|
+ isFirstLogin,
|
|
|
|
+ justSignedUp,
|
|
|
|
+ setIsFirstLogin,
|
|
|
|
+ setJustSignedUp,
|
|
|
|
+} from "@ente/shared/storage/localStorage/helpers";
|
|
|
|
+import {
|
|
|
|
+ SESSION_KEYS,
|
|
|
|
+ clearKeys,
|
|
|
|
+ getKey,
|
|
|
|
+} from "@ente/shared/storage/sessionStorage";
|
|
import { User } from "@ente/shared/user/types";
|
|
import { User } from "@ente/shared/user/types";
|
|
import { isPromise } from "@ente/shared/utils";
|
|
import { isPromise } from "@ente/shared/utils";
|
|
|
|
+import { Typography, styled } from "@mui/material";
|
|
import AuthenticateUserModal from "components/AuthenticateUserModal";
|
|
import AuthenticateUserModal from "components/AuthenticateUserModal";
|
|
import Collections from "components/Collections";
|
|
import Collections from "components/Collections";
|
|
import CollectionNamer, {
|
|
import CollectionNamer, {
|
|
CollectionNamerAttributes,
|
|
CollectionNamerAttributes,
|
|
} from "components/Collections/CollectionNamer";
|
|
} from "components/Collections/CollectionNamer";
|
|
|
|
+import CollectionSelector, {
|
|
|
|
+ CollectionSelectorAttributes,
|
|
|
|
+} from "components/Collections/CollectionSelector";
|
|
import ExportModal from "components/ExportModal";
|
|
import ExportModal from "components/ExportModal";
|
|
import {
|
|
import {
|
|
FilesDownloadProgress,
|
|
FilesDownloadProgress,
|
|
@@ -85,13 +39,18 @@ import {
|
|
import FixCreationTime, {
|
|
import FixCreationTime, {
|
|
FixCreationTimeAttributes,
|
|
FixCreationTimeAttributes,
|
|
} from "components/FixCreationTime";
|
|
} from "components/FixCreationTime";
|
|
|
|
+import FullScreenDropZone from "components/FullScreenDropZone";
|
|
import GalleryEmptyState from "components/GalleryEmptyState";
|
|
import GalleryEmptyState from "components/GalleryEmptyState";
|
|
|
|
+import { LoadingOverlay } from "components/LoadingOverlay";
|
|
|
|
+import PhotoFrame from "components/PhotoFrame";
|
|
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
|
|
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
|
|
import SearchResultInfo from "components/Search/SearchResultInfo";
|
|
import SearchResultInfo from "components/Search/SearchResultInfo";
|
|
|
|
+import Sidebar from "components/Sidebar";
|
|
import Uploader from "components/Upload/Uploader";
|
|
import Uploader from "components/Upload/Uploader";
|
|
-import UploadInputs from "components/UploadSelectorInputs";
|
|
|
|
|
|
+import { UploadSelectorInputs } from "components/UploadSelectorInputs";
|
|
import { GalleryNavbar } from "components/pages/gallery/Navbar";
|
|
import { GalleryNavbar } from "components/pages/gallery/Navbar";
|
|
import PlanSelector from "components/pages/gallery/PlanSelector";
|
|
import PlanSelector from "components/pages/gallery/PlanSelector";
|
|
|
|
+import SelectedFileOptions from "components/pages/gallery/SelectedFileOptions";
|
|
import {
|
|
import {
|
|
ALL_SECTION,
|
|
ALL_SECTION,
|
|
ARCHIVE_SECTION,
|
|
ARCHIVE_SECTION,
|
|
@@ -100,15 +59,42 @@ import {
|
|
TRASH_SECTION,
|
|
TRASH_SECTION,
|
|
} from "constants/collection";
|
|
} from "constants/collection";
|
|
import { SYNC_INTERVAL_IN_MICROSECONDS } from "constants/gallery";
|
|
import { SYNC_INTERVAL_IN_MICROSECONDS } from "constants/gallery";
|
|
|
|
+import { t } from "i18next";
|
|
|
|
+import { useRouter } from "next/router";
|
|
import { AppContext } from "pages/_app";
|
|
import { AppContext } from "pages/_app";
|
|
|
|
+import {
|
|
|
|
+ createContext,
|
|
|
|
+ useContext,
|
|
|
|
+ useEffect,
|
|
|
|
+ useMemo,
|
|
|
|
+ useRef,
|
|
|
|
+ useState,
|
|
|
|
+} from "react";
|
|
|
|
+import { useDropzone } from "react-dropzone";
|
|
import { clipService } from "services/clip-service";
|
|
import { clipService } from "services/clip-service";
|
|
-import { constructUserIDToEmailMap } from "services/collectionService";
|
|
|
|
|
|
+import {
|
|
|
|
+ constructEmailList,
|
|
|
|
+ constructUserIDToEmailMap,
|
|
|
|
+ createAlbum,
|
|
|
|
+ getAllLatestCollections,
|
|
|
|
+ getAllLocalCollections,
|
|
|
|
+ getCollectionSummaries,
|
|
|
|
+ getFavItemIds,
|
|
|
|
+ getHiddenItemsSummary,
|
|
|
|
+ getSectionSummaries,
|
|
|
|
+} from "services/collectionService";
|
|
import downloadManager from "services/download";
|
|
import downloadManager from "services/download";
|
|
import { syncEmbeddings, syncFileEmbeddings } from "services/embeddingService";
|
|
import { syncEmbeddings, syncFileEmbeddings } from "services/embeddingService";
|
|
import { syncEntities } from "services/entityService";
|
|
import { syncEntities } from "services/entityService";
|
|
|
|
+import { getLocalFiles, syncFiles } from "services/fileService";
|
|
import locationSearchService from "services/locationSearchService";
|
|
import locationSearchService from "services/locationSearchService";
|
|
import { getLocalTrashedFiles, syncTrash } from "services/trashService";
|
|
import { getLocalTrashedFiles, syncTrash } from "services/trashService";
|
|
import uploadManager from "services/upload/uploadManager";
|
|
import uploadManager from "services/upload/uploadManager";
|
|
|
|
+import {
|
|
|
|
+ isTokenValid,
|
|
|
|
+ syncMapEnabled,
|
|
|
|
+ validateKey,
|
|
|
|
+} from "services/userService";
|
|
import { Collection, CollectionSummaries } from "types/collection";
|
|
import { Collection, CollectionSummaries } from "types/collection";
|
|
import { EnteFile } from "types/file";
|
|
import { EnteFile } from "types/file";
|
|
import {
|
|
import {
|
|
@@ -120,6 +106,7 @@ import {
|
|
} from "types/gallery";
|
|
} from "types/gallery";
|
|
import { Search, SearchResultSummary, UpdateSearch } from "types/search";
|
|
import { Search, SearchResultSummary, UpdateSearch } from "types/search";
|
|
import { FamilyData } from "types/user";
|
|
import { FamilyData } from "types/user";
|
|
|
|
+import { checkSubscriptionPurchase } from "utils/billing";
|
|
import {
|
|
import {
|
|
COLLECTION_OPS_TYPE,
|
|
COLLECTION_OPS_TYPE,
|
|
constructCollectionNameMap,
|
|
constructCollectionNameMap,
|
|
@@ -131,6 +118,16 @@ import {
|
|
splitNormalAndHiddenCollections,
|
|
splitNormalAndHiddenCollections,
|
|
} from "utils/collection";
|
|
} from "utils/collection";
|
|
import ComlinkSearchWorker from "utils/comlink/ComlinkSearchWorker";
|
|
import ComlinkSearchWorker from "utils/comlink/ComlinkSearchWorker";
|
|
|
|
+import { preloadImage } from "utils/common";
|
|
|
|
+import {
|
|
|
|
+ FILE_OPS_TYPE,
|
|
|
|
+ constructFileToCollectionMap,
|
|
|
|
+ getSelectedFiles,
|
|
|
|
+ getUniqueFiles,
|
|
|
|
+ handleFileOps,
|
|
|
|
+ mergeMetadata,
|
|
|
|
+ sortFiles,
|
|
|
|
+} from "utils/file";
|
|
import { isArchivedFile } from "utils/magicMetadata";
|
|
import { isArchivedFile } from "utils/magicMetadata";
|
|
import { getSessionExpiredMessage } from "utils/ui";
|
|
import { getSessionExpiredMessage } from "utils/ui";
|
|
import { getLocalFamilyData } from "utils/user/family";
|
|
import { getLocalFamilyData } from "utils/user/family";
|
|
@@ -201,8 +198,11 @@ export default function Gallery() {
|
|
const [isPhotoSwipeOpen, setIsPhotoSwipeOpen] = useState(false);
|
|
const [isPhotoSwipeOpen, setIsPhotoSwipeOpen] = useState(false);
|
|
|
|
|
|
const {
|
|
const {
|
|
|
|
+ // A function to call to get the props we should apply to the container,
|
|
getRootProps: getDragAndDropRootProps,
|
|
getRootProps: getDragAndDropRootProps,
|
|
|
|
+ // ... the props we should apply to the <input> element,
|
|
getInputProps: getDragAndDropInputProps,
|
|
getInputProps: getDragAndDropInputProps,
|
|
|
|
+ // ... and the files that we got.
|
|
acceptedFiles: dragAndDropFiles,
|
|
acceptedFiles: dragAndDropFiles,
|
|
} = useDropzone({
|
|
} = useDropzone({
|
|
noClick: true,
|
|
noClick: true,
|
|
@@ -210,23 +210,23 @@ export default function Gallery() {
|
|
disabled: shouldDisableDropzone,
|
|
disabled: shouldDisableDropzone,
|
|
});
|
|
});
|
|
const {
|
|
const {
|
|
- selectedFiles: fileSelectorFiles,
|
|
|
|
- open: openFileSelector,
|
|
|
|
getInputProps: getFileSelectorInputProps,
|
|
getInputProps: getFileSelectorInputProps,
|
|
|
|
+ openSelector: openFileSelector,
|
|
|
|
+ selectedFiles: fileSelectorFiles,
|
|
} = useFileInput({
|
|
} = useFileInput({
|
|
directory: false,
|
|
directory: false,
|
|
});
|
|
});
|
|
const {
|
|
const {
|
|
- selectedFiles: folderSelectorFiles,
|
|
|
|
- open: openFolderSelector,
|
|
|
|
getInputProps: getFolderSelectorInputProps,
|
|
getInputProps: getFolderSelectorInputProps,
|
|
|
|
+ openSelector: openFolderSelector,
|
|
|
|
+ selectedFiles: folderSelectorFiles,
|
|
} = useFileInput({
|
|
} = useFileInput({
|
|
directory: true,
|
|
directory: true,
|
|
});
|
|
});
|
|
const {
|
|
const {
|
|
- selectedFiles: fileSelectorZipFiles,
|
|
|
|
- open: openZipFileSelector,
|
|
|
|
getInputProps: getZipFileSelectorInputProps,
|
|
getInputProps: getZipFileSelectorInputProps,
|
|
|
|
+ openSelector: openZipFileSelector,
|
|
|
|
+ selectedFiles: fileSelectorZipFiles,
|
|
} = useFileInput({
|
|
} = useFileInput({
|
|
directory: false,
|
|
directory: false,
|
|
accept: ".zip",
|
|
accept: ".zip",
|
|
@@ -1013,14 +1013,14 @@ export default function Gallery() {
|
|
setSelectedFiles: setSelected,
|
|
setSelectedFiles: setSelected,
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <FullScreenDropZone
|
|
|
|
- getDragAndDropRootProps={getDragAndDropRootProps}
|
|
|
|
- >
|
|
|
|
- <UploadInputs
|
|
|
|
- getDragAndDropInputProps={getDragAndDropInputProps}
|
|
|
|
- getFileSelectorInputProps={getFileSelectorInputProps}
|
|
|
|
- getFolderSelectorInputProps={getFolderSelectorInputProps}
|
|
|
|
- getZipFileSelectorInputProps={getZipFileSelectorInputProps}
|
|
|
|
|
|
+ <FullScreenDropZone {...{ getDragAndDropRootProps }}>
|
|
|
|
+ <UploadSelectorInputs
|
|
|
|
+ {...{
|
|
|
|
+ getDragAndDropInputProps,
|
|
|
|
+ getFileSelectorInputProps,
|
|
|
|
+ getFolderSelectorInputProps,
|
|
|
|
+ getZipFileSelectorInputProps,
|
|
|
|
+ }}
|
|
/>
|
|
/>
|
|
{blockingLoad && (
|
|
{blockingLoad && (
|
|
<LoadingOverlay>
|
|
<LoadingOverlay>
|