From c4931de42e4057c72b8bbb1cd8f4883f193ce22e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 26 Sep 2024 17:28:19 +0530 Subject: [PATCH] Add --- .../new/photos/components/Gallery/index.tsx | 29 +++++++------------ .../new/photos/components/NameInputDialog.tsx | 9 +----- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/web/packages/new/photos/components/Gallery/index.tsx b/web/packages/new/photos/components/Gallery/index.tsx index f65c98c378..c0de350e97 100644 --- a/web/packages/new/photos/components/Gallery/index.tsx +++ b/web/packages/new/photos/components/Gallery/index.tsx @@ -10,7 +10,6 @@ import { pt } from "@/base/i18n"; import { addPerson, type Person } from "@/new/photos/services/ml/people"; import type { SearchOption } from "@/new/photos/services/search/types"; -import { wait } from "@/utils/promise"; import OverflowMenu from "@ente/shared/components/OverflowMenu/menu"; import { OverflowMenuOption } from "@ente/shared/components/OverflowMenu/option"; import AddIcon from "@mui/icons-material/Add"; @@ -18,7 +17,7 @@ import EditIcon from "@mui/icons-material/Edit"; import MoreHoriz from "@mui/icons-material/MoreHoriz"; import { IconButton, Stack, Tooltip, Typography } from "@mui/material"; import { t } from "i18next"; -import React, { useCallback, useState } from "react"; +import React, { useState } from "react"; import type { FaceCluster } from "../../services/ml/cluster"; import type { CGroupUserEntity } from "../../services/user-entity"; import type { NewAppContextPhotos } from "../../types/context"; @@ -121,13 +120,11 @@ const CGroupPersonOptions: React.FC = ({ }; interface ClusterPersonOptionsProps { - person: Person; cluster: FaceCluster; appContext: NewAppContextPhotos; } const ClusterPersonOptions: React.FC = ({ - person, cluster, appContext, }) => { @@ -135,23 +132,17 @@ const ClusterPersonOptions: React.FC = ({ const [openAddNameInput, setOpenAddNameInput] = useState(false); - const addPersonWithName = useCallback( - async (name: string) => { - startLoading(); - try { - console.log("adding", name, person); - await wait(2000); - throw new Error("test"); - await addPerson(name, { id: "", faces: [] } /* TODO-Cluster*/); - } finally { - finishLoading(); - } - }, - [person, startLoading, finishLoading], - ); - const handleAddPerson = () => setOpenAddNameInput(true); + const addPersonWithName = async (name: string) => { + startLoading(); + try { + await addPerson(name, cluster); + } finally { + finishLoading(); + } + }; + return ( <> diff --git a/web/packages/new/photos/components/NameInputDialog.tsx b/web/packages/new/photos/components/NameInputDialog.tsx index 0cdc3daab9..0c46346c30 100644 --- a/web/packages/new/photos/components/NameInputDialog.tsx +++ b/web/packages/new/photos/components/NameInputDialog.tsx @@ -6,7 +6,6 @@ import { Dialog, DialogContent, DialogTitle } from "@mui/material"; import { t } from "i18next"; import React from "react"; import type { DialogVisiblityProps } from "./mui-custom"; -import { SlideTransition } from "./SlideTransition"; type NameInputDialogProps = DialogVisiblityProps & { /** Title of the dialog. */ @@ -54,13 +53,7 @@ export const NameInputDialog: React.FC = ({ }; return ( - + {title}