diff --git a/apps/docs/components/marketing/site-header.tsx b/apps/docs/components/marketing/site-header.tsx index 753ebe02..6dd12886 100644 --- a/apps/docs/components/marketing/site-header.tsx +++ b/apps/docs/components/marketing/site-header.tsx @@ -5,6 +5,8 @@ import Image from 'next/image'; import { useState } from 'react'; import { ChevronDown, Globe, Menu, X } from 'lucide-react'; import type { Dictionary, Locale } from '@/lib/i18n'; +import { TrialDialog } from './trial-dialog'; +import { locales } from '@/lib/i18n'; const localeLabels: Record = { en: 'English', @@ -14,6 +16,8 @@ const localeLabels: Record = { export function SiteHeader({ locale, dict }: { locale: Locale; dict: Dictionary }) { const [mobileOpen, setMobileOpen] = useState(false); const [productsOpen, setProductsOpen] = useState(false); + const [languageOpen, setLanguageOpen] = useState(false); + const [trialDialogOpen, setTrialDialogOpen] = useState(false); const productLinks = [ { href: `/${locale}/products/sales`, label: dict.nav.salesCloud }, @@ -54,7 +58,7 @@ export function SiteHeader({ locale, dict }: { locale: Locale; dict: Dictionary {productsOpen && (
{ if (e.key === 'Escape') setProductsOpen(false); @@ -86,21 +90,52 @@ export function SiteHeader({ locale, dict }: { locale: Locale; dict: Dictionary {dict.nav.github} - setLanguageOpen(true)} + onMouseLeave={() => setLanguageOpen(false)} > -
- setTrialDialogOpen(true)} className="inline-flex h-9 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90" > {dict.nav.getStarted} - + {/* Mobile Toggle */} @@ -131,17 +166,38 @@ export function SiteHeader({ locale, dict }: { locale: Locale; dict: Dictionary setMobileOpen(false)}> {dict.nav.docs} - setMobileOpen(false)} - aria-label={`Switch to ${localeLabels[otherLocale]}`} +
{dict.nav.language}
+ {locales.map(loc => ( + setMobileOpen(false)} + > + {localeLabels[loc]} + + ))} + )} + + setTrialDialogOpen(false)} + title={locale === 'zh' ? '开始免费试用' : 'Start Free Trial'} + description={locale === 'zh' + ? '体验 HotCRM 的完整功能,无需信用卡。立即访问在线演示环境。' + : 'Experience the full power of HotCRM with no credit card required. Access our online demo environment now.'} + buttonText={locale === 'zh' ? '访问在线演示' : 'Access Online Demo'} + /> ); } diff --git a/apps/docs/components/marketing/trial-dialog.tsx b/apps/docs/components/marketing/trial-dialog.tsx new file mode 100644 index 00000000..a1148649 --- /dev/null +++ b/apps/docs/components/marketing/trial-dialog.tsx @@ -0,0 +1,71 @@ +'use client'; + +import { useState } from 'react'; +import { X } from 'lucide-react'; + +interface TrialDialogProps { + isOpen: boolean; + onClose: () => void; + title: string; + description: string; + buttonText: string; +} + +export function TrialDialog({ isOpen, onClose, title, description, buttonText }: TrialDialogProps) { + if (!isOpen) return null; + + const handleBackdropClick = (e: React.MouseEvent) => { + if (e.target === e.currentTarget) { + onClose(); + } + }; + + const handleStartTrial = () => { + window.open('https://demo.hotcrm.com', '_blank', 'noopener,noreferrer'); + onClose(); + }; + + return ( +
+
+ + +
+

+ {title} +

+

+ {description} +

+ +
+ + +
+
+
+
+ ); +}