-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlayout.tsx
More file actions
79 lines (74 loc) · 2.43 KB
/
Copy pathlayout.tsx
File metadata and controls
79 lines (74 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import FooterServer from "@comps/shared/FooterServer";
import { Inter } from "next/font/google";
import Script from "next/script";
import NavBarServer from "../../components/shared/NavBarServer";
import { getGoogleTagId } from "../../utils/getGoogleTagId";
import { getLocale } from "../../utils/i18n";
import "../globals.css";
import QueryProvider from "@comps/providers/QueryProvider";
const inter = Inter({
weight: ["400", "600", "700"],
subsets: ["latin"],
});
export default async function RootLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ product: string }>;
}) {
const { product } = await params;
const googleTagId = getGoogleTagId(product);
const locale = await getLocale();
const htmlLang = locale === "zh" ? "zh-CN" : "en";
return (
<html lang={htmlLang}>
<head>
<link rel="icon" href={`/favicons/${product}.ico?v=20260604`} />
{product === "YakShaver" && (
<Script
data-domain="yakshaver.ai"
src="https://plausible.io/js/script.hash.outbound-links.pageview-props.tagged-events.js"
/>
)}
{product === "EagleEye" && (
<>
<Script
async
src="https://plausible.io/js/pa-mLKH9kmb_Ab1FoQjBIRMA.js"
/>
<Script id="plausible-init">
{`
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
plausible.init()
`}
</Script>
</>
)}
</head>
<body
className={`min-h-screen flex-col flex ${inter.className} relative bg-gray-light`}
>
<Script
async
src={`https://www.googletagmanager.com/gtag/js?id=${googleTagId}`}
/>
<Script id="ga4-init" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${googleTagId}');
`}
</Script>
<QueryProvider>
<main className="overflow-clip grow">
<NavBarServer product={product} locale={locale} />
{children}
</main>
</QueryProvider>
<FooterServer product={product} locale={locale} />
</body>
</html>
);
}