Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import "./globals.css";
|
|
import { AuthProvider } from "@/lib/auth-context";
|
|
import { ThemeProvider } from "@/components/theme-provider";
|
|
import { db, settings } from "@/lib/db";
|
|
import { eq } from "drizzle-orm";
|
|
|
|
async function getSettings() {
|
|
try {
|
|
const allSettings = await db.select().from(settings);
|
|
const settingsObj = allSettings.reduce((acc, setting) => {
|
|
acc[setting.key] = setting.value;
|
|
return acc;
|
|
}, {} as Record<string, string>);
|
|
|
|
return {
|
|
siteTitle: settingsObj.siteTitle || 'Chá de Bebê',
|
|
homepageSubtext: settingsObj.homepageSubtext || 'Escolha um presente da lista!',
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
siteTitle: 'Chá de Bebê',
|
|
homepageSubtext: 'Escolha um presente da lista!',
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const settings = await getSettings();
|
|
return {
|
|
title: settings.siteTitle,
|
|
description: "Lista de presentes para o chá de bebê",
|
|
icons: {
|
|
icon: '/icon.svg',
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="pt-BR">
|
|
<body className="font-sans antialiased bg-gray-50 dark:bg-gray-900">
|
|
<AuthProvider>
|
|
<ThemeProvider>{children}</ThemeProvider>
|
|
</AuthProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|