diff --git a/app/[locale]/languages/[language]/page.tsx b/app/[locale]/languages/[language]/page.tsx index 20ff2af..ad5d0d4 100644 --- a/app/[locale]/languages/[language]/page.tsx +++ b/app/[locale]/languages/[language]/page.tsx @@ -18,11 +18,7 @@ export default function LanguagesPage(props: LanguagesPageProps) { const tl = useTranslations("Languages"); return ( - + - @@ -74,7 +74,7 @@ export default function TranslatorsPage() { /> - + ); } diff --git a/app/[locale]/works/[id_or_category]/page.tsx b/app/[locale]/works/[category]/page.tsx similarity index 82% rename from app/[locale]/works/[id_or_category]/page.tsx rename to app/[locale]/works/[category]/page.tsx index 9ec13a3..5c6567b 100644 --- a/app/[locale]/works/[id_or_category]/page.tsx +++ b/app/[locale]/works/[category]/page.tsx @@ -10,21 +10,26 @@ import { MainContent } from "@/components/main-content"; interface WorksPageProps { params: { - id_or_category: string; + category: string; }; } export default function WorksPage(props: WorksPageProps) { const ct = useTranslations("BernhardCategories"); // eslint-disable-next-line @typescript-eslint/no-explicit-any - const categoryLabel = ct(props.params.id_or_category as any); + const categoryLabel = ct(props.params.category as any); + // TODO validate category const t = useTranslations("InstantSearch"); const tl = useTranslations("Languages"); + // TODO get id -> year+title dictionaries from backend + return (
@@ -38,10 +43,10 @@ export default function WorksPage(props: WorksPageProps) { transformItems: (items: Array) => { return items .filter((item) => { - return item.label.startsWith(props.params.id_or_category); + return item.label.startsWith(props.params.category); }) .map((item) => { - const [_cat, year, title] = item.label.split("$"); + const [year, title] = item.label.split("_"); item.label = Number.isNaN(parseInt(year!)) ? title! : `${title!} (${year!})`; return item; }); diff --git a/components/instantsearch/instantsearchprovider.tsx b/components/instantsearch/instantsearchprovider.tsx index f6a0026..5eac08e 100644 --- a/components/instantsearch/instantsearchprovider.tsx +++ b/components/instantsearch/instantsearchprovider.tsx @@ -4,7 +4,6 @@ import type { UiState } from "instantsearch.js"; // eslint-disable-next-line no-restricted-imports import singletonRouter from "next/router"; import type { ReactNode } from "react"; -import { Configure } from "react-instantsearch"; import { InstantSearchNext } from "react-instantsearch-nextjs"; import { createInstantSearchRouterNext } from "react-instantsearch-router-nextjs"; import type { SearchClient } from "typesense-instantsearch-adapter"; @@ -16,7 +15,6 @@ export interface InstantSearchProviderProps { pathnameField?: string; queryArgsToMenuFields?: Record; defaultSort?: string; - filters?: string; searchClient: SearchClient; } @@ -26,7 +24,6 @@ export function InstantSearchProvider(props: InstantSearchProviderProps): ReactN const { children, collectionName, - filters, defaultSort, pageName, pathnameField, @@ -34,10 +31,6 @@ export function InstantSearchProvider(props: InstantSearchProviderProps): ReactN // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment searchClient, } = props; - const filter = filters - ? // '&&' is typesense convention, not instantsearch! - `erstpublikation:true && ${filters}` - : "erstpublikation:true"; return ( - {children} ); diff --git a/components/instantsearch/sortby.tsx b/components/instantsearch/sortby.tsx index 1b93055..67e2c2e 100644 --- a/components/instantsearch/sortby.tsx +++ b/components/instantsearch/sortby.tsx @@ -40,14 +40,9 @@ export function InstantSearchSortBy(props: InstantSearchSortByProps): ReactNode const { currentRefinement, options, refine } = useSortBy({ items: sortByItems, }); - // enforce initial sort - if (currentRefinement === collectionName) { - refine(`${collectionName}/sort/${props.sortOptions[0]!}`); - } - return (