From 15f947ed9423df20073c4a6d109c4a4720daf088 Mon Sep 17 00:00:00 2001 From: Jeff Sieu Date: Sun, 6 Nov 2022 13:27:53 +0800 Subject: [PATCH] [questions][fix] sort RoleTypeahead output --- .../components/questions/typeahead/RoleTypeahead.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/portal/src/components/questions/typeahead/RoleTypeahead.tsx b/apps/portal/src/components/questions/typeahead/RoleTypeahead.tsx index f22538c8..d0b62149 100644 --- a/apps/portal/src/components/questions/typeahead/RoleTypeahead.tsx +++ b/apps/portal/src/components/questions/typeahead/RoleTypeahead.tsx @@ -11,13 +11,15 @@ export type RoleTypeaheadProps = Omit< 'label' | 'onQueryChange' | 'options' >; -const ROLES: FilterChoices = Object.entries(JobTitleLabels).map( - ([slug, { label }]) => ({ +const ROLES: FilterChoices = Object.entries(JobTitleLabels) + .map(([slug, { label, ranking }]) => ({ id: slug, label, + ranking, value: slug, - }), -); + })) + .sort((a, b) => b.ranking - a.ranking); + export default function RoleTypeahead(props: RoleTypeaheadProps) { const [query, setQuery] = useState('');