Sort sources by name in source page
This commit is contained in:
@@ -38,7 +38,9 @@ function sourceToLangList(sources: Pick<SourceType, 'id' | 'lang'>[]) {
|
|||||||
return [...result].sort(langSortCmp);
|
return [...result].sort(langSortCmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupByLang<Source extends Pick<SourceType, 'id' | 'lang'>>(sources: Source[]): Record<string, Source[]> {
|
function groupByLang<Source extends Pick<SourceType, 'id' | 'name' | 'lang'>>(
|
||||||
|
sources: Source[],
|
||||||
|
): Record<string, Source[]> {
|
||||||
const result: Record<string, Source[]> = {};
|
const result: Record<string, Source[]> = {};
|
||||||
|
|
||||||
sources.forEach((source) => {
|
sources.forEach((source) => {
|
||||||
@@ -49,6 +51,8 @@ function groupByLang<Source extends Pick<SourceType, 'id' | 'lang'>>(sources: So
|
|||||||
result[lang].push(source);
|
result[lang].push(source);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Object.values(result).forEach((langSources) => langSources.sort((a, b) => a.name.localeCompare(b.name)));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user