diff --git a/src/components/modals/ModalPersonEdit.tsx b/src/components/modals/ModalPersonEdit.tsx index 2402ac8e..c42f9ea7 100644 --- a/src/components/modals/ModalPersonEdit.tsx +++ b/src/components/modals/ModalPersonEdit.tsx @@ -29,7 +29,9 @@ export function ModalPersonEdit(props: Props) { let filteredPeopleList = people; if (newPersonName.length > 0) { - filteredPeopleList = people.filter(el => fuzzyMatch(newPersonName, el.text)); + filteredPeopleList = people + .filter(el => fuzzyMatch(newPersonName, el.text)) + .sort((a, b) => b.face_count - a.face_count); } const selectedImageIDs = selectedFaces.map(face => face.face_url); @@ -112,26 +114,29 @@ export function ModalPersonEdit(props: Props) { > {filteredPeopleList.length > 0 && filteredPeopleList.map(item => ( - + { + dispatch( + api.endpoints.setFacesPersonLabel.initiate({ faceIds: selectedFaceIDs, personName: item.text }) + ); + showNotification({ + message: i18n.t("toasts.addfacestoperson", { + numberOfFaces: selectedFaceIDs.length, + personName: item.text, + }), + title: i18n.t("toasts.addfacestopersontitle"), + color: "teal", + }); + onRequestClose(); + }} + style={{cursor: 'pointer'}} + >
{ - dispatch( - api.endpoints.setFacesPersonLabel.initiate({ faceIds: selectedFaceIDs, personName: item.text }) - ); - showNotification({ - message: i18n.t<string>("toasts.addfacestoperson", { - numberOfFaces: selectedFaceIDs.length, - personName: item.text, - }), - title: i18n.t<string>("toasts.addfacestopersontitle"), - color: "teal", - }); - onRequestClose(); - }} > {item.text}