Skip to content

Commit

Permalink
improvement: change yeartitle combined field formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Jan 6, 2025
1 parent 0272b58 commit 1c932d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/[locale]/works/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function WorksPage(props: WorksPageProps) {
return item.label.startsWith(props.params.category);
})
.map((item) => {
const [year, title] = item.label.split("_");
const [_category, year, title] = item.label.split("_");
item.label = Number.isNaN(parseInt(year!)) ? title! : `${title!} (${year!})`;
return item;
});
Expand Down
2 changes: 1 addition & 1 deletion components/app-header-nav-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function AppHeaderNavMenu(): ReactNode {
};

return (
<nav aria-label={t("navigation-primary")}>
<nav aria-label={t("navigation-primary")} className="flex flex-col justify-center">
<ul className="flex items-center gap-6 text-sm" role="list">
{Object.entries(topLevelItems).map(([id, item]) => {
return <li key={id}>{item}</li>;
Expand Down
4 changes: 2 additions & 2 deletions components/app-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { LocaleSwitcher } from "./locale-switcher";
export function AppHeader(): ReactNode {
const t = useTranslations("AppHeader");
return (
<header className="mx-auto grid w-full max-w-screen-xl auto-cols-auto grid-flow-col gap-4 border-b p-6">
<div className="mr-20 mt-2 flex flex-col">
<header className="mx-auto grid w-full max-w-screen-xl auto-cols-auto grid-flow-col gap-6 border-b p-6">
<div className="flex flex-col justify-center">
<Link className="font-bold lowercase" href={createHref({})}>
{t("title")}
</Link>
Expand Down
3 changes: 2 additions & 1 deletion scripts/3_to_typesense.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def del_empty_strings(o, field_names):
w["category"] = categories[w["category"]] if w["category"] else "fragments"

# helper field for the faceted listing by work
w["yeartitle"] = f'{w["category"]}${w["year"]}${w["short_title"]}'
# w["yeartitle"] = f'{w["category"]}_{w["year"]}_{w["short_title"].replace(" ", "_")}'
w["yeartitle"] = f'{w["category"]}_{w["year"]}_{w["short_title"]}'

for t in translations:
t["work"] = works[t["work"] - 1]
Expand Down

0 comments on commit 1c932d4

Please sign in to comment.