diff --git a/public/tipilan-icon-white.svg b/public/tipilan-icon-white.svg new file mode 100644 index 0000000..8c1c759 --- /dev/null +++ b/public/tipilan-icon-white.svg @@ -0,0 +1,7 @@ + diff --git a/src/app/[locale]/reeglid/[slug]/page.tsx b/src/app/[locale]/reeglid/[slug]/page.tsx deleted file mode 100644 index 785f3cd..0000000 --- a/src/app/[locale]/reeglid/[slug]/page.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import { notFound } from "next/navigation"; -import ReactMarkdown, { Components } from "react-markdown"; -import { vipnagorgialla } from "@/components/Vipnagorgialla"; -import SectionDivider from "@/components/SectionDivider"; -import { getTranslations, setRequestLocale } from "next-intl/server"; -import { loadRulesBun } from "@/lib/loadRules"; - -// Map of valid slugs to their translation keys -const rulesMap = { - lol: { - titleKey: "rules.lolRules", - }, - cs2: { - titleKey: "rules.cs2Rules", - }, -} as const; - -type RuleSlug = keyof typeof rulesMap; - -interface PageProps { - params: Promise<{ slug: string; locale: string }>; -} - -async function getRuleContent(slug: string, locale: string) { - if (!Object.keys(rulesMap).includes(slug)) { - return null; - } - - const ruleConfig = rulesMap[slug as RuleSlug]; - - try { - const content = await loadRulesBun( - slug as "cs2" | "lol", - locale as "et" | "en", - ); - return { - content, - titleKey: ruleConfig.titleKey, - }; - } catch (error) { - console.error( - `Error reading rule file for slug ${slug} in locale ${locale}:`, - error, - ); - return null; - } -} - -export default async function RulePage({ params }: PageProps) { - const { slug, locale } = await params; - setRequestLocale(locale); - const t = await getTranslations({ locale }); - const ruleData = await getRuleContent(slug, locale); - - if (!ruleData) { - notFound(); - } - - const headingStyle = `text-5xl sm:text-6xl ${vipnagorgialla.className} font-bold uppercase italic text-[#2A2C3F] dark:text-[#EEE5E5]`; - - return ( -
{props.children}
, - } as Components - } - > - {ruleData.content} -