diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx index 8c3fb45c66..eb102a2481 100644 --- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx +++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx @@ -15,7 +15,6 @@ import UnarchiveIcon from "@mui/icons-material/Unarchive"; import VisibilityOffOutlinedIcon from "@mui/icons-material/VisibilityOffOutlined"; import VisibilityOutlinedIcon from "@mui/icons-material/VisibilityOutlined"; import { Box, IconButton, Menu, Stack, Tooltip } from "@mui/material"; -import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer"; import { assertionFailed } from "ente-base/assert"; import { SpacedRow } from "ente-base/components/containers"; import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator"; @@ -71,7 +70,6 @@ interface CollectionHeaderProps { isActiveCollectionDownloadInProgress: () => boolean; onCollectionShare: () => void; onCollectionCast: () => void; - setCollectionNamerAttributes: SetCollectionNamerAttributes; setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator; } diff --git a/web/apps/photos/src/components/Collections/CollectionNamer.tsx b/web/apps/photos/src/components/Collections/CollectionNamer.tsx deleted file mode 100644 index e3967fa304..0000000000 --- a/web/apps/photos/src/components/Collections/CollectionNamer.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { TitledMiniDialog } from "ente-base/components/MiniDialog"; -import log from "ente-base/log"; -import SingleInputForm, { - type SingleInputFormProps, -} from "ente-shared/components/SingleInputForm"; -import { t } from "i18next"; -import React from "react"; - -export interface CollectionNamerAttributes { - callback: (name: string) => void; - title: string; - autoFilledName: string; - buttonText: string; -} - -export type SetCollectionNamerAttributes = React.Dispatch< - React.SetStateAction ->; - -interface Props { - show: boolean; - onHide: () => void; - attributes: CollectionNamerAttributes; -} - -export default function CollectionNamer({ attributes, ...props }: Props) { - if (!attributes) { - return <>; - } - const onSubmit: SingleInputFormProps["callback"] = async ( - albumName, - setFieldError, - ) => { - try { - attributes.callback(albumName); - props.onHide(); - } catch (e) { - log.error(e); - setFieldError(t("generic_error_retry")); - } - }; - - return ( - - - - ); -} diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx index 232d4ab137..37fc46b1ff 100644 --- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx +++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx @@ -1,5 +1,4 @@ import { AllAlbums } from "components/Collections/AllAlbums"; -import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer"; import { CollectionShare } from "components/Collections/CollectionShare"; import { TimeStampListItem } from "components/FileList"; import { useModalVisibility } from "ente-base/components/utils/modal"; @@ -48,7 +47,6 @@ type CollectionsProps = Omit< activeCollection: Collection; setActiveCollectionID: (collectionID: number) => void; hiddenCollectionSummaries: CollectionSummaries; - setCollectionNamerAttributes: SetCollectionNamerAttributes; setPhotoListHeader: (value: TimeStampListItem) => void; filesDownloadProgressAttributesList: FilesDownloadProgressAttributes[]; setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator; @@ -84,7 +82,6 @@ export const GalleryBarAndListHeader: React.FC = ({ people, activePerson, onSelectPerson, - setCollectionNamerAttributes, setPhotoListHeader, filesDownloadProgressAttributesList, setFilesDownloadProgressAttributesCreator, @@ -145,7 +142,6 @@ export const GalleryBarAndListHeader: React.FC = ({ {...{ activeCollection, setActiveCollectionID, - setCollectionNamerAttributes, setFilesDownloadProgressAttributesCreator, isActiveCollectionDownloadInProgress, }} diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx index 1aaea8f724..4397c23e74 100644 --- a/web/apps/photos/src/components/Upload.tsx +++ b/web/apps/photos/src/components/Upload.tsx @@ -76,7 +76,6 @@ import watcher from "services/watch"; import { SetLoading } from "types/gallery"; import { getOrCreateAlbum } from "utils/collection"; import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery"; -import { SetCollectionNamerAttributes } from "./Collections/CollectionNamer"; import { UploadProgress } from "./UploadProgress"; interface UploadProps { @@ -92,7 +91,6 @@ interface UploadProps { * Close the collection selector if it is open. */ onCloseCollectionSelector?: () => void; - setCollectionNamerAttributes?: SetCollectionNamerAttributes; setLoading: SetLoading; setShouldDisableDropzone: (value: boolean) => void; showCollectionSelector?: () => void; diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx index bdd9ee0e67..5b526f7f49 100644 --- a/web/apps/photos/src/pages/gallery.tsx +++ b/web/apps/photos/src/pages/gallery.tsx @@ -3,9 +3,6 @@ import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined"; import MenuIcon from "@mui/icons-material/Menu"; import { IconButton, Stack, Typography } from "@mui/material"; import { AuthenticateUser } from "components/AuthenticateUser"; -import CollectionNamer, { - CollectionNamerAttributes, -} from "components/Collections/CollectionNamer"; import { GalleryBarAndListHeader } from "components/Collections/GalleryBarAndListHeader"; import { TimeStampListItem } from "components/FileList"; import { FileListWithViewer } from "components/FileListWithViewer"; @@ -194,9 +191,6 @@ const Page: React.FC = () => { context: { mode: "albums", collectionID: ALL_SECTION }, }); const [blockingLoad, setBlockingLoad] = useState(false); - const [collectionNamerAttributes, setCollectionNamerAttributes] = - useState(null); - const [collectionNamerView, setCollectionNamerView] = useState(false); const [shouldDisableDropzone, setShouldDisableDropzone] = useState(false); const [dragAndDropFiles, setDragAndDropFiles] = useState( [], @@ -381,10 +375,6 @@ const Page: React.FC = () => { ); }, [user, normalCollections, familyData]); - useEffect(() => { - collectionNamerAttributes && setCollectionNamerView(true); - }, [collectionNamerAttributes]); - useEffect(() => { if (typeof activeCollectionID == "undefined" || !router.isReady) { return; @@ -461,12 +451,12 @@ const Page: React.FC = () => { // - Any of the modals are open. uploadTypeSelectorView || openCollectionSelector || - collectionNamerView || sidebarVisibilityProps.open || planSelectorVisibilityProps.open || fixCreationTimeVisibilityProps.open || exportVisibilityProps.open || authenticateUserVisibilityProps.open || + albumNameInputVisibilityProps.open || isFileViewerOpen ) { return; @@ -932,11 +922,6 @@ const Page: React.FC = () => { {...planSelectorVisibilityProps} setLoading={(v) => setBlockingLoad(v)} /> - { activeCollection, activeCollectionID, activePerson, - setCollectionNamerAttributes, setPhotoListHeader, setFilesDownloadProgressAttributesCreator, filesDownloadProgressAttributesList, @@ -1064,7 +1048,6 @@ const Page: React.FC = () => { onOpenCollectionSelector={handleOpenCollectionSelector} onCloseCollectionSelector={handleCloseCollectionSelector} setLoading={setBlockingLoad} - setCollectionNamerAttributes={setCollectionNamerAttributes} setShouldDisableDropzone={setShouldDisableDropzone} onUploadFile={(file) => dispatch({ type: "uploadNormalFile", file })