This commit is contained in:
Manav Rathi
2024-09-26 17:28:19 +05:30
parent 77cdf673a9
commit c4931de42e
2 changed files with 11 additions and 27 deletions

View File

@@ -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<CGroupPersonOptionsProps> = ({
};
interface ClusterPersonOptionsProps {
person: Person;
cluster: FaceCluster;
appContext: NewAppContextPhotos;
}
const ClusterPersonOptions: React.FC<ClusterPersonOptionsProps> = ({
person,
cluster,
appContext,
}) => {
@@ -135,23 +132,17 @@ const ClusterPersonOptions: React.FC<ClusterPersonOptionsProps> = ({
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 (
<>
<Stack direction="row" sx={{ alignItems: "center", gap: 2 }}>

View File

@@ -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<NameInputDialogProps> = ({
};
return (
<Dialog
open={open}
onClose={onClose}
maxWidth="xs"
fullWidth
TransitionComponent={SlideTransition}
>
<Dialog open={open} onClose={onClose} maxWidth="xs" fullWidth>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<SingleInputForm