Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
import type { Metadata } from "next";
import Link from "@/features/landing/components/landing-link";
import Image from "next/image";
import { SiteHeader } from "@/features/landing/site/site-header";
import { SiteFooter } from "@/features/landing/site/site-footer";
import { getUseCasePagesForLocale } from "@/lib/use-cases-source";
import { getUseCaseLocale, useCaseText } from "@/lib/use-cases-i18n";
import { SHARE_IMAGE } from "@/features/landing/share-image";
import { landingAlternates, localizeHref } from "@/lib/landing-locale-path";
import { liveMetadata, requireLiveRoute } from "@/features/landing/site/sitemap";
type ExtraFrontmatter = {
category?: string;
updated_at?: string;
hero_image?: string;
};
export async function generateMetadata(): Promise<Metadata> {
const locale = await getUseCaseLocale();
const text = useCaseText[locale];
return liveMetadata("/usecases", {
title: text.indexMetadataTitle,
description: text.indexMetadataDescription,
openGraph: {
images: [SHARE_IMAGE],
title: text.indexMetadataTitle,
description: text.indexMetadataDescription,
url: localizeHref(locale, "/usecases"),
},
alternates: {
canonical: localizeHref(locale, "/usecases"),
languages: landingAlternates("/usecases"),
},
});
}
export default async function UseCasesIndexPage() {
requireLiveRoute("/usecases");
const locale = await getUseCaseLocale();
const text = useCaseText[locale];
const pages = getUseCasePagesForLocale(locale)
.slice()
.sort((a, b) => {
// Sort descending by updated_at. Missing dates fall to the bottom by
// comparing against the epoch placeholder rather than the empty string
// (which would make ordering undefined when multiple entries omit it).
const da = (a.data as ExtraFrontmatter).updated_at ?? "1900-01-01";
const db = (b.data as ExtraFrontmatter).updated_at ?? "1900-01-01";
return db.localeCompare(da);
});
return (
<>
<SiteHeader />
<div className="relative">
<section className="relative overflow-hidden bg-[#05070b] text-white">
<div className="relative z-10 mx-auto max-w-[1120px] px-4 pb-20 pt-32 text-center sm:px-6 sm:pt-40 lg:px-8 lg:pb-24">
<h1 className="mx-auto max-w-[880px] font-site-display text-site-display drop-shadow-[0_10px_34px_rgba(0,0,0,0.32)]">
{text.indexTitle}
</h1>
<p className="mx-auto mt-6 max-w-[620px] text-body-lg leading-7 text-white/84 sm:text-title">
{text.indexSubtitle}
</p>
</div>
</section>
</div>
<section className="bg-white py-20 text-[#0a0d12] sm:py-24">
<div className="mx-auto max-w-[1120px] px-4 sm:px-6 lg:px-8">
<div className="grid grid-cols-1 gap-x-6 gap-y-14 sm:grid-cols-2 lg:grid-cols-3">
{pages.map((page) => {
const extra = page.data as ExtraFrontmatter;
const heroImage = extra.hero_image;
const category = extra.category;
// Construct the URL from the page slug rather than `page.url`.
// Fumadocs may prefix locale-specific URLs, but our public
// route stays prefix-free and resolves locale from the request.
const href = `/usecases/${page.slugs.join("/")}`;
return (
<Link key={href} href={href} className="group flex flex-col">
<div className="relative aspect-[4/3] overflow-hidden rounded-lg bg-[#f5f5f5]">
{heroImage ? (
<Image
src={heroImage}
alt=""
fill
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 360px"
className="object-cover transition-transform duration-300 group-hover:scale-[1.02]"
/>
) : null}
</div>
{category ? (
<div className="mt-5 text-caption uppercase tracking-[0.14em] text-[#0a0d12]/50">
{category}
</div>
) : null}
<h3 className="mt-2 text-title font-semibold leading-[1.35] text-[#0a0d12] sm:text-title-lg">
{page.data.title}
</h3>
{page.data.description ? (
<p className="mt-2 text-body leading-[1.6] text-[#0a0d12]/60">
{page.data.description}
</p>
) : null}
<span className="mt-3 text-label text-[#0a0d12]/70 transition-colors group-hover:text-[#0a0d12]">
{text.cardReadMore}
</span>
</Link>
);
})}
</div>
</div>
</section>
<SiteFooter />
</>
);
}