"use client"; import { useState, type KeyboardEvent } from "react"; import Link from "next/link"; import { ArrowRight, QrCode, X } from "lucide-react"; import { useLanguage } from "../i18n/LanguageProvider"; import { cn } from "../lib/utils"; interface GuideStep { text: string; link?: { url: string; label: string }; code?: string; image?: string; } interface HeroCardProps { icon: any; title: string; description: string; guide?: { title: string; steps: GuideStep[]; dismiss: string; }; } export function HeroCard({ icon: Icon, title, description, guide, }: HeroCardProps) { const [showGuide, setShowGuide] = useState(false); const hasGuide = Boolean(guide); const { language } = useLanguage(); const isChinese = language === "zh"; const guideLabel = isChinese ? "查看向导" : "View guide"; const qrTitle = isChinese ? "VLESS 协议就绪" : "VLESS Protocol Ready"; const qrDescription = isChinese ? "在控制台中扫码,即可快速完成连接。" : "Scan the QR code in the control panel to connect automatically."; function openGuide(): void { if (!hasGuide) { return; } setShowGuide(true); } function handleCardKeyDown(event: KeyboardEvent): void { if (!hasGuide) { return; } if (event.key === "Enter" || event.key === " ") { event.preventDefault(); setShowGuide(true); } } return ( <>

{title}

{description}

{hasGuide ? ( {guideLabel} ) : null}
{guide ? (

{guide.title}

{guide.steps.map((step, idx) => (
{idx !== guide.steps.length - 1 ? (
) : null} {idx + 1}

{step.text}

{step.link ? ( {step.link.label} ) : null} {idx === 2 ? (

{qrTitle}

{qrDescription}

) : null}
))}
) : null} ); }