diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsx index 1dac885263..09ca85c1da 100644 --- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx +++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx @@ -1,5 +1,5 @@ -import { CenteredBox } from "@/base/components/mui/Container"; import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator"; +import { CenteredBox } from "@/base/components/mui/Container"; import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton"; import { LoadingButton } from "@/base/components/mui/LoadingButton"; import { @@ -255,9 +255,7 @@ const SuggestionsDialog: React.FC = ({ const [phase, setPhase] = useState< "loading" | "failed" | "saving" | undefined >(); - const [suggestions, setSuggestions] = useState< - PersonSuggestion[] | undefined - >(); + const [suggestions, setSuggestions] = useState([]); const [unsavedChanges /*, setUnsavedChanges */] = useState(false); const isSmallWidth = useIsSmallWidth(); @@ -301,8 +299,11 @@ const SuggestionsDialog: React.FC = ({ useEffect(() => { if (!open) return; + setPhase("loading"); + let ignore = false; - void suggestionsForPerson(person).then((suggestions) => { + void suggestionsForPerson(person).then(async (suggestions) => { + setPhase(undefined); if (!ignore) setSuggestions(suggestions); }); return () => { @@ -311,6 +312,7 @@ const SuggestionsDialog: React.FC = ({ }, [open, person]); console.log({ open, person }); + return ( = ({ maxWidth="sm" fullWidth fullScreen={isSmallWidth} - PaperProps={{ sx: { minHeight: "60svh" } }} + PaperProps={{ sx: { minHeight: "80svh" } }} > {pt(`${person.name}?`)} - {!suggestions ? ( + {phase == "loading" ? ( - {phase == "loading" || true ? ( - {pt("Finding similar faces...")} - ) : ( - - {pt("No more suggestions for now")} - - )} + + {pt("Finding similar faces...")} + + + ) : suggestions.length == 0 ? ( + + + {pt("No more suggestions for now")} + ) : (