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 } const modules: Array<{ title: TranslationKey description: TranslationKey action: TranslationKey kind: 'knowledge' | 'architecture' | 'repository' | 'authorization' }> = [ { title: 'hololake.home.moduleKnowledgeTitle', description: 'hololake.home.moduleKnowledgeDescription', action: 'hololake.home.enterKnowledge', kind: 'knowledge' }, { title: 'hololake.home.moduleArchitectureTitle', description: 'hololake.home.moduleArchitectureDescription', action: 'hololake.home.openArchitecture', kind: 'architecture' }, { title: 'hololake.home.moduleRepositoryTitle', description: 'hololake.home.moduleRepositoryDescription', action: 'hololake.home.openRepository', kind: 'repository' }, { title: 'hololake.home.moduleAuthorizationTitle', description: 'hololake.home.moduleAuthorizationDescription', action: 'hololake.home.authorizationStatus', kind: 'authorization' }, ] 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'], ] export function HoloLakeHome({ locale, onEnterKnowledgeBase }: HoloLakeHomeProps) { const [architectureOpen, setArchitectureOpen] = useState(false) const t = (key: TranslationKey) => translate(locale, key) 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 runModuleAction = (kind: typeof modules[number]['kind']) => { if (kind === 'knowledge') onEnterKnowledgeBase() if (kind === 'architecture') openArchitecture() if (kind === 'repository') openDevelopmentRepository() } return (
{t('hololake.home.worldRoot')}SYS-GLW-0001{t('hololake.home.resolved')}
{t('hololake.home.domesticNode')}JD-FD-PRIMARY{t('hololake.home.primaryRoute')}
{t('hololake.home.executionSafety')}{t('hololake.home.humanInLoop')}{t('hololake.home.noExecutionWithoutAuthorization')}
01 / {t('hololake.home.systemEntry')}

{t('hololake.home.sectionCopy')}

{modules.map(({ title, description, action, kind }, index) => (
0{index + 1}

{t(title)}

{t(description)}

{kind === 'authorization' ? {t(action)} : }
))}
{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

) }