layout.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import type { Metadata } from "next";
  2. import localFont from "next/font/local";
  3. import "./globals.css";
  4. import { ThemeProvider } from "@/components/theme-provider";
  5. import { DocsChat } from "@/components/docs-chat";
  6. import { Analytics } from "@vercel/analytics/next";
  7. import { SpeedInsights } from "@vercel/speed-insights/next";
  8. import { PAGE_TITLES } from "@/lib/page-titles";
  9. import { cookies } from "next/headers";
  10. const geistSans = localFont({
  11. src: "./fonts/GeistVF.woff",
  12. variable: "--font-geist-sans",
  13. });
  14. const geistMono = localFont({
  15. src: "./fonts/GeistMonoVF.woff",
  16. variable: "--font-geist-mono",
  17. });
  18. export const metadata: Metadata = {
  19. metadataBase: new URL("https://json-render.dev"),
  20. title: {
  21. default: `json-render | ${PAGE_TITLES[""]}`,
  22. template: "%s | json-render",
  23. },
  24. description:
  25. "The framework for User-Generated Interfaces (UGI). Let users generate dashboards, widgets, and apps from prompts — safely constrained to components you define.",
  26. keywords: [
  27. "json-render",
  28. "UGI",
  29. "User-Generated Interfaces",
  30. "AI UI generation",
  31. "generative UI",
  32. "React components",
  33. "React Native",
  34. "guardrails",
  35. "structured output",
  36. "dashboard builder",
  37. ],
  38. authors: [{ name: "Vercel Labs" }],
  39. creator: "Vercel Labs",
  40. openGraph: {
  41. type: "website",
  42. locale: "en_US",
  43. url: "https://json-render.dev",
  44. siteName: "json-render",
  45. title: "json-render | The framework for User-Generated Interfaces",
  46. description:
  47. "The framework for User-Generated Interfaces (UGI). Let users generate dashboards, widgets, and apps from prompts — safely constrained to components you define.",
  48. images: [
  49. {
  50. url: "/og",
  51. width: 1200,
  52. height: 630,
  53. alt: "json-render - The framework for User-Generated Interfaces",
  54. },
  55. ],
  56. },
  57. twitter: {
  58. card: "summary_large_image",
  59. title: "json-render | The framework for User-Generated Interfaces",
  60. description:
  61. "The framework for User-Generated Interfaces (UGI). Let users generate dashboards, widgets, and apps from prompts — safely constrained to components you define.",
  62. images: ["/og"],
  63. creator: "@verabornnot",
  64. },
  65. robots: {
  66. index: true,
  67. follow: true,
  68. },
  69. icons: {
  70. icon: "/favicon.ico",
  71. },
  72. };
  73. export default async function RootLayout({
  74. children,
  75. }: Readonly<{
  76. children: React.ReactNode;
  77. }>) {
  78. const cookieStore = await cookies();
  79. const chatOpen = cookieStore.get("docs-chat-open")?.value === "true";
  80. const chatWidth = Number(cookieStore.get("docs-chat-width")?.value) || 400;
  81. return (
  82. <html lang="en" suppressHydrationWarning>
  83. <head>
  84. {chatOpen && (
  85. <style
  86. dangerouslySetInnerHTML={{
  87. __html: `@media(min-width:640px){body{padding-right:${chatWidth}px}}`,
  88. }}
  89. />
  90. )}
  91. </head>
  92. <body className={`${geistSans.variable} ${geistMono.variable}`}>
  93. <ThemeProvider>
  94. {children}
  95. <DocsChat defaultOpen={chatOpen} defaultWidth={chatWidth} />
  96. </ThemeProvider>
  97. <Analytics />
  98. <SpeedInsights />
  99. </body>
  100. </html>
  101. );
  102. }