-
Notifications
You must be signed in to change notification settings - Fork 446
Expand file tree
/
Copy pathlayout.tsx
More file actions
84 lines (75 loc) · 2.19 KB
/
layout.tsx
File metadata and controls
84 lines (75 loc) · 2.19 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
80
81
82
83
84
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { Analytics } from "@vercel/analytics/next";
import { Providers } from "./providers";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
const themeInitializationScript = `
(() => {
const storageKey = "open-agents-theme";
const darkModeMediaQuery = "(prefers-color-scheme: dark)";
const storedTheme = window.localStorage.getItem(storageKey);
const theme =
storedTheme === "light" || storedTheme === "dark" || storedTheme === "system"
? storedTheme
: "system";
const resolvedTheme =
theme === "system"
? window.matchMedia(darkModeMediaQuery).matches
? "dark"
: "light"
: theme;
document.documentElement.classList.toggle("dark", resolvedTheme === "dark");
})();
`;
const isPreviewDeployment = process.env.VERCEL_ENV === "preview";
const faviconPath = isPreviewDeployment
? "/favicon-preview.svg"
: "/favicon.ico";
const metadataBase = process.env.VERCEL_PROJECT_PRODUCTION_URL
? new URL(`https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`)
: process.env.VERCEL_URL
? new URL(`https://${process.env.VERCEL_URL}`)
: new URL("https://open-agents.dev");
export const metadata: Metadata = {
metadataBase,
title: {
default: "Open Agents",
template: "%s | Open Agents",
},
description:
"Spawn coding agents that run infinitely in the cloud. Powered by AI SDK, Gateway, Sandbox, and Workflow SDK.",
icons: {
icon: faviconPath,
shortcut: faviconPath,
},
twitter: {
card: "summary_large_image",
},
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} font-sans overflow-x-hidden antialiased`}
>
<script
dangerouslySetInnerHTML={{ __html: themeInitializationScript }}
/>
<Providers>{children}</Providers>
<Analytics />
</body>
</html>
);
}