fix(web): whitespace in person name (#5401)

* fix(web): whitespace in person name

* pr feedback
This commit is contained in:
martin
2023-11-30 04:08:54 +01:00
committed by GitHub
parent 8b6a79ad9e
commit b396e0eee3
3 changed files with 36 additions and 17 deletions

View File

@@ -35,6 +35,7 @@
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
import { mdiPlus, mdiDotsVertical, mdiArrowLeft } from '@mdi/js';
import { isExternalUrl } from '$lib/utils/navigation';
import { searchNameLocal } from '$lib/utils/person';
export let data: PageData;
@@ -110,17 +111,7 @@
$: {
if (people) {
suggestedPeople = !name
? []
: people
.filter((person: PersonResponseDto) => {
const nameParts = person.name.split(' ');
return (
nameParts.some((splitName) => splitName.toLowerCase().startsWith(name.toLowerCase())) &&
person.id !== data.person.id
);
})
.slice(0, 5);
suggestedPeople = !name ? [] : searchNameLocal(name, people, 5, data.person.id);
}
}