// SPDX-FileCopyrightText: 2026 Progmasoft // SPDX-License-Identifier: AGPL-3.0-or-later import type { ReactNode } from "react"; import { Footer } from "@/components/Footer"; import { SiteHeader } from "@/components/SiteHeader"; import type { Locale } from "@/lib/localization"; import { type CatalogMessages, type ProductSlug, type ProductStatus, products, } from "@/lib/products"; export type CatalogView = "all" | "categories" | "languages" | "releases"; // The catalog's own paths are those of product.progmasoft.com, which the proxy // maps to /products/...; typed routes know only the internal ones, so the // links between them are plain anchors. const viewPaths: Record = { all: "/", categories: "/categories", languages: "/languages", releases: "/releases", }; /** A day of the catalog, YYYY-MM-DD, as the visitor's language writes it. */ export function formatDay(locale: Locale, day: string): string { return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC", }).format(new Date(`${day}T00:00:00Z`)); } export function StatusBadge({ status, catalog, }: { status: ProductStatus; catalog: CatalogMessages; }) { return ( {catalog.statuses[status]} ); } /** The page of one catalog view: header, hero, the links between views, content. */ export function CatalogPage({ locale, catalog, view, title, description, children, }: { locale: Locale; catalog: CatalogMessages; view: CatalogView; title: string; description: string; children: ReactNode; }) { return (

{catalog.eyebrow}

{title}

{description}

{children}
); } /** Projects as a table: name and tagline, category, language, status, latest release. */ export function ProductTable({ slugs, locale, catalog, }: { slugs: readonly ProductSlug[]; locale: Locale; catalog: CatalogMessages; }) { return (
{slugs.map((slug) => { const product = products[slug]; const release = product.latestRelease; return ( ); })}
{catalog.table.name} {catalog.table.category} {catalog.table.language} {catalog.table.status} {catalog.table.release}
{product.name} {catalog.products[slug].tagline} {catalog.categories[product.category]} {product.language} {release ? ( {release.version} ยท{" "} {formatDay(locale, release.date)} ) : ( catalog.facts.none )}
); } /** Projects as cards, under a heading: one group of a grouped view. */ export function ProductGroup({ title, slugs, catalog, }: { title: string; slugs: readonly ProductSlug[]; catalog: CatalogMessages; }) { return (

{title} {slugs.length}

{slugs.map((slug) => { const product = products[slug]; return (

{product.name}

{catalog.products[slug].tagline}

); })}
); }