// app/kodukord/page.tsx (App Router) import ReactMarkdown, { Components } from "react-markdown"; import { vipnagorgialla } from "@/components/Vipnagorgialla"; import RuleNav from "@/components/RuleNav"; import { getTranslations, setRequestLocale } from "next-intl/server"; import { loadRulesBun } from "@/lib/loadRules"; const sectionKeys = [ { id: "reminder", labelKey: "rules.reminder" }, { id: "code", labelKey: "rules.code" }, ]; export default async function Page({ params, }: { params: Promise<{ locale: string }>; }) { const { locale } = await params; setRequestLocale(locale); const t = await getTranslations({ locale }); const content = await loadRulesBun("kodukord", locale as "et" | "en"); const sections = sectionKeys.map((section) => ({ id: section.id, label: t(section.labelKey), })); // Track heading count for ID assignment let headingCount = 0; return (
{/* Main content */}
{/* Page title */}

{t("rules.houseRules")}

{ const id = sections[headingCount]?.id || `section-${headingCount}`; headingCount++; return (

{props.children}

); }, h2: (props) => (

{props.children}

), ol: (props) => (
    {props.children}
), ul: (props) => (
    {props.children}
), p: (props) => (

{props.children}

), li: (props) => (
  • {props.children}
  • ), } as Components } > {content}
    {/* Sidebar navigation */}
    ); }