style: format code biome
This commit is contained in:
1 parent
8efd032cc6
commit
df38dccbf1
735 files changed
+128321
-120870
No files matched your search
+90
-82
@@ -1,13 +1,13 @@
|
||||
import type { Metadata } from "next";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages } from "next-intl/server";
|
||||
import { Nunito, Pixelify_Sans } from "next/font/google";
|
||||
import { headers } from "next/headers";
|
||||
import Script from "next/script";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages } from "next-intl/server";
|
||||
import type { ReactNode } from "react";
|
||||
import { Navigation } from "@/components/navigation";
|
||||
import { PwaRegister } from "@/components/pwa-register";
|
||||
import RadioPlayerGate from "@/components/public/radio-player-gate";
|
||||
import { PwaRegister } from "@/components/pwa-register";
|
||||
import { SiteFooter } from "@/components/site-footer";
|
||||
import { SiteHeader } from "@/components/site-header";
|
||||
import { ThemeVars } from "@/components/theme-vars";
|
||||
@@ -17,92 +17,100 @@ import { siteSettings } from "@/lib/services/site-settings";
|
||||
import "./globals.css";
|
||||
|
||||
const nunito = Nunito({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "600", "700", "800"],
|
||||
display: "swap",
|
||||
variable: "--font-nunito",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "600", "700", "800"],
|
||||
display: "swap",
|
||||
variable: "--font-nunito",
|
||||
});
|
||||
|
||||
const pixelFont = Pixelify_Sans({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "700"],
|
||||
display: "swap",
|
||||
variable: "--font-pixel",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "700"],
|
||||
display: "swap",
|
||||
variable: "--font-pixel",
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
||||
const hotel = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
|
||||
const customFavicon = await siteSettings.get("cms_favicon");
|
||||
const faviconUrl = customFavicon ?? "/favicon.svg";
|
||||
const icons = [
|
||||
{ rel: "icon", url: faviconUrl },
|
||||
{ rel: "shortcut icon", url: faviconUrl },
|
||||
];
|
||||
return {
|
||||
title: { default: `${hotel} - Hotel`, template: `%s · ${hotel}` },
|
||||
description: `${hotel} — a Habbo retro hotel. Hang out, collect furni and meet friends.`,
|
||||
metadataBase: new URL(appUrl),
|
||||
alternates: { canonical: appUrl },
|
||||
icons,
|
||||
openGraph: {
|
||||
title: `${hotel} - Hotel`,
|
||||
description: `${hotel} — a Habbo retro hotel. Hang out, collect furni and meet friends.`,
|
||||
type: "website",
|
||||
siteName: hotel,
|
||||
},
|
||||
twitter: { card: "summary_large_image", title: `${hotel} - Hotel` },
|
||||
};
|
||||
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
||||
const hotel = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
|
||||
const customFavicon = await siteSettings.get("cms_favicon");
|
||||
const faviconUrl = customFavicon ?? "/favicon.svg";
|
||||
const icons = [
|
||||
{ rel: "icon", url: faviconUrl },
|
||||
{ rel: "shortcut icon", url: faviconUrl },
|
||||
];
|
||||
return {
|
||||
title: { default: `${hotel} - Hotel`, template: `%s · ${hotel}` },
|
||||
description: `${hotel} — a Habbo retro hotel. Hang out, collect furni and meet friends.`,
|
||||
metadataBase: new URL(appUrl),
|
||||
alternates: { canonical: appUrl },
|
||||
icons,
|
||||
openGraph: {
|
||||
title: `${hotel} - Hotel`,
|
||||
description: `${hotel} — a Habbo retro hotel. Hang out, collect furni and meet friends.`,
|
||||
type: "website",
|
||||
siteName: hotel,
|
||||
},
|
||||
twitter: { card: "summary_large_image", title: `${hotel} - Hotel` },
|
||||
};
|
||||
}
|
||||
|
||||
export default async function RootLayout({ children }: { children: ReactNode }) {
|
||||
await enforceSiteAccess();
|
||||
const locale = await getLocale();
|
||||
const messages = await getMessages();
|
||||
// "Dusk" / dark-by-default: the site starts dark unless the visitor has picked
|
||||
// light. The saved choice always wins over the default.
|
||||
const defaultDark = await siteSettings.getBool("default_dark", false);
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
await enforceSiteAccess();
|
||||
const locale = await getLocale();
|
||||
const messages = await getMessages();
|
||||
// "Dusk" / dark-by-default: the site starts dark unless the visitor has picked
|
||||
// light. The saved choice always wins over the default.
|
||||
const defaultDark = await siteSettings.getBool("default_dark", false);
|
||||
|
||||
const headersList = await headers();
|
||||
const pathname = headersList.get("x-pathname") || headersList.get("next-url") || "";
|
||||
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
||||
const nitroUrl = await siteSettings.get("nitro_client_url", "");
|
||||
return (
|
||||
<html lang={locale} className={`app ${nunito.variable} ${pixelFont.variable}`}>
|
||||
<head>
|
||||
<meta name="theme-default-dark" content={String(defaultDark)} />
|
||||
<Script src="/scripts/theme-init.js" strategy="beforeInteractive" />
|
||||
<link rel="preconnect" href="https://www.habbo.com" />
|
||||
<link rel="dns-prefetch" href="https://www.habbo.com" />
|
||||
{nitroUrl && nitroUrl.startsWith("http") ? (
|
||||
<link rel="preconnect" href={new URL(nitroUrl).origin} />
|
||||
) : null}
|
||||
</head>
|
||||
<body
|
||||
className="flex min-h-screen flex-col site-bg"
|
||||
style={{ backgroundColor: "var(--color-background)" }}
|
||||
>
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<ThemeVars />
|
||||
{isClient ? (
|
||||
children
|
||||
) : (
|
||||
<>
|
||||
<TopHeader />
|
||||
<SiteHeader />
|
||||
<Navigation />
|
||||
<main>
|
||||
<div className="mx-auto mt-6 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-6 px-4 py-4 md:mt-0 md:p-6">
|
||||
<div className="col-span-12 min-w-0">{children}</div>
|
||||
</div>
|
||||
</main>
|
||||
<SiteFooter />
|
||||
<RadioPlayerGate />
|
||||
</>
|
||||
)}
|
||||
<PwaRegister />
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
const headersList = await headers();
|
||||
const pathname =
|
||||
headersList.get("x-pathname") || headersList.get("next-url") || "";
|
||||
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
||||
const nitroUrl = await siteSettings.get("nitro_client_url", "");
|
||||
return (
|
||||
<html
|
||||
lang={locale}
|
||||
className={`app ${nunito.variable} ${pixelFont.variable}`}
|
||||
>
|
||||
<head>
|
||||
<meta name="theme-default-dark" content={String(defaultDark)} />
|
||||
<Script src="/scripts/theme-init.js" strategy="beforeInteractive" />
|
||||
<link rel="preconnect" href="https://www.habbo.com" />
|
||||
<link rel="dns-prefetch" href="https://www.habbo.com" />
|
||||
{nitroUrl?.startsWith("http") ? (
|
||||
<link rel="preconnect" href={new URL(nitroUrl).origin} />
|
||||
) : null}
|
||||
</head>
|
||||
<body
|
||||
className="flex min-h-screen flex-col site-bg"
|
||||
style={{ backgroundColor: "var(--color-background)" }}
|
||||
>
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<ThemeVars />
|
||||
{isClient ? (
|
||||
children
|
||||
) : (
|
||||
<>
|
||||
<TopHeader />
|
||||
<SiteHeader />
|
||||
<Navigation />
|
||||
<main>
|
||||
<div className="mx-auto mt-6 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-6 px-4 py-4 md:mt-0 md:p-6">
|
||||
<div className="col-span-12 min-w-0">{children}</div>
|
||||
</div>
|
||||
</main>
|
||||
<SiteFooter />
|
||||
<RadioPlayerGate />
|
||||
</>
|
||||
)}
|
||||
<PwaRegister />
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user