sort volunteers alphabetically in team assign

This commit is contained in:
memeriau
2022-04-18 13:58:22 +02:00
parent 11f6c36b16
commit 7b9507ca35
4 changed files with 12 additions and 6 deletions

View File

@@ -60,3 +60,9 @@ export const selectVolunteerList = createSelector(
return ids.map((id) => entities[id]) as Volunteer[]
}
)
const fullName = (volunteer: Volunteer) => `${volunteer.firstname} ${volunteer.lastname}`
export const selectVolunteerListAlphaSorted = createSelector(selectVolunteerList, (volunteer) =>
[...volunteer].sort((vA, vB) => fullName(vA).localeCompare(fullName(vB)))
)