Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tweak

Manav Rathi6f84371cfa95
diff --git a/web/packages/new/photos/components/PeopleList.tsx b/web/packages/new/photos/components/PeopleList.tsx
index bc660578f1..8737ec326a 100644
--- a/web/packages/new/photos/components/PeopleList.tsx
+++ b/web/packages/new/photos/components/PeopleList.tsx
@@ -6,31 +6,26 @@ import { Skeleton, Typography, styled } from "@mui/material";
import { t } from "i18next";
import React, { useEffect, useState } from "react";
-export interface PeopleListProps {
- /** The list of {@link Person} entities to show. */
+export interface SearchPeopleListProps {
people: Person[];
- /** Limit to display to whatever fits within {@link maxRows} rows. */
- maxRows: number;
- /** Optional callback invoked when a particular person is selected. */
- onSelect?: (person: Person, index: number) => void;
+ onSelectPerson: (person: Person) => void;
}
/**
- * Shows a list of {@link Person} (named cluster groups).
+ * Shows a list of {@link Person}s in the empty state of the search bar.
*/
-export const PeopleList: React.FC<PeopleListProps> = ({
+export const SearchPeopleList: React.FC<SearchPeopleListProps> = ({
people,
- maxRows,
- onSelect,
+ onSelectPerson,
}) => {
const isMobileWidth = useIsMobileWidth();
// TODO-Cluster: FaceCropImageView has hardcoded placeholder dimensions
return (
- <SearchFaceChipContainer style={{ maxHeight: maxRows * 87 + 28 }}>
- {people.slice(0, isMobileWidth ? 6 : 7).map((person, index) => (
+ <SearchFaceChipContainer>
+ {people.slice(0, isMobileWidth ? 6 : 7).map((person) => (
<SearchFaceChip
key={person.id}
- onClick={() => onSelect && onSelect(person, index)}
+ onClick={() => onSelectPerson(person)}
>
<FaceCropImageView
faceID={person.displayFaceID}
@@ -59,7 +54,7 @@ const SearchFaceChip = styled("div")`
height: 87px;
border-radius: 50%;
overflow: hidden;
- cursor: "pointer";
+ cursor: pointer;
& > img {
width: 100%;
height: 100%;
diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/packages/new/photos/components/SearchBar.tsx
index 0e3c4b53f8..4ab56b6f97 100644
--- a/web/packages/new/photos/components/SearchBar.tsx
+++ b/web/packages/new/photos/components/SearchBar.tsx
@@ -8,6 +8,7 @@ import {
peopleSnapshot,
peopleSubscribe,
} from "@/new/photos/services/ml";
+import type { Person } from "@/new/photos/services/ml/cgroups";
import { searchOptionsForString } from "@/new/photos/services/search";
import type { SearchOption } from "@/new/photos/services/search/types";
import { nullToUndefined } from "@/utils/transform";
@@ -40,7 +41,7 @@ import {
type StylesConfig,
} from "react-select";
import AsyncSelect from "react-select/async";
-import { PeopleList } from "./PeopleList";
+import { SearchPeopleList } from "./PeopleList";
export interface SearchBarProps {
/**
@@ -394,20 +395,22 @@ const EmptyState: React.FC<EmptyStateProps> = () => {
break;
}
+ const handleSelectPerson = (person: Person) => console.log(person);
+
return (
<Box sx={{ textAlign: "left" }}>
{people && people.length > 0 && (
<>
<PeopleHeader />
- <PeopleList
+ <SearchPeopleList
people={people}
- maxRows={2}
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- onSelect={(...args: any) => console.log(args)}
+ onSelectPerson={handleSelectPerson}
/>
</>
)}
- <Typography variant="mini">{label}</Typography>
+ <Typography variant="mini" sx={{ my: "2px" }}>
+ {label}
+ </Typography>
</Box>
);
};