Skip to content

Commit 2c31778

Browse files
committed
fix filter options for all programming languages
1 parent 0c7b025 commit 2c31778

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/app/[language]/libraries/page.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function Libraries({
4040
searchParams?: {
4141
programming_language?: string;
4242
algorithm?: keyof LibraryModel["support"];
43-
support?: keyof LibraryModel["support"]
43+
support?: keyof LibraryModel["support"];
4444
};
4545
}) {
4646
const librariesDictionary = getLibrariesDictionary(languageCode);
@@ -57,7 +57,7 @@ export default function Libraries({
5757
const dictionary = JSON.parse(source) as LibraryDictionaryModel;
5858
const allOptions = Object.keys(Object.values(dictionary)[0].libs[0].support);
5959
const indexAlgorithmStart = allOptions.findIndex(
60-
(option) => option == "hs256"
60+
(option) => option === "hs256"
6161
);
6262

6363
const categoryOptions: { id: string; name: string }[] = Object.values(
@@ -81,11 +81,12 @@ export default function Libraries({
8181
label: key.toUpperCase(),
8282
}));
8383

84-
const categories: LibraryCategoryModel[] = programmingLanguage
85-
? [dictionary[programmingLanguage]]
86-
: Object.values(dictionary);
84+
const categories: LibraryCategoryModel[] =
85+
programmingLanguage && programmingLanguage !== "all"
86+
? [dictionary[programmingLanguage]]
87+
: Object.values(dictionary);
8788

88-
const categoryToFilter = algorithm ?? support
89+
const categoryToFilter = algorithm ?? support;
8990

9091
const filteredCategories = categoryToFilter
9192
? categories.map((category) => {

0 commit comments

Comments
 (0)