id is enough
This commit is contained in:
@@ -38,7 +38,6 @@ import {
|
||||
getLocalTrashedFiles,
|
||||
sortFiles,
|
||||
} from "@/new/photos/services/files";
|
||||
import type { Person } from "@/new/photos/services/ml/people";
|
||||
import {
|
||||
filterSearchableFiles,
|
||||
setSearchCollectionsAndFiles,
|
||||
@@ -855,9 +854,9 @@ export default function Gallery() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelectPerson = (person: Person | undefined) =>
|
||||
person
|
||||
? dispatch({ type: "showPerson", personID: person.id })
|
||||
const handleSelectPerson = (personID: string | undefined) =>
|
||||
personID
|
||||
? dispatch({ type: "showPerson", personID })
|
||||
: dispatch({ type: "showPeople" });
|
||||
|
||||
const handleOpenCollectionSelector = useCallback(
|
||||
|
||||
@@ -8,7 +8,7 @@ import { UnstyledButton } from "./UnstyledButton";
|
||||
|
||||
export interface SearchPeopleListProps {
|
||||
people: Person[];
|
||||
onSelectPerson: (person: Person) => void;
|
||||
onSelectPerson: (personID: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ export const SearchPeopleList: React.FC<SearchPeopleListProps> = ({
|
||||
{people.slice(0, isSmallWidth ? 6 : 7).map((person) => (
|
||||
<SearchPersonButton
|
||||
key={person.id}
|
||||
onClick={() => onSelectPerson(person)}
|
||||
onClick={() => onSelectPerson(person.id)}
|
||||
>
|
||||
<FaceCropImageView
|
||||
faceID={person.displayFaceID}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { assertionFailed } from "@/base/assert";
|
||||
import { useIsSmallWidth } from "@/base/hooks";
|
||||
import { ItemCard, PreviewItemTile } from "@/new/photos/components/Tiles";
|
||||
import { isMLSupported, mlStatusSnapshot } from "@/new/photos/services/ml";
|
||||
import type { Person } from "@/new/photos/services/ml/people";
|
||||
import { searchOptionsForString } from "@/new/photos/services/search";
|
||||
import type { SearchOption } from "@/new/photos/services/search/types";
|
||||
import { nullToUndefined } from "@/utils/transform";
|
||||
@@ -72,10 +71,10 @@ export interface SearchBarProps {
|
||||
* Called when the user selects a person shown in the empty state view, or
|
||||
* clicks the people list header itself.
|
||||
*
|
||||
* @param person The selected person, or `undefined` if the user clicked the
|
||||
* generic people header.
|
||||
* @param personID The person ID of the selected person, or `undefined` if
|
||||
* the user clicked the generic "People" header.
|
||||
*/
|
||||
onSelectPerson: (person: Person | undefined) => void;
|
||||
onSelectPerson: (personID: string | undefined) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,9 +184,9 @@ const SearchInput: React.FC<Omit<SearchBarProps, "onShowSearchInput">> = ({
|
||||
onSelectSearchOption(undefined);
|
||||
};
|
||||
|
||||
const handleSelectPerson = (person: Person | undefined) => {
|
||||
const handleSelectPerson = (personID: string | undefined) => {
|
||||
resetSearch();
|
||||
onSelectPerson(person);
|
||||
onSelectPerson(personID);
|
||||
};
|
||||
|
||||
const handleFocus = () => {
|
||||
|
||||
@@ -95,10 +95,9 @@ export interface GalleryBarImplProps {
|
||||
*/
|
||||
activePerson: Person | undefined;
|
||||
/**
|
||||
* Called when the selection should be moved to a new person in the bar, or
|
||||
* reset to the default state (when {@link person} is `undefined`).
|
||||
* Called when the selection should be moved to a new person in the bar.
|
||||
*/
|
||||
onSelectPerson: (person: Person | undefined) => void;
|
||||
onSelectPerson: (personID: string) => void;
|
||||
}
|
||||
|
||||
export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
|
||||
@@ -423,7 +422,7 @@ type ItemData =
|
||||
type: "people";
|
||||
people: Person[];
|
||||
activePerson: Person | undefined;
|
||||
onSelectPerson: (person: Person) => void;
|
||||
onSelectPerson: (personID: string) => void;
|
||||
};
|
||||
|
||||
const getItemCount = (data: ItemData) => {
|
||||
@@ -578,7 +577,7 @@ const ActiveIndicator = styled("div")`
|
||||
interface PersonCardProps {
|
||||
person: Person;
|
||||
activePerson: Person | undefined;
|
||||
onSelectPerson: (person: Person) => void;
|
||||
onSelectPerson: (personID: string) => void;
|
||||
}
|
||||
|
||||
const PersonCard: React.FC<PersonCardProps> = ({
|
||||
@@ -591,7 +590,7 @@ const PersonCard: React.FC<PersonCardProps> = ({
|
||||
TileComponent={BarItemTile}
|
||||
coverFile={person.displayFaceFile}
|
||||
coverFaceID={person.displayFaceID}
|
||||
onClick={() => onSelectPerson(person)}
|
||||
onClick={() => onSelectPerson(person.id)}
|
||||
>
|
||||
{person.name && <CardText>{person.name}</CardText>}
|
||||
</ItemCard>
|
||||
|
||||
Reference in New Issue
Block a user