import { auth } from "@clerk/nextjs/server"; import { getTranslations } from "next-intl/server"; import { redirect } from "next/navigation"; import Link from "next/link"; import Image from "next/image"; import { PawPrint, HeartPulse, MessageCircle, Images } from "lucide-react"; import { LanguageSwitcher } from "@/components/i18n/LanguageSwitcher"; /** * Root route (/) — public landing page for logged-out visitors, redirects * to /feed for authenticated ones (D-04). * * Previously an unconditional redirect("/feed"), gated entirely by * proxy.ts's auth.protect() — so logged-out visitors AND social-media * crawlers scraping og:image for link previews got bounced to Clerk's * hosted sign-in before Next.js ever rendered this route's metadata. * proxy.ts now leaves "/" out of the protected matcher so this page can * render for everyone; the redirect-when-authenticated check happens here * instead via a plain auth() read (not .protect()). */ export default async function RootPage() { const { userId } = await auth(); if (userId) redirect("/feed"); const t = await getTranslations("Landing"); const features = [ { icon: PawPrint, title: t("feature1Title"), body: t("feature1Body") }, { icon: Images, title: t("feature2Title"), body: t("feature2Body") }, { icon: HeartPulse, title: t("feature3Title"), body: t("feature3Body") }, { icon: MessageCircle, title: t("feature4Title"), body: t("feature4Body") }, ] as const; return (
{/* Header */}
{/* Hero */}
{/* App preview — browser-chrome mockup around a real feed screenshot */}
{t("previewAlt")}
{/* Feature overview */}

{t("featuresHeading")}

{features.map(({ icon: Icon, title, body }) => (

{title}

{body}

))}
{/* Footer */}
); }