asi-calculator/app/layout.tsx

38 lines
926 B
TypeScript
Raw Normal View History

2024-03-29 15:06:40 +01:00
import type { Metadata } from 'next'
2024-03-31 15:24:07 +02:00
import '@/styles/globals.css'
2024-04-01 02:15:51 +02:00
import '@/styles/loading-ui.css'
2024-04-01 05:19:05 +02:00
import Script from 'next/script'
2024-04-06 19:34:43 +02:00
import { title, description, font, liveUrl, isProduction } from '@/constants'
import { headers } from 'next/headers'
2024-03-29 12:36:05 +01:00
2024-04-02 13:58:12 +02:00
export const metadata: Metadata = {
title,
description,
alternates: { canonical: liveUrl },
metadataBase: new URL(liveUrl)
}
2024-03-29 12:36:05 +01:00
export default function RootLayout({
2024-03-29 15:06:40 +01:00
children
2024-03-29 12:36:05 +01:00
}: Readonly<{
2024-03-29 15:06:40 +01:00
children: React.ReactNode
2024-03-29 12:36:05 +01:00
}>) {
const headersList = headers()
const locale = headersList.get('x-locale')
2024-03-29 12:36:05 +01:00
return (
<html lang="en" data-locale={locale}>
2024-04-01 05:19:05 +02:00
<head>
2024-04-06 19:34:43 +02:00
{isProduction ? (
<Script
async
src="https://a.kretschmann.io/script.js"
data-website-id="6565eff1-a1c8-4b3e-a6c4-08ecb00b06ab"
/>
) : null}
2024-04-01 05:19:05 +02:00
</head>
2024-04-02 13:58:12 +02:00
<body className={font.variable}>{children}</body>
2024-03-29 12:36:05 +01:00
</html>
2024-03-29 15:06:40 +01:00
)
2024-03-29 12:36:05 +01:00
}