From c6384051f85afe9f800ba419cb2eca5bfe068487 Mon Sep 17 00:00:00 2001 From: otdoges Date: Mon, 7 Jul 2025 01:33:59 -0500 Subject: [PATCH 1/3] Refactor authentication and routing logic: Simplify middleware for user redirection based on authentication status, enhance layout metadata for SEO, and streamline auth button functionality. Update page components to improve user experience and maintain consistent styling across the application. --- app/auth/page.tsx | 9 +- app/layout.tsx | 84 ++++++++++--- app/page.tsx | 227 +++++++++++------------------------- app/sitemap.ts | 15 +++ components/auth-buttons.tsx | 104 +++++++++-------- middleware.ts | 24 ++-- public/robots.txt | 9 ++ 7 files changed, 229 insertions(+), 243 deletions(-) create mode 100644 app/sitemap.ts create mode 100644 public/robots.txt diff --git a/app/auth/page.tsx b/app/auth/page.tsx index 3fe7048f..dfe81e0f 100644 --- a/app/auth/page.tsx +++ b/app/auth/page.tsx @@ -26,6 +26,13 @@ function AuthContent() { const authError = searchParams.get('error'); const authSuccess = searchParams.get('success'); + // Redirect if user is already logged in + useEffect(() => { + if (user) { + router.replace(redirectTo); + } + }, [user, router, redirectTo]); + // Check if Supabase is configured const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL; const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY; @@ -69,7 +76,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=your_key`} ); } - if (loading || user) { + if (loading) { return (
diff --git a/app/layout.tsx b/app/layout.tsx index 9a1df371..d7eb8f84 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -22,34 +22,73 @@ export const viewport: Viewport = { }; export const metadata: Metadata = { - title: 'ZapDev - Build Amazing Apps with AI', + metadataBase: new URL('https://zapdev.link'), + title: { + default: 'ZapDev: AI-Powered Development Platform to Build and Deploy Web Apps', + template: '%s | ZapDev', + }, description: - 'The most powerful AI-driven development platform. Generate, preview, and deploy beautiful applications in seconds.', + 'ZapDev is an innovative AI-driven platform that empowers you to generate, preview, and deploy stunning web applications in seconds. Turn your ideas into reality with our cutting-edge AI assistant and WebContainer technology.', generator: 'ZapDev', applicationName: 'ZapDev', - keywords: ['AI development', 'web apps', 'code generation', 'WebContainer', 'AI assistant'], - authors: [{ name: 'ZapDev Team' }], - metadataBase: new URL('https://zapdev.link'), + keywords: [ + 'AI development', + 'web apps', + 'code generation', + 'WebContainer', + 'AI assistant', + 'AI developer tools', + 'no-code', + 'low-code', + 'application builder', + 'deploy web apps', + 'AI website builder', + ], + authors: [{ name: 'ZapDev Team', url: 'https://zapdev.link' }], + creator: 'ZapDev', + publisher: 'ZapDev', openGraph: { - type: 'website', - locale: 'en_US', - title: 'ZapDev - Build Amazing Apps with AI', + title: 'ZapDev: AI-Powered Development Platform', description: - 'The most powerful AI-driven development platform. Generate, preview, and deploy beautiful applications in seconds.', + 'Generate, preview, and deploy stunning web applications in seconds with our AI-driven development platform.', + url: 'https://zapdev.link', siteName: 'ZapDev', + images: [ + { + url: 'https://zapdev.link/og-image.png', + width: 1200, + height: 630, + alt: 'ZapDev AI-Powered Development Platform', + }, + ], + locale: 'en_US', + type: 'website', }, twitter: { card: 'summary_large_image', - title: 'ZapDev - Build Amazing Apps with AI', + title: 'ZapDev: AI-Powered Development Platform', description: - 'The most powerful AI-driven development platform. Generate, preview, and deploy beautiful applications in seconds.', + 'Generate, preview, and deploy stunning web applications in seconds with our AI-driven development platform.', + creator: '@zapdev', + images: ['https://zapdev.link/twitter-image.png'], + }, + robots: { + index: true, + follow: true, + googleBot: { + index: true, + follow: true, + 'max-video-preview': -1, + 'max-image-preview': 'large', + 'max-snippet': -1, + }, }, icons: { + icon: '/favicon.svg', shortcut: '/favicon.svg', + apple: '/apple-touch-icon.png', }, - formatDetection: { - telephone: false, - }, + manifest: '/site.webmanifest', }; const inter = Inter({ @@ -60,8 +99,6 @@ const inter = Inter({ fallback: ['system-ui', 'arial'], }); - - export default function RootLayout({ children, }: Readonly<{ @@ -71,6 +108,21 @@ export default function RootLayout({ +