"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Bot, BookOpen, Users, Wand2, LineChart, ScrollText, Globe, LayoutDashboard, FileText, ArrowRight, ChevronLeft, ChevronRight, MessageSquare, Github, Mail, } from "lucide-react"; import { ScreenshotDisplay } from "@/components/ScreenshotDisplay"; import { ChatWidget } from "@/components/visitor/ChatWidget"; import { FloatingButton } from "@/components/visitor/FloatingButton"; import { Header } from "@/components/layout/Header"; import { Footer } from "@/components/layout/Footer"; import { FadeIn, FadeInStagger, FadeInItem } from "@/components/ui/fade-in"; import { websiteConfig } from "@/lib/website-config"; import { getOrCreateVisitorId } from "@/lib/visitor-id"; import { stats } from "@/lib/stats-config"; import type { I18nKey } from "@/lib/i18n/dict"; import { useI18n } from "@/lib/i18n/provider"; import type { LucideIcon } from "lucide-react"; const CAPABILITY_ITEMS: { icon: LucideIcon; titleKey: I18nKey; descKey: I18nKey; }[] = [ { icon: Bot, titleKey: "home.cap.multimodel.title", descKey: "home.cap.multimodel.desc" }, { icon: BookOpen, titleKey: "home.cap.kb.title", descKey: "home.cap.kb.desc" }, { icon: Wand2, titleKey: "home.cap.prompt.title", descKey: "home.cap.prompt.desc" }, { icon: Users, titleKey: "home.cap.human.title", descKey: "home.cap.human.desc" }, { icon: LineChart, titleKey: "home.cap.reports.title", descKey: "home.cap.reports.desc" }, { icon: ScrollText, titleKey: "home.cap.logs.title", descKey: "home.cap.logs.desc" }, ]; const QUICK_STEPS: { titleKey: I18nKey; bodyKey: I18nKey }[] = [ { titleKey: "home.step1.title", bodyKey: "home.step1.body" }, { titleKey: "home.step2.title", bodyKey: "home.step2.body" }, { titleKey: "home.step3.title", bodyKey: "home.step3.body" }, ]; const SCREENSHOT_ITEMS: { slug: string; imageName: string; placeholderIcon: LucideIcon; titleKey: I18nKey; placeholderKey: I18nKey; altKey: I18nKey; }[] = [ { slug: "dashboard", imageName: "dashboard.png", placeholderIcon: LayoutDashboard, titleKey: "home.ss.dashboard.title", placeholderKey: "home.ss.dashboard.placeholder", altKey: "home.ss.dashboard.alt", }, { slug: "visitor", imageName: "visitor.png", placeholderIcon: Globe, titleKey: "home.ss.visitor.title", placeholderKey: "home.ss.visitor.placeholder", altKey: "home.ss.visitor.alt", }, { slug: "ai-config", imageName: "ai-config.png", placeholderIcon: Bot, titleKey: "home.ss.aiconfig.title", placeholderKey: "home.ss.aiconfig.placeholder", altKey: "home.ss.aiconfig.alt", }, { slug: "users", imageName: "users.png", placeholderIcon: Users, titleKey: "home.ss.users.title", placeholderKey: "home.ss.users.placeholder", altKey: "home.ss.users.alt", }, { slug: "faq", imageName: "faq.png", placeholderIcon: FileText, titleKey: "home.ss.faq.title", placeholderKey: "home.ss.faq.placeholder", altKey: "home.ss.faq.alt", }, { slug: "knowledge", imageName: "knowledge.png", placeholderIcon: BookOpen, titleKey: "home.ss.knowledge.title", placeholderKey: "home.ss.knowledge.placeholder", altKey: "home.ss.knowledge.alt", }, { slug: "conversations", imageName: "conversations.png", placeholderIcon: MessageSquare, titleKey: "home.ss.kbtest.title", placeholderKey: "home.ss.kbtest.placeholder", altKey: "home.ss.kbtest.alt", }, { slug: "prompts", imageName: "prompts.png", placeholderIcon: Wand2, titleKey: "home.ss.prompts.title", placeholderKey: "home.ss.prompts.placeholder", altKey: "home.ss.prompts.alt", }, { slug: "logs", imageName: "logs.png", placeholderIcon: ScrollText, titleKey: "home.ss.logs.title", placeholderKey: "home.ss.logs.placeholder", altKey: "home.ss.logs.alt", }, { slug: "analytics", imageName: "analytics.png", placeholderIcon: LineChart, titleKey: "home.ss.analytics.title", placeholderKey: "home.ss.analytics.placeholder", altKey: "home.ss.analytics.alt", }, ]; export function HomePageClient() { const { t } = useI18n(); const [visitorId, setVisitorId] = useState(null); const [isChatOpen, setIsChatOpen] = useState(false); const [activeScreenshot, setActiveScreenshot] = useState(0); useEffect(() => { setVisitorId(getOrCreateVisitorId()); }, []); useEffect(() => { const params = new URLSearchParams(window.location.search); if (params.get("openChat") === "1") { handleOpenChat(); params.delete("openChat"); const next = `${window.location.pathname}${params.toString() ? `?${params}` : ""}`; window.history.replaceState(null, "", next); } // eslint-disable-next-line react-hooks/exhaustive-deps -- 仅响应 URL 参数 }, [visitorId]); const handleToggleChat = () => setIsChatOpen((prev) => !prev); const handleOpenChat = () => { if (visitorId === null) { setTimeout(() => setIsChatOpen(true), 500); } else { setIsChatOpen(true); } }; const totalScreenshots = SCREENSHOT_ITEMS.length; const prevScreenshotIndex = (activeScreenshot - 1 + totalScreenshots) % totalScreenshots; const nextScreenshotIndex = (activeScreenshot + 1) % totalScreenshots; const goPrevScreenshot = () => { setActiveScreenshot((prev) => (prev - 1 + totalScreenshots) % totalScreenshots); }; const goNextScreenshot = () => { setActiveScreenshot((prev) => (prev + 1) % totalScreenshots); }; useEffect(() => { const timer = window.setInterval(() => { setActiveScreenshot((prev) => (prev + 1) % totalScreenshots); }, 4800); return () => window.clearInterval(timer); }, [totalScreenshots]); return (
{/* Hero(回归旧版文案气质,保留新版三按钮) */}

{t("home.hero.tagline")}

{t("home.hero.title")}

{t("home.hero.subtitle")}

{t("home.hero.hint")}

{/* 数字条(沿用旧版) */}

{t("home.stats.trustedBy")}

{stats.map((stat) => (
{t(stat.valueKey)}
{t(stat.labelKey)}
))}
{/* 核心能力 */}

{t("home.features.title")}

{t("home.features.lead")}

{CAPABILITY_ITEMS.map((item) => { const Icon = item.icon; return (
{t(item.titleKey)} {t(item.descKey)}
); })}
{/* 界面展示 */}

{t("home.screenshots.title")}

{t("home.screenshots.lead")}

{SCREENSHOT_ITEMS.map((item, idx) => ( ))}
{/* 左侧半露卡片 */}
{/* 右侧半露卡片 */}
{/* 中间主卡片 */}
{/* 快速接入 */}

{t("home.quickStart.title")}

{t("home.quickStart.lead")}

{QUICK_STEPS.map((step, i) => (
{i + 1}

{t(step.titleKey)}

{t(step.bodyKey)}

))}
{/* 收尾 CTA */}

{t("home.cta.title")}

{t("home.cta.subtitle")}

); }