From 02005b47f47ad1a33f12fbcacb2b2ec1c6a5bab2 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 30 Sep 2024 03:45:54 +0200 Subject: [PATCH] Sort sources by name in source page --- src/screens/Sources.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/screens/Sources.tsx b/src/screens/Sources.tsx index 8dc61ee9..f474d862 100644 --- a/src/screens/Sources.tsx +++ b/src/screens/Sources.tsx @@ -38,7 +38,9 @@ function sourceToLangList(sources: Pick[]) { return [...result].sort(langSortCmp); } -function groupByLang>(sources: Source[]): Record { +function groupByLang>( + sources: Source[], +): Record { const result: Record = {}; sources.forEach((source) => { @@ -49,6 +51,8 @@ function groupByLang>(sources: So result[lang].push(source); }); + Object.values(result).forEach((langSources) => langSources.sort((a, b) => a.name.localeCompare(b.name))); + return result; }