diff --git a/web/src/app/[locale]/result/[id]/page.tsx b/web/src/app/[locale]/result/[id]/page.tsx index d94f6ea12..0b10c9b4e 100644 --- a/web/src/app/[locale]/result/[id]/page.tsx +++ b/web/src/app/[locale]/result/[id]/page.tsx @@ -61,8 +61,23 @@ interface ResultsProps { showExpanded?: boolean; } +const sortResultsInOrder = (results: Domain[]): Domain[] => { + const desiredOrder = ['O', 'C', 'E', 'A', 'N']; + + const domainMap = new Map(); + results.forEach(result => { + domainMap.set(result.domain, result); + }); + + return desiredOrder + .map(domain => domainMap.get(domain)) + .filter((domain): domain is Domain => domain !== undefined); +}; + const Results = ({ report, showExpanded }: ResultsProps) => { const t = useTranslations('results'); + + const sortedResults = sortResultsInOrder(report.results); return ( <> @@ -100,12 +115,12 @@ const Results = ({ report, showExpanded }: ResultsProps) => {

{t('theBigFive')}

- + ); -}; +}; \ No newline at end of file