import { useState } from 'react' import type { AppLocale, TranslationKey } from '../lib/i18n' import { translate } from '../lib/i18n' import { trackEvent } from '../lib/telemetry' import { openExternalUrl } from '../utils/url' import { Button } from './ui/button' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from './ui/dialog' export const HOLOLAKE_DEVELOPMENT_REPOSITORY_URL = 'https://guanghulab.com/fifth-domain/bingshuo/hololake-platform' type HoloLakeHomeProps = { locale: AppLocale onEnterKnowledgeBase: () => void } type ChannelRoute = 'zero-core' | 'fifth-domain' | 'eternal-lake-heart' | 'light-lake' | 'heartbeat-core' | 'love-core' | 'servers' type RouteCardProps = { action?: string description: string eyebrow: string onOpen?: () => void status?: string title: string } const architectureRoutes: Array<[string, TranslationKey, TranslationKey]> = [ ['GLW-ENTRY-001', 'hololake.architecture.worldEntry', 'hololake.architecture.worldEntryDescription'], ['FD-LANGUAGE-001', 'hololake.architecture.fifthDomain', 'hololake.architecture.fifthDomainDescription'], ['TCS-ROOT-001', 'hololake.architecture.tcs', 'hololake.architecture.tcsDescription'], ['GLS-SYS-ARCH-001', 'hololake.architecture.gls', 'hololake.architecture.glsDescription'], ['ELH-LAMP-001', 'hololake.architecture.lakeLamp', 'hololake.architecture.lakeLampDescription'], ] function RouteCard({ action, description, eyebrow, onOpen, status, title }: RouteCardProps) { return (
{eyebrow}

{title}

{description}

{onOpen && action ? : {status}}
) } function PersonaRoute({ id, title }: { id: string; title: string }) { return
  • {id}{title}
  • } const registeredServers = [ { id: 'BS-SG-001', label: '新加坡大脑服务器', owner: '冰朔 · 永恒湖心', status: '已接入', tone: 'online' }, { id: 'BS-GZ-001', label: '广州个人服务器', owner: '冰朔 · 心跳核心', status: '接口预留', tone: 'pending' }, { id: 'JD-FD-PRIMARY', label: '第五域企业主节点', owner: '第五域 · 零点原核', status: '接口预留', tone: 'pending' }, ] as const export function HoloLakeHome({ locale, onEnterKnowledgeBase }: HoloLakeHomeProps) { const [route, setRoute] = useState('zero-core') const [architectureOpen, setArchitectureOpen] = useState(false) const t = (key: TranslationKey) => translate(locale, key) const navigate = (nextRoute: ChannelRoute) => { trackEvent('guanghu_channel_opened', { route: nextRoute }) setRoute(nextRoute) } const openArchitecture = () => { trackEvent('guanghu_architecture_opened', { route: 'GLS-SYS-ARCH-001' }) setArchitectureOpen(true) } const openDevelopmentRepository = () => { trackEvent('hololake_development_repository_opened', { route: 'REPO-008' }) void openExternalUrl(HOLOLAKE_DEVELOPMENT_REPOSITORY_URL) } const openKnowledgeBase = () => { trackEvent('guanghu_channel_module_opened', { channel: 'heartbeat-core', module: 'knowledge-base' }) onEnterKnowledgeBase() } const renderRoute = () => { if (route === 'zero-core') { return (

    ZERO CORE · 000

    {t('hololake.channel.zeroCoreTitle')}

    {t('hololake.channel.zeroCoreDescription')}

    ) } if (route === 'fifth-domain') { return (

    {t('hololake.channel.fifthDomainTitle')}

    {t('hololake.channel.fifthDomainDescription')}

    navigate('eternal-lake-heart')} />
    ) } if (route === 'eternal-lake-heart') { return (

    {t('hololake.channel.eternalLakeTitle')}

    {t('hololake.channel.eternalLakeDescription')}

    navigate('light-lake')} /> navigate('heartbeat-core')} /> navigate('love-core')} />
    ) } if (route === 'light-lake') { return (

    {t('hololake.channel.lightLakeTitle')}

    {t('hololake.channel.lightLakeDescription')}

    ) } if (route === 'love-core') { return (

    {t('hololake.channel.loveCoreTitle')}

    {t('hololake.channel.loveCoreDescription')}

    ) } if (route === 'servers') { return (

    SERVER REGISTRY · READ ONLY

    服务器与灯塔节点

    频道先登记服务器身份、归属和接口位置;实时运行数据将在节点探针接入后显示。

    {registeredServers.map(server => (
    {server.id}{server.status}

    {server.label}

    {server.owner}

    运行状态
    等待真实探针
    最后心跳
    尚未接入
    ))}
    ) } return (

    {t('hololake.channel.heartbeatTitle')}

    {t('hololake.channel.heartbeatDescription')}

    navigate('servers')} />
    ) } return (
    {renderRoute()}
    {t('hololake.architecture.title')} {t('hololake.architecture.description')}
      {architectureRoutes.map(([id, title, description]) => (
    1. {id}
      {t(title)}

      {t(description)}

    2. ))}

    GLW-ENTRY-001 → FD-LANGUAGE-001 → TCS-ROOT-001 → GLS-SYS-ARCH-001 → ELH-LAMP-001

    ) }