Skip to content

armgit / ente

Public Imported from GitHub
0

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

remove(UploadProgress):remove-unused-v1-code-from-photos

Aswin Asokc986fc7a44b3
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index 86b250b32d..f69a01886b 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -40,7 +40,6 @@ import type {
CollectionSummary,
} from "ente-new/photos/services/collection-summary";
import { usePhotosAppContext } from "ente-new/photos/types/context";
-import { enableV2 } from "ente-new/photos/utils/feature-flags";
import { t } from "i18next";
import memoize from "memoize-one";
import React, { useEffect, useMemo, useRef, useState } from "react";
@@ -173,7 +172,7 @@ export const AllAlbums: React.FC<AllAlbums> = ({
</AllAlbumsDialog>
<SingleInputDialog
{...albumNameInputVisibilityProps}
- variant={enableV2 ? "v2" : "default"}
+ variant="v2"
title={t("new_album")}
label={t("album_name")}
submitButtonTitle={t("create")}
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index f88e9ac8bc..d1eea1e4e2 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -21,28 +21,10 @@ import {
uploadManager,
} from "@/services/upload-manager";
import watcher from "@/services/watch";
-import { Album02Icon, Folder01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import DiscFullIcon from "@mui/icons-material/DiscFull";
-import GoogleIcon from "@mui/icons-material/Google";
-import {
- Box,
- CircularProgress,
- Dialog,
- DialogTitle,
- Link,
- Stack,
- styled,
- Typography,
- type DialogProps,
-} from "@mui/material";
+import { Dialog, type DialogProps } from "@mui/material";
import type { LocalUser } from "ente-accounts/services/user";
import { isDesktop } from "ente-base/app";
-import { SpacedRow } from "ente-base/components/containers";
-import { DialogCloseIconButton } from "ente-base/components/mui/DialogCloseIconButton";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
-import { RowButton } from "ente-base/components/RowButton";
import { SingleInputDialog } from "ente-base/components/SingleInputDialog";
import {
useModalVisibility,
@@ -65,7 +47,6 @@ import type {
import type { UploadTypeSelectorIntent } from "ente-gallery/components/Upload";
import { UploadProgressV2 } from "ente-gallery/components/upload-progress-v2/UploadProgressV2";
import { CanvasReadbackBlockedDialog } from "ente-gallery/components/upload/CanvasReadbackBlockedDialog";
-import { UploadProgress } from "ente-gallery/components/UploadProgress";
import { useFileInput } from "ente-gallery/components/utils/use-file-input";
import {
groupItemsBasedOnParentFolder,
@@ -108,7 +89,6 @@ import {
} from "ente-new/photos/services/collection";
import { redirectToCustomerPortal } from "ente-new/photos/services/user-details";
import { usePhotosAppContext } from "ente-new/photos/types/context";
-import { enableV2 } from "ente-new/photos/utils/feature-flags";
import { firstNonEmpty } from "ente-utils/array";
import { t } from "i18next";
import React, { useCallback, useEffect, useRef, useState } from "react";
@@ -869,15 +849,6 @@ export const Upload: React.FC<UploadProps> = ({
) => {
if (uploadItemsAndPaths.current !== uploadItemAndPaths) return;
- if (!enableV2) {
- void commitUploadToExistingCollection(
- collection,
- uploadItemAndPaths,
- true,
- );
- return;
- }
-
const isTakeoutHint = containsJSONFiles(uploadItemAndPaths);
if (uploadItemAndPaths.length > 1 || isTakeoutHint)
setUploadConfirmation({
@@ -983,7 +954,6 @@ export const Upload: React.FC<UploadProps> = ({
const uploadItemAndPaths = uploadItemsAndPaths.current;
const isTakeoutHint = containsJSONFiles(uploadItemAndPaths);
if (
- enableV2 &&
!skipConfirmation &&
(uploadItemAndPaths.length > 1 || isTakeoutHint)
)
@@ -1020,7 +990,7 @@ export const Upload: React.FC<UploadProps> = ({
if (uploadItemsAndPaths.current !== uploadItemAndPaths) return;
- if (skipConfirmation || !enableV2) {
+ if (skipConfirmation) {
void commitUploadToNewCollections(
uploadItemAndPaths,
collectionNameToUploadItems,
@@ -1429,63 +1399,44 @@ export const Upload: React.FC<UploadProps> = ({
}
onSelect={handleUploadTypeSelect}
/>
- {enableV2 ? (
- <UploadProgressV2
- open={uploadProgressView}
- onClose={closeUploadProgress}
- percentComplete={percentComplete}
- uploadFileNames={uploadFileNames!}
- uploadCounter={uploadCounter}
- uploadPhase={uploadPhase}
- inProgressUploads={inProgressUploads}
- hasLivePhotos={hasLivePhotos}
- retryFailed={retryFailed}
- finishedUploads={finishedUploads}
- preUploadSkippedFiles={preUploadSkippedFiles}
- cancelUploads={cancelUploads}
- />
- ) : (
- <UploadProgress
- open={uploadProgressView}
- onClose={closeUploadProgress}
- percentComplete={percentComplete}
- uploadFileNames={uploadFileNames!}
- uploadCounter={uploadCounter}
- uploadPhase={uploadPhase}
- inProgressUploads={inProgressUploads}
- hasLivePhotos={hasLivePhotos}
- retryFailed={retryFailed}
- finishedUploads={finishedUploads}
- preUploadSkippedFiles={preUploadSkippedFiles}
- cancelUploads={cancelUploads}
- />
- )}
+ <UploadProgressV2
+ open={uploadProgressView}
+ onClose={closeUploadProgress}
+ percentComplete={percentComplete}
+ uploadFileNames={uploadFileNames!}
+ uploadCounter={uploadCounter}
+ uploadPhase={uploadPhase}
+ inProgressUploads={inProgressUploads}
+ hasLivePhotos={hasLivePhotos}
+ retryFailed={retryFailed}
+ finishedUploads={finishedUploads}
+ preUploadSkippedFiles={preUploadSkippedFiles}
+ cancelUploads={cancelUploads}
+ />
<CanvasReadbackBlockedDialog
open={showCanvasReadbackBlockedDialog}
onClose={() => setShowCanvasReadbackBlockedDialog(false)}
/>
- {enableV2 && (
- <UploadConfirmationDialog
- open={!!uploadConfirmation}
- loading={uploadConfirmation?.phase == "counting"}
- isTakeout={uploadConfirmation?.isTakeout ?? false}
- fileCount={readyConfirmation?.fileCount ?? 0}
- albumCount={readyConfirmation?.albumCount ?? 0}
- importFavorites={readyConfirmation?.importFavorites ?? true}
- onImportFavoritesChange={handleImportFavoritesChange}
- includePartnerSharedFiles={
- readyConfirmation?.includePartnerSharedFiles ?? true
- }
- onIncludePartnerSharedFilesChange={
- handleIncludePartnerSharedFilesChange
- }
- onConfirm={handleUploadConfirm}
- onCancel={cancelPendingUpload}
- />
- )}
+ <UploadConfirmationDialog
+ open={!!uploadConfirmation}
+ loading={uploadConfirmation?.phase == "counting"}
+ isTakeout={uploadConfirmation?.isTakeout ?? false}
+ fileCount={readyConfirmation?.fileCount ?? 0}
+ albumCount={readyConfirmation?.albumCount ?? 0}
+ importFavorites={readyConfirmation?.importFavorites ?? true}
+ onImportFavoritesChange={handleImportFavoritesChange}
+ includePartnerSharedFiles={
+ readyConfirmation?.includePartnerSharedFiles ?? true
+ }
+ onIncludePartnerSharedFilesChange={
+ handleIncludePartnerSharedFilesChange
+ }
+ onConfirm={handleUploadConfirm}
+ onCancel={cancelPendingUpload}
+ />
<SingleInputDialog
{...newAlbumNameInputVisibilityProps}
- variant={enableV2 ? "v2" : "default"}
+ variant="v2"
onClose={handleNewAlbumNameInputClose}
title={t("new_album")}
label={t("album_name")}
@@ -1897,20 +1848,13 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
const handleSelectFolder = () => handleSelect("folders");
return showTakeoutOptions ? (
- enableV2 ? (
- <TakeoutOptionsV2
- onBack={handleTakeoutClose}
- onSelectFolder={handleSelectFolder}
- onSelectZips={handleSelectGooglePhotos}
- {...{ onClose }}
- />
- ) : (
- <TakeoutOptions
- onSelect={handleSelect}
- onClose={handleTakeoutClose}
- />
- )
- ) : enableV2 && intent != "collect" ? (
+ <TakeoutOptionsV2
+ onBack={handleTakeoutClose}
+ onSelectFolder={handleSelectFolder}
+ onSelectZips={handleSelectGooglePhotos}
+ {...{ onClose }}
+ />
+ ) : (
<DefaultOptionsV2
intent={intent}
isFileSelectionPending={pendingUploadType == "files"}
@@ -1920,138 +1864,5 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
onSelectFolder={handleSelectFolder}
{...{ onClose }}
/>
- ) : (
- <DefaultOptions
- {...{ intent, pendingUploadType, onClose }}
- onSelect={handleSelect}
- />
- );
-};
-
-const DefaultOptions: React.FC<
- Pick<
- UploadOptionsProps,
- "intent" | "pendingUploadType" | "onClose" | "onSelect"
- >
-> = ({ intent, pendingUploadType, onClose, onSelect }) => {
- return (
- <>
- <SpacedRow>
- <DialogTitle variant="h5">
- {intent == "collect"
- ? t("select_photos")
- : intent == "import"
- ? t("import")
- : t("upload")}
- </DialogTitle>
- <DialogCloseIconButton {...{ onClose }} />
- </SpacedRow>
- <Box sx={{ p: "12px", pt: "16px" }}>
- <RoundedButtonStack>
- {intent != "import" && (
- <RowButton
- startIcon={
- <HugeiconsIcon icon={Album02Icon} size={20} />
- }
- endIcon={
- pendingUploadType == "files" ? (
- <PendingIndicator />
- ) : (
- <ChevronRightIcon />
- )
- }
- label={t("files")}
- onClick={() => onSelect("files")}
- />
- )}
- <RowButton
- startIcon={
- <HugeiconsIcon icon={Folder01Icon} size={20} />
- }
- endIcon={
- pendingUploadType == "folders" ? (
- <PendingIndicator />
- ) : (
- <ChevronRightIcon />
- )
- }
- label={t("folder")}
- onClick={() => onSelect("folders")}
- />
- {intent != "collect" && (
- <RowButton
- startIcon={<GoogleIcon />}
- endIcon={<ChevronRightIcon />}
- label={t("google_takeout")}
- onClick={() => onSelect("zips")}
- />
- )}
- </RoundedButtonStack>
- <Typography
- sx={{
- color: "text.muted",
- p: "12px",
- pt: "24px",
- textAlign: "center",
- }}
- >
- {t("drag_and_drop_hint")}
- </Typography>
- </Box>
- </>
);
};
-
-const PendingIndicator = () => (
- <CircularProgress size={18} sx={{ color: "stroke.muted" }} />
-);
-
-const TakeoutOptions: React.FC<
- Pick<UploadOptionsProps, "onSelect" | "onClose">
-> = ({ onSelect, onClose }) => (
- <>
- <SpacedRow>
- <DialogTitle variant="h5">{t("google_takeout")}</DialogTitle>
- <DialogCloseIconButton {...{ onClose }} />
- </SpacedRow>
- <Stack sx={{ padding: "18px 12px 20px 12px", gap: "16px" }}>
- <Stack sx={{ gap: "8px", "& button": { borderRadius: "16px" } }}>
- <FocusVisibleButton
- color="accent"
- fullWidth
- onClick={() => onSelect("folders")}
- >
- {t("select_folder")}
- </FocusVisibleButton>
- <FocusVisibleButton
- color="secondary"
- fullWidth
- onClick={() => onSelect("zips")}
- >
- {t("select_zips")}
- </FocusVisibleButton>
- <Link
- href="https://ente.com/help/photos/migration/from-google-photos/"
- target="_blank"
- rel="noopener"
- >
- <FocusVisibleButton color="secondary" fullWidth>
- {t("faq")}
- </FocusVisibleButton>
- </Link>
- </Stack>
- <Typography variant="small" sx={{ color: "text.muted" }}>
- {t("takeout_hint")}
- </Typography>
- </Stack>
- </>
-);
-
-const RoundedButtonStack = styled("div")`
- display: flex;
- flex-direction: column;
- gap: 4px;
- & > button {
- border-radius: 16px;
- }
-`;
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index efcd95dc7c..4f33884cbd 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -79,7 +79,6 @@ import {
} from "ente-new/photos/components/SelectedFileOptions";
import { WhatsNew } from "ente-new/photos/components/WhatsNew";
import {
- GalleryEmptyState,
GalleryEmptyStateV2,
PeopleEmptyState,
SearchResultsHeader,
@@ -130,7 +129,6 @@ import {
addManualFileAssignmentsToPerson,
isMLEnabled,
} from "ente-new/photos/services/ml";
-import { enableV2 } from "ente-new/photos/utils/feature-flags";
import { uploadManager } from "@/services/upload-manager";
import watcher from "@/services/watch";
@@ -2218,17 +2216,10 @@ const Page: React.FC = () => {
!isFirstLoad &&
!state.collectionFiles.length &&
activeCollectionID === PseudoCollectionID.all ? (
- enableV2 ? (
- <GalleryEmptyStateV2
- isUploadInProgress={uploadManager.isUploadInProgress()}
- onUpload={openUploader}
- />
- ) : (
- <GalleryEmptyState
- isUploadInProgress={uploadManager.isUploadInProgress()}
- onUpload={openUploader}
- />
- )
+ <GalleryEmptyStateV2
+ isUploadInProgress={uploadManager.isUploadInProgress()}
+ onUpload={openUploader}
+ />
) : !isInSearchMode &&
!isFirstLoad &&
state.view?.type == "people" &&
@@ -2317,7 +2308,7 @@ const Page: React.FC = () => {
/>
<SingleInputDialog
{...albumNameInputVisibilityProps}
- variant={enableV2 ? "v2" : "default"}
+ variant="v2"
title={t("new_album")}
label={t("album_name")}
submitButtonTitle={t("create")}
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 515d9e0da1..769dd91d3b 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -47,7 +47,6 @@
"password_mismatch_error": "Passwords don't match",
"show_or_hide_password": "Show or hide password",
"welcome_to_ente_title": "Welcome to <a/>",
- "welcome_to_ente_subtitle": "End to end encrypted photo storage and sharing",
"new_album": "New album",
"create_albums": "Create albums",
"album_name": "Album name",
@@ -195,7 +194,6 @@
"title_accounts": "Ente Accounts",
"title_locker": "Ente Locker",
"upload_first_photo": "Upload your first photo",
- "import_your_folders": "Import your folders",
"upload_dropzone_hint": "Drop to backup your files",
"upload_dropzone_hint_public_album": "Drop to add your photos",
"watch_folder_dropzone_hint": "Drop to add watched folder",
@@ -541,9 +539,7 @@
"disable_two_factor_message": "Are you sure you want to disable your two-factor authentication",
"export_data": "Export data",
"select_folder": "Select folder",
- "select_zips": "Select zips",
"faq": "FAQ",
- "takeout_hint": "Unzip all zips into the same folder and upload that. Or upload the zips directly. See FAQ for details.",
"destination": "Destination",
"start": "Start",
"last_export_time": "Last export time",
diff --git a/web/packages/gallery/components/Upload.tsx b/web/packages/gallery/components/Upload.tsx
index 7f723875cf..5333f212d0 100644
--- a/web/packages/gallery/components/Upload.tsx
+++ b/web/packages/gallery/components/Upload.tsx
@@ -4,4 +4,4 @@
*
* The "intent" does not change the eventual upload outcome, only the UX flow.
*/
-export type UploadTypeSelectorIntent = "upload" | "import" | "collect";
+export type UploadTypeSelectorIntent = "upload" | "import";
diff --git a/web/packages/new/photos/components/CollectionSelector.tsx b/web/packages/new/photos/components/CollectionSelector.tsx
index 511cc5a939..3ddd37d4a3 100644
--- a/web/packages/new/photos/components/CollectionSelector.tsx
+++ b/web/packages/new/photos/components/CollectionSelector.tsx
@@ -1,50 +1,7 @@
-import CloseIcon from "@mui/icons-material/Close";
-import FavoriteIcon from "@mui/icons-material/Favorite";
-import PushPinIcon from "@mui/icons-material/PushPin";
-import SearchIcon from "@mui/icons-material/Search";
-import {
- Box,
- Dialog,
- DialogContent,
- DialogTitle,
- Divider,
- InputAdornment,
- Stack,
- styled,
- TextField,
- Tooltip,
- Typography,
- useMediaQuery,
-} from "@mui/material";
-import { FilledIconButton } from "ente-base/components/mui";
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 {
- ItemCard,
- LargeTileButton,
- LargeTileCreateNewButton,
- LargeTileTextOverlay,
-} from "ente-new/photos/components/Tiles";
-import {
- canAddToCollection,
- canMoveToCollection,
- collectionsSortBy,
- sortCollectionSummaries,
- type CollectionsSortBy,
- type CollectionSummaries,
- type CollectionSummary,
-} from "ente-new/photos/services/collection-summary";
-import { enableV2 } from "ente-new/photos/utils/feature-flags";
-import { includes } from "ente-utils/type-guards";
-import { t } from "i18next";
-import React, {
- useCallback,
- useEffect,
- useMemo,
- useRef,
- useState,
-} from "react";
+import type { CollectionSummaries } from "ente-new/photos/services/collection-summary";
+import React from "react";
import { CollectionSelectorV2 } from "./CollectionSelectorV2";
export type CollectionSelectorAction =
@@ -140,412 +97,9 @@ export type CollectionSelectorProps = ModalVisibilityProps & {
/**
* A dialog allowing the user to select one of their existing collections or
* create a new one.
- *
- * The shared Photos UI flag chooses the restyled
- * {@link CollectionSelectorV2} variant or the classic implementation below.
- * Both share the exact same props and behaviour.
*/
export const CollectionSelector: React.FC<CollectionSelectorProps> = (
props,
) => {
- return enableV2 ? (
- <CollectionSelectorV2 {...props} />
- ) : (
- <CollectionSelectorClassic {...props} />
- );
-};
-
-const CollectionSelectorClassic: React.FC<CollectionSelectorProps> = ({
- open,
- onClose,
- onExited,
- attributes,
- collectionSummaries,
- collectionForCollectionSummaryID,
-}) => {
- // Make the dialog fullscreen if the screen is <= the dialog's max width.
- const isFullScreen = useMediaQuery("(max-width: 490px)");
-
- const [searchTerm, setSearchTerm] = useState("");
- const [sortBy, setSortBy] =
- useCollectionSelectorSortByLocalState("name-asc");
-
- const [filteredCollections, setFilteredCollections] = useState<
- CollectionSummary[]
- >([]);
-
- const handleExited = useCallback(() => {
- setSearchTerm("");
- onExited?.();
- }, [onExited]);
-
- useEffect(() => {
- if (!attributes || !open) {
- return;
- }
-
- const activeCollectionID = attributes.activeCollectionID;
- const filteredCollections = [...collectionSummaries.values()].filter(
- (cs) => {
- if (cs.id === attributes.sourceCollectionSummaryID) {
- return false;
- } else if (
- attributes.action == "add" ||
- attributes.action == "move"
- ) {
- return canAddToCollection(cs) && cs.type != "userFavorites";
- } else if (attributes.action == "upload") {
- return (
- (canAddToCollection(cs) ||
- cs.type == "uncategorized") &&
- cs.type != "userFavorites"
- );
- } else if (attributes.action == "restore") {
- return (
- (canMoveToCollection(cs) ||
- cs.type == "uncategorized") &&
- cs.type != "userFavorites"
- );
- } else {
- // "unhide"
- return (
- canMoveToCollection(cs) && cs.type != "userFavorites"
- );
- }
- },
- );
-
- const collections = sortCollectionSummaries(filteredCollections, sortBy)
- .sort((a, b) => b.sortPriority - a.sortPriority)
- .sort((a, b) => {
- // Prioritize the active collection (if any) to appear first.
- if (a.id === activeCollectionID) return -1;
- if (b.id === activeCollectionID) return 1;
- return 0;
- });
-
- if (collections.length === 0) {
- onClose();
- attributes.onCreateCollection();
- handleExited();
- }
-
- setFilteredCollections(collections);
- }, [collectionSummaries, attributes, open, onClose, sortBy, handleExited]);
-
- const searchFilteredCollections = useMemo(() => {
- if (!searchTerm.trim()) {
- return filteredCollections;
- }
- const searchLower = searchTerm.toLowerCase();
- return filteredCollections.filter((cs) =>
- cs.name.toLowerCase().includes(searchLower),
- );
- }, [filteredCollections, searchTerm]);
-
- const showCreateButton = useMemo(() => {
- if (!searchTerm.trim()) {
- return true;
- }
- const searchLower = searchTerm.toLowerCase();
- const createText = t("create_albums").toLowerCase();
- return createText.includes(searchLower);
- }, [searchTerm]);
-
- if (!filteredCollections.length) {
- return <></>;
- }
-
- if (!attributes) {
- return <></>;
- }
-
- const { action, onSelectCollection, onCancel, onCreateCollection } =
- attributes;
-
- const handleCollectionSummaryClick = async (id: number) => {
- onSelectCollection(await collectionForCollectionSummaryID(id));
- onClose();
- };
-
- const handleClose = () => {
- onCancel?.();
- onClose();
- };
-
- return (
- <StyledDialog
- open={open}
- onClose={handleClose}
- fullWidth
- fullScreen={isFullScreen}
- slotProps={{
- paper: {
- sx: {
- maxWidth: "500px",
- "@media (min-width: 491px)": { height: "100%" },
- },
- },
- transition: { onExited: handleExited },
- }}
- >
- <DialogTitle>
- <Stack sx={{ gap: 1.5 }}>
- <Stack direction="row" sx={{ gap: 1.5 }}>
- <Stack sx={{ flex: 1 }}>
- <Box>
- <Typography variant="h5">
- {titleForAction(action)}
- </Typography>
- <Typography
- variant="small"
- sx={{
- color: "text.muted",
- fontWeight: "regular",
- }}
- >
- {searchTerm
- ? `${searchFilteredCollections.length} / ${filteredCollections.length} ${t("albums")}`
- : t("albums_count", {
- count: filteredCollections.length,
- })}
- </Typography>
- </Box>
- </Stack>
- <CollectionsSortOptions
- activeSortBy={sortBy}
- onChangeSortBy={setSortBy}
- nestedInDialog
- />
- <FilledIconButton onClick={handleClose}>
- <CloseIcon />
- </FilledIconButton>
- </Stack>
- <SearchField value={searchTerm} onChange={setSearchTerm} />
- </Stack>
- </DialogTitle>
- <Divider />
- {searchFilteredCollections.length === 0 && !showCreateButton ? (
- <NoResultsContent>
- <Typography sx={{ color: "text.muted" }}>
- {t("no_results")}
- </Typography>
- </NoResultsContent>
- ) : (
- <DialogContent_>
- {showCreateButton && (
- <LargeTileCreateNewButton onClick={onCreateCollection}>
- {t("create_albums")}
- </LargeTileCreateNewButton>
- )}
- {searchFilteredCollections.map((collectionSummary) => (
- <CollectionSummaryButton
- key={collectionSummary.id}
- collectionSummary={collectionSummary}
- onClick={handleCollectionSummaryClick}
- />
- ))}
- </DialogContent_>
- )}
- </StyledDialog>
- );
-};
-
-const StyledDialog = styled(Dialog)(({ theme }) => ({
- "& .MuiDialogTitle-root": { padding: theme.spacing(2) },
- "& .MuiDialogContent-root": { padding: theme.spacing(2) },
-}));
-
-const DialogContent_ = styled(DialogContent)`
- display: grid;
- grid-template-columns: repeat(auto-fill, 150px);
- gap: 4px;
- align-content: start;
-
- @media (min-width: 491px) {
- justify-content: center;
- }
-`;
-
-const NoResultsContent = styled(DialogContent)`
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 154px;
-`;
-
-const titleForAction = (action: CollectionSelectorAction) => {
- switch (action) {
- case "upload":
- return t("upload_to_album");
- case "add":
- return t("add_to_album");
- case "move":
- return t("move_to_album");
- case "restore":
- return t("restore_to_album");
- case "unhide":
- return t("unhide_to_album");
- }
-};
-
-interface CollectionSummaryButtonProps {
- collectionSummary: CollectionSummary;
- onClick: (collectionSummaryID: number) => void;
-}
-
-const CollectionSummaryButton: React.FC<CollectionSummaryButtonProps> = ({
- collectionSummary,
- onClick,
-}) => {
- const isFavorite = collectionSummary.type === "userFavorites";
- const isPinned =
- collectionSummary.attributes.has("pinned") ||
- collectionSummary.attributes.has("shareePinned");
-
- return (
- <ItemCard
- TileComponent={LargeTileButton}
- coverFile={collectionSummary.coverFile}
- onClick={() => onClick(collectionSummary.id)}
- >
- <LargeTileTextOverlay>
- <Tooltip title={collectionSummary.name} arrow>
- <Typography
- sx={{
- maxWidth: "240px",
- overflow: "hidden",
- textOverflow: "ellipsis",
- display: "-webkit-box",
- WebkitLineClamp: 3,
- WebkitBoxOrient: "vertical",
- }}
- >
- {collectionSummary.name}
- </Typography>
- </Tooltip>
- </LargeTileTextOverlay>
- {(isFavorite || isPinned) && (
- <Box
- sx={{
- position: "absolute",
- bottom: 8,
- right: 8,
- display: "flex",
- gap: 0.5,
- }}
- >
- {isFavorite && (
- <FavoriteIcon sx={{ fontSize: 20, color: "white" }} />
- )}
- {isPinned && (
- <PushPinIcon sx={{ fontSize: 20, color: "white" }} />
- )}
- </Box>
- )}
- </ItemCard>
- );
-};
-
-interface SearchFieldProps {
- value: string;
- onChange: (value: string) => void;
-}
-
-const SearchField: React.FC<SearchFieldProps> = ({ value, onChange }) => {
- const inputRef = useRef<HTMLInputElement>(null);
-
- const handleClear = () => {
- onChange("");
- inputRef.current?.focus();
- };
-
- return (
- <TextField
- inputRef={inputRef}
- fullWidth
- size="small"
- placeholder={t("albums_search_hint")}
- value={value}
- onChange={(e) => onChange(e.target.value)}
- autoFocus
- slotProps={{
- input: {
- startAdornment: (
- <InputAdornment position="start">
- <SearchIcon />
- </InputAdornment>
- ),
- endAdornment: value && (
- <InputAdornment
- position="end"
- sx={{ marginRight: "0 !important" }}
- >
- <CloseIcon
- fontSize="small"
- onClick={handleClear}
- sx={{
- color: "stroke.muted",
- cursor: "pointer",
- "&:hover": { color: "text.base" },
- }}
- />
- </InputAdornment>
- ),
- },
- }}
- sx={{
- "& .MuiOutlinedInput-root": {
- backgroundColor: "background.searchInput",
- borderColor: "transparent",
- "&:hover": { borderColor: "accent.light" },
- "&.Mui-focused": {
- borderColor: "accent.main",
- boxShadow: "none",
- },
- },
- "& .MuiInputBase-input": {
- color: "text.base",
- paddingTop: "8.5px !important",
- paddingBottom: "8.5px !important",
- },
- "& .MuiInputAdornment-root": {
- color: "stroke.muted",
- marginTop: "0 !important",
- marginRight: "8px",
- },
- "& .MuiOutlinedInput-notchedOutline": {
- borderColor: "transparent",
- },
- "& .MuiInputBase-input::placeholder": {
- color: "text.muted",
- opacity: 1,
- },
- }}
- />
- );
-};
-
-/**
- * A hook that maintains the collection selector sort order both as in-memory
- * and local storage state.
- */
-const useCollectionSelectorSortByLocalState = (
- initialValue: CollectionsSortBy,
-) => {
- const key = "collectionSelectorSortBy";
-
- const [value, setValue] = useState(initialValue);
-
- useEffect(() => {
- const value = localStorage.getItem(key);
- if (value && includes(collectionsSortBy, value)) setValue(value);
- }, []);
-
- const setter = (value: CollectionsSortBy) => {
- localStorage.setItem(key, value);
- setValue(value);
- };
-
- return [value, setter] as const;
+ return <CollectionSelectorV2 {...props} />;
};
diff --git a/web/packages/new/photos/components/gallery/index.tsx b/web/packages/new/photos/components/gallery/index.tsx
index addc542bdb..11b3915763 100644
--- a/web/packages/new/photos/components/gallery/index.tsx
+++ b/web/packages/new/photos/components/gallery/index.tsx
@@ -7,29 +7,22 @@
* there.
*/
-import AddPhotoAlternateIcon from "@mui/icons-material/AddPhotoAlternateOutlined";
import CheckIcon from "@mui/icons-material/Check";
-import FolderIcon from "@mui/icons-material/FolderOutlined";
import SortIcon from "@mui/icons-material/Sort";
import {
IconButton,
Menu,
Paper,
Stack,
- styled,
Tooltip,
Typography,
} from "@mui/material";
import { CenteredFill, SpacedRow } from "ente-base/components/containers";
-import { EnteLogo } from "ente-base/components/EnteLogo";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import { OverflowMenuOption } from "ente-base/components/OverflowMenu";
import { useModalVisibility } from "ente-base/components/utils/modal";
-import type { UploadTypeSelectorIntent } from "ente-gallery/components/Upload";
import type { SearchSuggestion } from "ente-new/photos/services/search/types";
import { t } from "i18next";
import React, { useRef, useState } from "react";
-import { Trans } from "react-i18next";
import { enableML } from "../../services/ml";
import { EnableML, FaceConsent } from "../sidebar/MLSettings";
import { useMLStatusSnapshot } from "../utils/use-snapshot";
@@ -222,94 +215,6 @@ const SearchSortOrderMenu: React.FC<SearchSortOrderMenuProps> = ({
);
};
-interface GalleryEmptyStateProps {
- /**
- * If `true`, then an upload is already in progress (the empty state will
- * then disable the prompts for uploads).
- */
- isUploadInProgress: boolean;
- /**
- * Called when the user selects one of the upload buttons. It is passed the
- * "intent" of the user.
- */
- onUpload: (intent: UploadTypeSelectorIntent) => void;
-}
-
-export const GalleryEmptyState: React.FC<GalleryEmptyStateProps> = ({
- isUploadInProgress,
- onUpload,
-}) => (
- <Stack sx={{ alignItems: "center" }}>
- <Stack
- sx={{
- alignItems: "center",
- textAlign: "center",
- paddingBlock: "12px 32px",
- userSelect: "none",
- }}
- >
- <Typography
- variant="h3"
- sx={{
- color: "text.muted",
- mb: 1,
- svg: {
- color: "text.base",
- verticalAlign: "middle",
- mb: "2px",
- },
- }}
- >
- <Trans
- i18nKey="welcome_to_ente_title"
- components={{ a: <EnteLogo /> }}
- />
- </Typography>
- <Typography variant="h2">
- {t("welcome_to_ente_subtitle")}
- </Typography>
- </Stack>
- <NonDraggableImage
- height={287.57}
- alt=""
- src="/images/empty-state/ente_duck.png"
- srcSet="/images/empty-state/[email protected], /images/empty-state/[email protected]"
- />
- <Stack sx={{ py: 3, width: 320, gap: 1 }}>
- <FocusVisibleButton
- color="accent"
- onClick={() => onUpload("upload")}
- disabled={isUploadInProgress}
- sx={{ p: 1 }}
- >
- <Stack direction="row" sx={{ gap: 1, alignItems: "center" }}>
- <AddPhotoAlternateIcon />
- {t("upload_first_photo")}
- </Stack>
- </FocusVisibleButton>
- <FocusVisibleButton
- onClick={() => onUpload("import")}
- disabled={isUploadInProgress}
- sx={{ p: 1 }}
- >
- <Stack direction="row" sx={{ gap: 1, alignItems: "center" }}>
- <FolderIcon />
- {t("import_your_folders")}
- </Stack>
- </FocusVisibleButton>
- </Stack>
- </Stack>
-);
-
-/**
- * Prevent the image from being selected _and_ dragged, since dragging it
- * triggers the our dropdown selector overlay.
- */
-const NonDraggableImage = styled("img")`
- pointer-events: none;
- user-select: none;
-`;
-
export const PeopleEmptyState: React.FC = () => {
const mlStatus = useMLStatusSnapshot();
diff --git a/web/packages/new/photos/utils/feature-flags.ts b/web/packages/new/photos/utils/feature-flags.ts
deleted file mode 100644
index b0803117ce..0000000000
--- a/web/packages/new/photos/utils/feature-flags.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Shared rollout switch for the Photos V2 UI.
- *
- * Keep this in one module so the app and shared Photos components cannot end
- * up rendering a mixed V1/V2 flow.
- */
-export const enableV2 = true as boolean;