"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import { SITE_CONFIG } from "../config/course"; import { isPaid } from "../lib/payment"; import { triggerPay } from "@/app/lib/triggerPay"; import { ThemeToggle } from "@/app/components/ThemeToggle"; export function Header() { const [paid, setPaid] = useState(false); useEffect(() => { setPaid(isPaid()); const onPayUpdate = () => setPaid(isPaid()); window.addEventListener("pay:updated", onPayUpdate); return () => window.removeEventListener("pay:updated", onPayUpdate); }, []); return (
{SITE_CONFIG.brand}
{paid ? ( 即时问答 ) : ( 即时问答 )} 首页 {paid ? ( 进入课程 → ) : ( )} {paid ? ( ) : ( )}
); }