Spaces:
Configuration error
Configuration error
feat: integrate service worker + env validation + Web Vitals in layout
Browse files- src/app/layout.tsx +15 -3
src/app/layout.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { Suspense } from "react"
|
|
| 4 |
import { Inter, Playfair_Display, JetBrains_Mono } from "next/font/google"
|
| 5 |
import { ThemeProvider } from "@/components/providers/theme-provider"
|
| 6 |
import { AuthProvider } from "@/components/providers/auth-provider"
|
|
|
|
| 7 |
import { OllamaProvider } from "@/contexts/ollama-context"
|
| 8 |
import { Header } from "@/components/layout/header"
|
| 9 |
import { Footer } from "@/components/layout/footer"
|
|
@@ -11,6 +12,9 @@ import { KeyboardShortcuts } from "@/components/layout/keyboard-shortcuts"
|
|
| 11 |
import { OnboardingTour } from "@/components/onboarding/onboarding-tour"
|
| 12 |
import { generateWebsiteSchema, generateOrganizationSchema, generateSoftwareApplicationSchema } from "@/lib/seo"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
const inter = Inter({
|
| 15 |
subsets: ["latin"],
|
| 16 |
variable: "--font-inter",
|
|
@@ -76,7 +80,7 @@ export const metadata: Metadata = {
|
|
| 76 |
siteName: "OpenPrompt",
|
| 77 |
images: [
|
| 78 |
{
|
| 79 |
-
url: `${BASE_URL}/
|
| 80 |
width: 1200,
|
| 81 |
height: 630,
|
| 82 |
alt: "OpenPrompt - The GitHub for AI Prompts",
|
|
@@ -91,7 +95,7 @@ export const metadata: Metadata = {
|
|
| 91 |
description: "Transform AI prompts into shareable micro-apps. 177+ AI tools, multi-model support.",
|
| 92 |
creator: "@anky_vivek",
|
| 93 |
site: "@openprompt",
|
| 94 |
-
images: [`${BASE_URL}/
|
| 95 |
},
|
| 96 |
icons: {
|
| 97 |
icon: [
|
|
@@ -130,7 +134,6 @@ export default function RootLayout({
|
|
| 130 |
}: Readonly<{
|
| 131 |
children: React.ReactNode
|
| 132 |
}>) {
|
| 133 |
-
// Generate JSON-LD structured data
|
| 134 |
const websiteSchema = generateWebsiteSchema()
|
| 135 |
const organizationSchema = generateOrganizationSchema()
|
| 136 |
const softwareSchema = generateSoftwareApplicationSchema()
|
|
@@ -151,6 +154,13 @@ export default function RootLayout({
|
|
| 151 |
type="application/ld+json"
|
| 152 |
dangerouslySetInnerHTML={{ __html: JSON.stringify(softwareSchema) }}
|
| 153 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
</head>
|
| 155 |
<body className="min-h-screen bg-background antialiased" suppressHydrationWarning>
|
| 156 |
<AuthProvider>
|
|
@@ -177,6 +187,8 @@ export default function RootLayout({
|
|
| 177 |
<OnboardingTour />
|
| 178 |
</div>
|
| 179 |
</Suspense>
|
|
|
|
|
|
|
| 180 |
</OllamaProvider>
|
| 181 |
</ThemeProvider>
|
| 182 |
</AuthProvider>
|
|
|
|
| 4 |
import { Inter, Playfair_Display, JetBrains_Mono } from "next/font/google"
|
| 5 |
import { ThemeProvider } from "@/components/providers/theme-provider"
|
| 6 |
import { AuthProvider } from "@/components/providers/auth-provider"
|
| 7 |
+
import { ServiceWorkerRegistration } from "@/components/providers/service-worker"
|
| 8 |
import { OllamaProvider } from "@/contexts/ollama-context"
|
| 9 |
import { Header } from "@/components/layout/header"
|
| 10 |
import { Footer } from "@/components/layout/footer"
|
|
|
|
| 12 |
import { OnboardingTour } from "@/components/onboarding/onboarding-tour"
|
| 13 |
import { generateWebsiteSchema, generateOrganizationSchema, generateSoftwareApplicationSchema } from "@/lib/seo"
|
| 14 |
|
| 15 |
+
// Validate environment on import (dev only)
|
| 16 |
+
import "@/lib/env"
|
| 17 |
+
|
| 18 |
const inter = Inter({
|
| 19 |
subsets: ["latin"],
|
| 20 |
variable: "--font-inter",
|
|
|
|
| 80 |
siteName: "OpenPrompt",
|
| 81 |
images: [
|
| 82 |
{
|
| 83 |
+
url: `${BASE_URL}/api/og?title=OpenPrompt&description=The+GitHub+for+AI+Prompts`,
|
| 84 |
width: 1200,
|
| 85 |
height: 630,
|
| 86 |
alt: "OpenPrompt - The GitHub for AI Prompts",
|
|
|
|
| 95 |
description: "Transform AI prompts into shareable micro-apps. 177+ AI tools, multi-model support.",
|
| 96 |
creator: "@anky_vivek",
|
| 97 |
site: "@openprompt",
|
| 98 |
+
images: [`${BASE_URL}/api/og?title=OpenPrompt&description=The+GitHub+for+AI+Prompts`],
|
| 99 |
},
|
| 100 |
icons: {
|
| 101 |
icon: [
|
|
|
|
| 134 |
}: Readonly<{
|
| 135 |
children: React.ReactNode
|
| 136 |
}>) {
|
|
|
|
| 137 |
const websiteSchema = generateWebsiteSchema()
|
| 138 |
const organizationSchema = generateOrganizationSchema()
|
| 139 |
const softwareSchema = generateSoftwareApplicationSchema()
|
|
|
|
| 154 |
type="application/ld+json"
|
| 155 |
dangerouslySetInnerHTML={{ __html: JSON.stringify(softwareSchema) }}
|
| 156 |
/>
|
| 157 |
+
{/* Preconnect to external services for faster loading */}
|
| 158 |
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 159 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
| 160 |
+
{/* DNS prefetch for AI API endpoints */}
|
| 161 |
+
<link rel="dns-prefetch" href="https://api.openai.com" />
|
| 162 |
+
<link rel="dns-prefetch" href="https://api.anthropic.com" />
|
| 163 |
+
<link rel="dns-prefetch" href="https://generativelanguage.googleapis.com" />
|
| 164 |
</head>
|
| 165 |
<body className="min-h-screen bg-background antialiased" suppressHydrationWarning>
|
| 166 |
<AuthProvider>
|
|
|
|
| 187 |
<OnboardingTour />
|
| 188 |
</div>
|
| 189 |
</Suspense>
|
| 190 |
+
{/* PWA Service Worker Registration */}
|
| 191 |
+
<ServiceWorkerRegistration />
|
| 192 |
</OllamaProvider>
|
| 193 |
</ThemeProvider>
|
| 194 |
</AuthProvider>
|