Versionsnummer aus package.json wird auf jeder Seite unten rechts dezent eingeblendet.
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist } from "next/font/google";
|
|
import "./globals.css";
|
|
import { createClient } from "@/lib/supabase/server";
|
|
import { COLOR_VARS, DEFAULT_COLORS } from "@/lib/types";
|
|
import packageJson from "@/package.json";
|
|
|
|
// Farben/Logo sollen Änderungen sofort widerspiegeln.
|
|
export const dynamic = "force-dynamic";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Canteen Menu",
|
|
description: "Speisekarte der Betriebskantine",
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const supabase = await createClient();
|
|
const { data: settings } = await supabase
|
|
.from("settings")
|
|
.select("colors")
|
|
.eq("id", 1)
|
|
.maybeSingle();
|
|
|
|
const colors: Record<string, string> = {
|
|
...DEFAULT_COLORS,
|
|
...((settings?.colors as Record<string, string>) ?? {}),
|
|
};
|
|
const style = Object.fromEntries(
|
|
Object.entries(COLOR_VARS).map(([key, cssVar]) => [cssVar, colors[key]])
|
|
) as React.CSSProperties;
|
|
|
|
return (
|
|
<html lang="de" className={`${geistSans.variable} h-full antialiased`}>
|
|
<body style={style} className="min-h-full flex flex-col">
|
|
{children}
|
|
<footer className="mt-auto px-4 py-2 text-right text-xs text-gray-400 select-none">
|
|
Version {packageJson.version}
|
|
</footer>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|