"use client"; import Link from "next/link"; import { BookOpen, BrainCircuit, Compass, Lock, Sparkles } from "lucide-react"; import { ZenCard } from "@/components/ui/zen-card"; import { useAuth } from "@/components/auth/auth-provider"; const MODULES = [ { href: "/learn", title: "易经学习", description: "64 卦卡片择读,繁体精简与简体图文", icon: BookOpen, accent: "from-amber-500/10 to-transparent", protected: false, }, { href: "/liuyao", title: "六爻算卦", description: "三钱法起卦,卦辞 AI 智能解读", icon: Sparkles, accent: "from-stone-500/10 to-transparent", protected: true, }, { href: "/bazi", title: "生辰八字", description: "四柱排盘,十神大运,AI 命理解读", icon: BrainCircuit, accent: "from-zinc-500/10 to-transparent", protected: true, }, { href: "/combined", title: "综合测算", description: "天时地利人和,六爻可选", icon: Compass, accent: "from-neutral-500/10 to-transparent", protected: true, }, ] as const; export default function HomeModules() { const { authEnabled, loggedIn } = useAuth(); return (
{MODULES.map(({ href, title, description, icon: Icon, accent, protected: locked }) => { const needLogin = locked && authEnabled && !loggedIn; const targetHref = needLogin ? `/login?next=${encodeURIComponent(href)}` : href; return ( {needLogin && ( )}
{title}

{description} {needLogin && "(登录后可用)"}

); })}
); }