From 32477dd8a482e44d7ed768b03eb87a89b2f73b11 Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:58:38 -0500 Subject: [PATCH 01/10] add constants for filtering by algorithm and programming language --- src/libs/config/project.constants.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/config/project.constants.ts b/src/libs/config/project.constants.ts index e5cad71b..bd458300 100644 --- a/src/libs/config/project.constants.ts +++ b/src/libs/config/project.constants.ts @@ -1,6 +1,8 @@ export const BASE_URL = "https://jwt.io"; export const LIBRARIES_FILTER_QUERY_PARAM_KEY = "filter"; export const LIBRARIES_FILTER_DEFAULT_VALUE = "all"; +export const LIBRARIES_FILTER_PROGRAMMING_LANGUAGE_KEY = "programming_language" +export const LIBRARIES_FILTER_ALGORITHM_KEY = "algorithm" export enum SupportedTokenHashParamValues { TOKEN = "token", ACCESS_TOKEN = "access_token", From 856a1389fd9e7706dc3278ae36982576f97dba5f Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:59:16 -0500 Subject: [PATCH 02/10] add library filter label model --- src/features/libraries/models/library-filters.model.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/features/libraries/models/library-filters.model.ts diff --git a/src/features/libraries/models/library-filters.model.ts b/src/features/libraries/models/library-filters.model.ts new file mode 100644 index 00000000..6fc31739 --- /dev/null +++ b/src/features/libraries/models/library-filters.model.ts @@ -0,0 +1 @@ +export type LibraryFilterLabel = "ProgrammingLanguage" | "Algorithm" \ No newline at end of file From 631f21a666786edab862428d3653806f2083a1ed Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:00:54 -0500 Subject: [PATCH 03/10] add options to library hero to support grouped selections --- .../library-hero/library-hero.component.tsx | 71 +++++++++++++------ 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/src/features/libraries/components/library-hero/library-hero.component.tsx b/src/features/libraries/components/library-hero/library-hero.component.tsx index fccdde2a..a1517531 100644 --- a/src/features/libraries/components/library-hero/library-hero.component.tsx +++ b/src/features/libraries/components/library-hero/library-hero.component.tsx @@ -3,17 +3,23 @@ import React, { useMemo } from "react"; import styles from "./library-hero.module.scss"; import { BoxComponent } from "@/features/common/components/box/box.component"; -import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { LIBRARIES_FILTER_QUERY_PARAM_KEY } from "@/libs/config/project.constants"; +import { usePathname, useRouter } from "next/navigation"; +import { + LIBRARIES_FILTER_ALGORITHM_KEY, + LIBRARIES_FILTER_PROGRAMMING_LANGUAGE_KEY, +} from "@/libs/config/project.constants"; import { clsx } from "clsx"; import { getLocalizedSecondaryFont } from "@/libs/theme/fonts"; import { LibrariesDictionaryModel } from "@/features/localization/models/libraries-dictionary.model"; import { DebuggerPickerComponent } from "@/features/common/components/debugger-picker/debugger-picker.component"; +import { LibraryFilterLabel } from "../../models/library-filters.model"; +import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; interface LibraryHeroComponentProps { languageCode: string; query: string; categoryOptions: { id: string; name: string }[]; + algorithmOptions: { value: string; label: string }[]; dictionary: LibrariesDictionaryModel; } @@ -21,41 +27,60 @@ export const LibraryHeroComponent: React.FC = ({ languageCode, query, categoryOptions, + algorithmOptions, dictionary, }) => { - const searchParams = useSearchParams(); const pathname = usePathname(); const { replace } = useRouter(); - const handleSelection = (selection: string) => { - const params = new URLSearchParams(searchParams); - - if (selection) { - params.set(LIBRARIES_FILTER_QUERY_PARAM_KEY, selection); - } else { - params.delete(LIBRARIES_FILTER_QUERY_PARAM_KEY); + const handleSelection = ( + selection: string, + parentLabel?: LibraryFilterLabel + ) => { + if (!parentLabel) { + return; + } + const params = new URLSearchParams(""); + switch (parentLabel) { + case "ProgrammingLanguage": + params.set(LIBRARIES_FILTER_PROGRAMMING_LANGUAGE_KEY, selection); + break; + case "Algorithm": + params.set(LIBRARIES_FILTER_ALGORITHM_KEY, selection); + break; + default: + break; } - replace(`${pathname}?${params.toString()}`); }; const options = useMemo(() => { return [ { - value: dictionary.filterPicker.defaultValue.value, - label: dictionary.filterPicker.defaultValue.label, + label: "ProgrammingLanguage", + options: [ + { + value: dictionary.filterPicker.defaultValue.value, + label: dictionary.filterPicker.defaultValue.label, + }, + ...categoryOptions.map((categoryOption) => { + return { + value: categoryOption.id, + label: categoryOption.name, + }; + }), + ], + }, + { + label: "Algorithm", + options: [...algorithmOptions], }, - ...categoryOptions.map((categoryOption) => { - return { - value: categoryOption.id, - label: categoryOption.name, - }; - }), - ]; + ] as DebuggerPickerOptionModel[]; }, [ categoryOptions, dictionary.filterPicker.defaultValue.label, dictionary.filterPicker.defaultValue.value, + algorithmOptions ]); return ( @@ -67,7 +92,7 @@ export const LibraryHeroComponent: React.FC = ({

{dictionary.title} @@ -80,7 +105,9 @@ export const LibraryHeroComponent: React.FC = ({ languageCode={languageCode} options={options} selectedOptionCode={ - options.filter((option) => option.value === query)[0] + options + .flatMap((group) => group.options) + .filter((option) => option.value === query)[0] } handleSelection={handleSelection} placeholder={null} From 597aa73b96cc9de0740a34920cc52008c92024e3 Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:01:32 -0500 Subject: [PATCH 04/10] update debugger picker option model to handle multiple selections --- .../common/models/debugger-picker-option.model.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/features/common/models/debugger-picker-option.model.ts b/src/features/common/models/debugger-picker-option.model.ts index 15b9b7f6..a9020e5c 100644 --- a/src/features/common/models/debugger-picker-option.model.ts +++ b/src/features/common/models/debugger-picker-option.model.ts @@ -1,5 +1,10 @@ +import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model"; + export interface DebuggerPickerOptionModel { - value: any; - label: string; - isDisabled?: boolean; + label: LibraryFilterLabel; + options: { + value: any; + label: string; + isDisabled?: boolean + }[]; } From 54cc5d2c3f8466fb6a15070e0d5ebd65cce75205 Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:02:05 -0500 Subject: [PATCH 05/10] update handleChange function to support grouped selections --- .../debugger-picker/debugger-picker.component.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/features/common/components/debugger-picker/debugger-picker.component.tsx b/src/features/common/components/debugger-picker/debugger-picker.component.tsx index 818819ee..3ef481d7 100644 --- a/src/features/common/components/debugger-picker/debugger-picker.component.tsx +++ b/src/features/common/components/debugger-picker/debugger-picker.component.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react"; import styles from "./debugger-picker.module.scss"; import Select, { SingleValue } from "react-select"; import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; +import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model"; interface PickerLabelProps { label: string | null; @@ -19,8 +20,8 @@ interface DebuggerPickerComponentProps { label: string | null; languageCode: string; options: DebuggerPickerOptionModel[]; - selectedOptionCode: DebuggerPickerOptionModel | null; - handleSelection: (value: string) => void; + selectedOptionCode: DebuggerPickerOptionModel["options"][0] | null; + handleSelection: (selection: string, parentLabel?: LibraryFilterLabel) => void placeholder: string | null; minWidth: string | null; } @@ -37,12 +38,14 @@ export const DebuggerPickerComponent: React.FC< }) => { const [isClient, setIsClient] = useState(false); - const handleChange = (selection: SingleValue) => { + const handleChange = ( + selection: SingleValue + ) => { if (!selection) { return; } - - handleSelection(selection.value); + const parentLabel = options.find(group => group.options.some(opt => opt.value === selection.value))?.label + handleSelection(selection.value, parentLabel); }; useEffect(() => { From 29f443b4e2cc7b7d692c0d94f8ce8beba6e4cfb2 Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:02:39 -0500 Subject: [PATCH 06/10] add function to filter categories from user selection --- src/app/[language]/libraries/page.tsx | 40 +++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/app/[language]/libraries/page.tsx b/src/app/[language]/libraries/page.tsx index 253148e9..e7a79ea2 100644 --- a/src/app/[language]/libraries/page.tsx +++ b/src/app/[language]/libraries/page.tsx @@ -9,7 +9,6 @@ import { LibraryCategoryModel } from "@/features/libraries/models/library-catego import { DATA_PATH } from "@/libs/config/project-paths.constants"; import { DEFAULT_LANGUAGE_CODE } from "@/features/localization/localization.config"; import { getLibrariesDictionary } from "@/features/localization/services/language-dictionary.service"; -import { LIBRARIES_FILTER_DEFAULT_VALUE } from "@/libs/config/project.constants"; import { StructuredData } from "@/features/seo/components/structured-data.component"; import { generateArticleStructuredData } from "@/features/seo/services/structured-data.service"; import { PageMetadataProps } from "@/features/common/models/page-metadata.props"; @@ -18,11 +17,13 @@ import { generatePageMetadata } from "@/libs/metadata/metadata.service"; import { createUrlPath } from "@/libs/utils/path.utils"; import { siteTree } from "@/features/seo/site-tree"; import { getAuth0Dictionary } from "@/features/localization/services/ui-language-dictionary.service"; +import { LibraryModel } from "@/features/libraries/models/library.model"; +import { LibrariesDictionaryModel } from "@/features/localization/models/libraries-dictionary.model"; export async function generateMetadata({ params: { language }, }: PageMetadataProps): Promise { - const dictionary = getLibrariesDictionary(language); + const dictionary: LibrariesDictionaryModel = getLibrariesDictionary(language); return generatePageMetadata({ languageCode: language, @@ -37,7 +38,8 @@ export default function Libraries({ }: { params: { language: string }; searchParams?: { - filter?: string; + programming_language?: string; + algorithm?: keyof LibraryModel["support"]; }; }) { const librariesDictionary = getLibrariesDictionary(languageCode); @@ -47,20 +49,41 @@ export default function Libraries({ encoding: "utf-8", }); - const query: string | null = searchParams?.filter || ""; + const programmingLanguage = searchParams?.programming_language ?? "" ; + const algorithm = searchParams?.algorithm; + const query = programmingLanguage !== "" ? programmingLanguage : algorithm ?? ""; const dictionary = JSON.parse(source) as LibraryDictionaryModel; const categoryOptions: { id: string; name: string }[] = Object.values( - dictionary, + dictionary ).map((library) => ({ id: library.id, name: library.name, })); - let categories: LibraryCategoryModel[] = dictionary[query] - ? [dictionary[query]] + const algorithmOptions: { value: string; label: string}[] = Object.keys(Object.values( + dictionary + )[0].libs[0].support).map(key => ({ + value: key, + label: key.toUpperCase() + })) + + const categories: LibraryCategoryModel[] = dictionary[programmingLanguage] + ? [dictionary[programmingLanguage]] : Object.values(dictionary); + const filteredCategories = algorithm + ? categories.map((category) => { + const filteredLibs = category.libs.filter( + (lib) => lib.support[algorithm] + ); + return { + ...category, + libs: filteredLibs, + }; + }) + : categories; + return ( <> Date: Mon, 28 Jul 2025 15:34:55 -0500 Subject: [PATCH 07/10] support grouped and single options for debugger picker --- .../debugger-picker.component.tsx | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/features/common/components/debugger-picker/debugger-picker.component.tsx b/src/features/common/components/debugger-picker/debugger-picker.component.tsx index 3ef481d7..2487519b 100644 --- a/src/features/common/components/debugger-picker/debugger-picker.component.tsx +++ b/src/features/common/components/debugger-picker/debugger-picker.component.tsx @@ -1,13 +1,29 @@ import React, { useEffect, useState } from "react"; import styles from "./debugger-picker.module.scss"; -import Select, { SingleValue } from "react-select"; +import Select, { SingleValue, OptionsOrGroups, GroupBase } from "react-select"; import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model"; + interface PickerLabelProps { label: string | null; } +const getGroupLabel = ( + options: OptionsOrGroups< + DebuggerPickerOptionModel, + GroupBase + >, + selected: DebuggerPickerOptionModel +): LibraryFilterLabel | undefined => { + if (!Array.isArray(options)) return undefined; + + const group = (options as GroupBase[]).find( + (group) => group.options.some((opt) => opt.value === selected.value) + ); + return group ? group.label as LibraryFilterLabel : undefined; +}; + const PickerLabel: React.FC = ({ label }) => { return (
@@ -19,9 +35,16 @@ const PickerLabel: React.FC = ({ label }) => { interface DebuggerPickerComponentProps { label: string | null; languageCode: string; - options: DebuggerPickerOptionModel[]; - selectedOptionCode: DebuggerPickerOptionModel["options"][0] | null; - handleSelection: (selection: string, parentLabel?: LibraryFilterLabel) => void + options: OptionsOrGroups< + DebuggerPickerOptionModel, + GroupBase + >; + isGrouped?: boolean; + selectedOptionCode: DebuggerPickerOptionModel | null; + handleSelection: ( + selection: string, + parentLabel?: LibraryFilterLabel + ) => void; placeholder: string | null; minWidth: string | null; } @@ -39,13 +62,13 @@ export const DebuggerPickerComponent: React.FC< const [isClient, setIsClient] = useState(false); const handleChange = ( - selection: SingleValue + selection: SingleValue ) => { if (!selection) { return; } - const parentLabel = options.find(group => group.options.some(opt => opt.value === selection.value))?.label - handleSelection(selection.value, parentLabel); + const groupLabel = getGroupLabel(options, selection); + handleSelection(selection.value, groupLabel); }; useEffect(() => { From 4d49b47d97177bae1275ee6f7b2ea863405eb6b2 Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:35:20 -0500 Subject: [PATCH 08/10] fix debugger option types --- .../common/models/debugger-picker-option.model.ts | 9 +++------ .../debugger-alg-picker.component.tsx | 2 +- .../components/library-hero/library-hero.component.tsx | 5 +++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/features/common/models/debugger-picker-option.model.ts b/src/features/common/models/debugger-picker-option.model.ts index a9020e5c..87612f6e 100644 --- a/src/features/common/models/debugger-picker-option.model.ts +++ b/src/features/common/models/debugger-picker-option.model.ts @@ -1,10 +1,7 @@ import { LibraryFilterLabel } from "@/features/libraries/models/library-filters.model"; export interface DebuggerPickerOptionModel { - label: LibraryFilterLabel; - options: { - value: any; - label: string; - isDisabled?: boolean - }[]; + value: any; + label: string | LibraryFilterLabel; + isDisabled?: boolean; } diff --git a/src/features/debugger/components/debugger-alg-picker/debugger-alg-picker.component.tsx b/src/features/debugger/components/debugger-alg-picker/debugger-alg-picker.component.tsx index b22fb781..f1d10216 100644 --- a/src/features/debugger/components/debugger-alg-picker/debugger-alg-picker.component.tsx +++ b/src/features/debugger/components/debugger-alg-picker/debugger-alg-picker.component.tsx @@ -11,7 +11,6 @@ import { useDecoderStore } from "@/features/decoder/services/decoder.store"; import { useDebuggerStore } from "@/features/debugger/services/debugger.store"; import { DebuggerWidgetValues } from "@/features/common/values/debugger-widget.values"; import { DebuggerPickerComponent } from "@/features/common/components/debugger-picker/debugger-picker.component"; -import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; import { algDictionary, jwsExampleAlgHeaderParameterValuesDictionary, @@ -19,6 +18,7 @@ import { import { useButton } from "@react-aria/button"; import { clsx } from "clsx"; import { PrimaryFont } from "@/libs/theme/fonts"; +import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; enum PickerStates { IDLE = "IDLE", diff --git a/src/features/libraries/components/library-hero/library-hero.component.tsx b/src/features/libraries/components/library-hero/library-hero.component.tsx index a1517531..d4711036 100644 --- a/src/features/libraries/components/library-hero/library-hero.component.tsx +++ b/src/features/libraries/components/library-hero/library-hero.component.tsx @@ -14,6 +14,7 @@ import { LibrariesDictionaryModel } from "@/features/localization/models/librari import { DebuggerPickerComponent } from "@/features/common/components/debugger-picker/debugger-picker.component"; import { LibraryFilterLabel } from "../../models/library-filters.model"; import { DebuggerPickerOptionModel } from "@/features/common/models/debugger-picker-option.model"; +import { GroupBase } from "react-select"; interface LibraryHeroComponentProps { languageCode: string; @@ -75,12 +76,12 @@ export const LibraryHeroComponent: React.FC = ({ label: "Algorithm", options: [...algorithmOptions], }, - ] as DebuggerPickerOptionModel[]; + ] as GroupBase[]; }, [ categoryOptions, dictionary.filterPicker.defaultValue.label, dictionary.filterPicker.defaultValue.value, - algorithmOptions + algorithmOptions, ]); return ( From 0c7b0252e64d23d057062583897e6377a117c3af Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:14:58 -0500 Subject: [PATCH 09/10] add support group for options in libraries --- src/app/[language]/libraries/page.tsx | 38 +++++++++++++------ .../library-hero/library-hero.component.tsx | 11 ++++++ .../libraries/models/library-filters.model.ts | 2 +- src/libs/config/project.constants.ts | 5 ++- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/app/[language]/libraries/page.tsx b/src/app/[language]/libraries/page.tsx index e7a79ea2..17e32dc9 100644 --- a/src/app/[language]/libraries/page.tsx +++ b/src/app/[language]/libraries/page.tsx @@ -40,6 +40,7 @@ export default function Libraries({ searchParams?: { programming_language?: string; algorithm?: keyof LibraryModel["support"]; + support?: keyof LibraryModel["support"] }; }) { const librariesDictionary = getLibrariesDictionary(languageCode); @@ -49,10 +50,15 @@ export default function Libraries({ encoding: "utf-8", }); - const programmingLanguage = searchParams?.programming_language ?? "" ; + const programmingLanguage = searchParams?.programming_language; const algorithm = searchParams?.algorithm; - const query = programmingLanguage !== "" ? programmingLanguage : algorithm ?? ""; + const support = searchParams?.support; + const query = programmingLanguage ?? algorithm ?? support ?? ""; const dictionary = JSON.parse(source) as LibraryDictionaryModel; + const allOptions = Object.keys(Object.values(dictionary)[0].libs[0].support); + const indexAlgorithmStart = allOptions.findIndex( + (option) => option == "hs256" + ); const categoryOptions: { id: string; name: string }[] = Object.values( dictionary @@ -61,21 +67,30 @@ export default function Libraries({ name: library.name, })); - const algorithmOptions: { value: string; label: string}[] = Object.keys(Object.values( - dictionary - )[0].libs[0].support).map(key => ({ - value: key, - label: key.toUpperCase() - })) + const supportOptions: { value: string; label: string }[] = allOptions + .slice(0, indexAlgorithmStart) + .map((key) => ({ + value: key, + label: key.toUpperCase(), + })); - const categories: LibraryCategoryModel[] = dictionary[programmingLanguage] + const algorithmOptions: { value: string; label: string }[] = allOptions + .slice(indexAlgorithmStart) + .map((key) => ({ + value: key, + label: key.toUpperCase(), + })); + + const categories: LibraryCategoryModel[] = programmingLanguage ? [dictionary[programmingLanguage]] : Object.values(dictionary); - const filteredCategories = algorithm + const categoryToFilter = algorithm ?? support + + const filteredCategories = categoryToFilter ? categories.map((category) => { const filteredLibs = category.libs.filter( - (lib) => lib.support[algorithm] + (lib) => lib.support[categoryToFilter] ); return { ...category, @@ -190,6 +205,7 @@ export default function Libraries({ query={query || librariesDictionary.filterPicker.defaultValue.value} categoryOptions={categoryOptions} algorithmOptions={algorithmOptions} + supportOptions={supportOptions} dictionary={librariesDictionary} /> = ({ query, categoryOptions, algorithmOptions, + supportOptions, dictionary, }) => { const pathname = usePathname(); @@ -49,6 +52,9 @@ export const LibraryHeroComponent: React.FC = ({ case "Algorithm": params.set(LIBRARIES_FILTER_ALGORITHM_KEY, selection); break; + case "Support": + params.set(LIBRARIES_FILTER_SUPPORT_KEY, selection); + break; default: break; } @@ -72,6 +78,10 @@ export const LibraryHeroComponent: React.FC = ({ }), ], }, + { + label: "Support", + options: [...supportOptions], + }, { label: "Algorithm", options: [...algorithmOptions], @@ -82,6 +92,7 @@ export const LibraryHeroComponent: React.FC = ({ dictionary.filterPicker.defaultValue.label, dictionary.filterPicker.defaultValue.value, algorithmOptions, + supportOptions ]); return ( diff --git a/src/features/libraries/models/library-filters.model.ts b/src/features/libraries/models/library-filters.model.ts index 6fc31739..d8945ba3 100644 --- a/src/features/libraries/models/library-filters.model.ts +++ b/src/features/libraries/models/library-filters.model.ts @@ -1 +1 @@ -export type LibraryFilterLabel = "ProgrammingLanguage" | "Algorithm" \ No newline at end of file +export type LibraryFilterLabel = "ProgrammingLanguage" | "Algorithm" | "Support" \ No newline at end of file diff --git a/src/libs/config/project.constants.ts b/src/libs/config/project.constants.ts index bd458300..3303d5a8 100644 --- a/src/libs/config/project.constants.ts +++ b/src/libs/config/project.constants.ts @@ -1,8 +1,9 @@ export const BASE_URL = "https://jwt.io"; export const LIBRARIES_FILTER_QUERY_PARAM_KEY = "filter"; export const LIBRARIES_FILTER_DEFAULT_VALUE = "all"; -export const LIBRARIES_FILTER_PROGRAMMING_LANGUAGE_KEY = "programming_language" -export const LIBRARIES_FILTER_ALGORITHM_KEY = "algorithm" +export const LIBRARIES_FILTER_PROGRAMMING_LANGUAGE_KEY = "programming_language"; +export const LIBRARIES_FILTER_ALGORITHM_KEY = "algorithm"; +export const LIBRARIES_FILTER_SUPPORT_KEY = "support"; export enum SupportedTokenHashParamValues { TOKEN = "token", ACCESS_TOKEN = "access_token", From 2c31778659d9713a955e14e29812f4818ffb278f Mon Sep 17 00:00:00 2001 From: Javier Tinoco <213990346+javiert-okta@users.noreply.github.com> Date: Wed, 30 Jul 2025 08:17:17 -0500 Subject: [PATCH 10/10] fix filter options for all programming languages --- src/app/[language]/libraries/page.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/[language]/libraries/page.tsx b/src/app/[language]/libraries/page.tsx index 17e32dc9..08de1776 100644 --- a/src/app/[language]/libraries/page.tsx +++ b/src/app/[language]/libraries/page.tsx @@ -40,7 +40,7 @@ export default function Libraries({ searchParams?: { programming_language?: string; algorithm?: keyof LibraryModel["support"]; - support?: keyof LibraryModel["support"] + support?: keyof LibraryModel["support"]; }; }) { const librariesDictionary = getLibrariesDictionary(languageCode); @@ -57,7 +57,7 @@ export default function Libraries({ const dictionary = JSON.parse(source) as LibraryDictionaryModel; const allOptions = Object.keys(Object.values(dictionary)[0].libs[0].support); const indexAlgorithmStart = allOptions.findIndex( - (option) => option == "hs256" + (option) => option === "hs256" ); const categoryOptions: { id: string; name: string }[] = Object.values( @@ -81,11 +81,12 @@ export default function Libraries({ label: key.toUpperCase(), })); - const categories: LibraryCategoryModel[] = programmingLanguage - ? [dictionary[programmingLanguage]] - : Object.values(dictionary); + const categories: LibraryCategoryModel[] = + programmingLanguage && programmingLanguage !== "all" + ? [dictionary[programmingLanguage]] + : Object.values(dictionary); - const categoryToFilter = algorithm ?? support + const categoryToFilter = algorithm ?? support; const filteredCategories = categoryToFilter ? categories.map((category) => {