diff --git a/web/src/components/listInfoDrawer/ListInfoDrawer.tsx b/web/src/components/listInfoDrawer/ListInfoDrawer.tsx
index 58bf43443..c0584e3eb 100644
--- a/web/src/components/listInfoDrawer/ListInfoDrawer.tsx
+++ b/web/src/components/listInfoDrawer/ListInfoDrawer.tsx
@@ -46,7 +46,7 @@ export const ListInfoDrawer = (props: RouteComponentProps & Props) => {
const list = useListDetails(props.listId);
const listLanguage = props.languages.filter((l) =>
- list?.iso6391s.includes(l.iso6391)
+ list?.languageIds.includes(l.id)
);
const listTags = props.tags.filter((t) => list?.tagIds.includes(t.id));
const listLicense = props.licenses.find((l) => l.id === list?.licenseId);
diff --git a/web/src/components/listsTable/ListsTable.tsx b/web/src/components/listsTable/ListsTable.tsx
index 611148821..8d2d3ad06 100644
--- a/web/src/components/listsTable/ListsTable.tsx
+++ b/web/src/components/listsTable/ListsTable.tsx
@@ -22,7 +22,7 @@ import { Software } from "../../interfaces/Software";
import { Syntax } from "../../interfaces/Syntax";
import { TagCloud } from "../tagCloud";
import { Tag as TagInterface } from "../../interfaces/Tag";
-import { arraySorter, languageArraySorter } from "./arraySorter";
+import { arraySorter } from "./arraySorter";
import { nameof } from "../../utils";
import { TablePaginationConfig } from "antd/lib/table";
import { SyntaxTag } from "../SyntaxTag";
@@ -225,9 +225,9 @@ export const ListsTable = (props: RouteComponentProps & Props) => {
title="Languages"
key="Languages"
- dataIndex={nameof("iso6391s")}
+ dataIndex={nameof("languageIds")}
sorter={(a, b) =>
- languageArraySorter(a.iso6391s, b.iso6391s, languages)
+ arraySorter(a.languageIds, b.languageIds, languages)
}
width={129}
filters={languages.map((l) => ({
@@ -237,22 +237,24 @@ export const ListsTable = (props: RouteComponentProps & Props) => {
{l.name} (
{
visibleLists.filter(
- (li) => li.iso6391s && li.iso6391s.includes(l.iso6391)
+ (li) => li.languageIds && li.languageIds.includes(l.id)
).length
}
)
>
),
- value: l.iso6391.toString(),
+ value: l.id,
}))}
onFilter={(value, record) =>
- record.iso6391s ? record.iso6391s.includes(value as string) : false
+ record.languageIds
+ ? record.languageIds.includes(value as number)
+ : false
}
- render={(languageIds: string[]) =>
+ render={(languageIds: number[]) =>
languageIds ? (
- languageIds.includes(l.iso6391)
+ languageIds.includes(l.id)
)}
/>
) : null
diff --git a/web/src/components/listsTable/arraySorter.ts b/web/src/components/listsTable/arraySorter.ts
index e09246b94..17a5a8a62 100644
--- a/web/src/components/listsTable/arraySorter.ts
+++ b/web/src/components/listsTable/arraySorter.ts
@@ -1,5 +1,3 @@
-import { Language } from "../../interfaces/Language";
-
interface ArraySortableEntity {
id: number;
name: string;
@@ -30,29 +28,3 @@ export const arraySorter = (
: 1
: -1
: 1;
-
-export const languageArraySorter = (
- a: string[],
- b: string[],
- entities: Language[]
-) =>
- a && a.length
- ? b && b.length
- ? a.length === b.length
- ? entities
- .filter((e: Language) => a.includes(e.iso6391))
- .map((e: Language) => e.name)
- .join()
- .toLowerCase() >
- entities
- .filter((e: Language) => b.includes(e.iso6391))
- .map((e: Language) => e.name)
- .join()
- .toLowerCase()
- ? 1
- : -1
- : a.length > b.length
- ? -1
- : 1
- : -1
- : 1;
diff --git a/web/src/interfaces/Language.ts b/web/src/interfaces/Language.ts
index f08db784b..1f02265f2 100644
--- a/web/src/interfaces/Language.ts
+++ b/web/src/interfaces/Language.ts
@@ -1,4 +1,5 @@
export interface Language {
+ id: number;
iso6391: string;
name: string;
filterListIds: number[];
diff --git a/web/src/interfaces/List.ts b/web/src/interfaces/List.ts
index 51e4e024e..61c6d9f16 100644
--- a/web/src/interfaces/List.ts
+++ b/web/src/interfaces/List.ts
@@ -4,7 +4,7 @@
description?: string;
licenseId?: number;
syntaxIds: number[];
- iso6391s: string[];
+ languageIds: number[];
tagIds: number[];
maintainerIds: number[];
diff --git a/web/src/interfaces/ListDetails.ts b/web/src/interfaces/ListDetails.ts
index 46b631e3a..13ccf6317 100644
--- a/web/src/interfaces/ListDetails.ts
+++ b/web/src/interfaces/ListDetails.ts
@@ -4,7 +4,7 @@
description?: string;
licenseId?: number;
syntaxIds: number[];
- iso6391s: string[];
+ languageIds: number[];
tagIds: number[];
viewUrls: ViewUrl[];
homeUrl?: string;