38 lines
893 B
TypeScript
38 lines
893 B
TypeScript
import type { Metadata } from "next";
|
|
import "./globals.css";
|
|
import { SiteShell } from "@/app/components/site-shell";
|
|
import { getCategories, getFavicon } from "@/lib/meshkee/api";
|
|
import { site } from "@/lib/site-data";
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
let icon = site.logo;
|
|
try {
|
|
const favicon = await getFavicon();
|
|
if (favicon.faviconUrl) icon = favicon.faviconUrl;
|
|
} catch {
|
|
// keep default local logo
|
|
}
|
|
|
|
return {
|
|
title: site.title,
|
|
description: site.description,
|
|
icons: [{ url: icon }],
|
|
};
|
|
}
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const categories = await getCategories("product").catch(() => []);
|
|
|
|
return (
|
|
<html lang="fa" dir="rtl">
|
|
<body>
|
|
<SiteShell categories={categories}>{children}</SiteShell>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|