feat(web): consolidate product IA shell
Some checks failed
Code Review / ai-code-review (push) Successful in 18s
CD Pipeline / tests (push) Failing after 1m37s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Ansible / Reboot Recovery Contract / validate (push) Has been cancelled

This commit is contained in:
Your Name
2026-06-26 18:30:46 +08:00
parent 91d566a4bb
commit 6814104aaa
14 changed files with 806 additions and 648 deletions

View File

@@ -18,22 +18,15 @@ import { useTranslations } from 'next-intl'
import { useRouter, usePathname } from 'next/navigation'
import { useLocale } from 'next-intl'
import {
Activity,
BookOpen,
BrainCircuit,
ClipboardList,
GitBranch,
Home,
Radar,
Search,
Settings,
ShieldCheck,
Terminal,
Wrench,
Zap,
} from 'lucide-react'
import { useTerminalStore } from '@/stores/terminal.store'
import { Z_INDEX } from '@/lib/constants/z-index'
import {
PRODUCT_BOTTOM_NAV_ITEMS,
PRODUCT_NAV_SECTIONS,
} from '@/lib/navigation/product-ia'
interface PaletteItem {
id: string
@@ -45,8 +38,18 @@ interface PaletteItem {
secondary?: boolean
}
const COMMAND_PALETTE_PRIMARY_NAV_IDS = new Set([
'command-center',
'awooop-overview',
'observability',
'iwooos-security',
'knowledge-automation',
'operations',
])
export function CommandPalette() {
const t = useTranslations('commandPalette')
const tNav = useTranslations('nav')
const router = useRouter()
const locale = useLocale()
const pathname = usePathname()
@@ -63,6 +66,29 @@ export function CommandPalette() {
setOpen(false)
}
const navigationItems: PaletteItem[] = [
...PRODUCT_NAV_SECTIONS.flatMap(section => section.items),
...PRODUCT_BOTTOM_NAV_ITEMS,
].map((item) => {
const path = item.href === '/' ? '' : item.href
return {
id: `nav-${item.id}`,
label: tNav(item.labelKey),
group: t('groupNav'),
icon: <item.Icon size={14} />,
action: () => nav(path),
keywords: [
item.id,
item.href,
item.labelKey,
...(item.aliases ?? []),
...(item.relatedPaths ?? []),
],
secondary: !COMMAND_PALETTE_PRIMARY_NAV_IDS.has(item.id),
}
})
const items: PaletteItem[] = [
// 快速動作
{
@@ -73,146 +99,7 @@ export function CommandPalette() {
action: () => { openTerminal(); setOpen(false) },
keywords: ['terminal', '終端', 'omni', 'cmd', '指令'],
},
// 導航
{
id: 'home',
label: t('actionGoHome'),
group: t('groupNav'),
icon: <Home size={14} />,
action: () => nav(''),
keywords: ['home', '首頁', '指令中心', 'dashboard'],
},
{
id: 'approvals',
label: t('actionGoApprovals'),
group: t('groupNav'),
icon: <Zap size={14} />,
action: () => nav('/authorizations'),
keywords: ['授權', 'approve', '批准', 'authorization'],
secondary: true,
},
{
id: 'observability',
label: t('actionGoObservability'),
group: t('groupNav'),
icon: <Activity size={14} />,
action: () => nav('/observability'),
keywords: ['observability', '可觀測性', 'monitor', '監控'],
},
{
id: 'awooop-home',
label: t('actionGoAwoooP'),
group: t('groupNav'),
icon: <BrainCircuit size={14} />,
action: () => nav('/awooop'),
keywords: ['awooop', 'operator', 'console', '操作控制台', '總覽'],
},
{
id: 'knowledge-automation',
label: t('actionGoKnowledgeAutomation'),
group: t('groupNav'),
icon: <BookOpen size={14} />,
action: () => nav('/knowledge-base'),
keywords: ['knowledge', 'automation', '自動化', '知識', 'kb', 'playbook', 'runbook'],
},
{
id: 'governance-security',
label: t('actionGoGovernanceSecurity'),
group: t('groupNav'),
icon: <ShieldCheck size={14} />,
action: () => nav('/governance'),
keywords: ['governance', 'security', 'iwooos', 'code review', '治理', '安全', '資安', '審查'],
},
{
id: 'awooop-work-items',
label: t('actionGoWorkItems'),
group: t('groupNav'),
icon: <ClipboardList size={14} />,
action: () => nav('/awooop/work-items'),
keywords: ['work items', '工作鏈路', '工作項', 'recurrence'],
secondary: true,
},
{
id: 'awooop-runs',
label: t('actionGoRuns'),
group: t('groupNav'),
icon: <Activity size={14} />,
action: () => nav('/awooop/runs'),
keywords: ['runs', 'run monitor', '執行監控', 'run 監控'],
secondary: true,
},
{
id: 'awooop-approvals',
label: t('actionGoApprovalQueue'),
group: t('groupNav'),
icon: <ShieldCheck size={14} />,
action: () => nav('/awooop/approvals'),
keywords: ['approval queue', '審批佇列', '人工閘門', 'approve'],
secondary: true,
},
{
id: 'automation',
label: t('actionGoAutomation'),
group: t('groupNav'),
icon: <Wrench size={14} />,
action: () => nav('/automation'),
keywords: ['automation', '自動化', 'auto'],
secondary: true,
},
{
id: 'operations',
label: t('actionGoOperations'),
group: t('groupNav'),
icon: <GitBranch size={14} />,
action: () => nav('/operations'),
keywords: ['operations', '營運', 'ops'],
},
{
id: 'iwooos',
label: t('actionGoIwooos'),
group: t('groupNav'),
icon: <Radar size={14} />,
action: () => nav('/iwooos'),
keywords: [
'iwooos',
'information security',
'security',
'安全',
'安全合規',
'compliance',
'合規',
'資安網',
'資安態勢',
],
secondary: true,
},
{
id: 'knowledge',
label: t('actionGoKnowledge'),
group: t('groupNav'),
icon: <BookOpen size={14} />,
action: () => nav('/knowledge-base'),
keywords: ['knowledge', '知識', '殿堂', 'kb'],
secondary: true,
},
{
id: 'settings',
label: t('actionGoSettings'),
group: t('groupNav'),
icon: <Settings size={14} />,
action: () => nav('/settings'),
keywords: ['settings', '設定', 'config'],
secondary: true,
},
{
id: 'terminal-page',
label: t('actionGoTerminal'),
group: t('groupNav'),
icon: <Terminal size={14} />,
action: () => nav('/terminal'),
keywords: ['terminal', '終端', 'shell'],
secondary: true,
},
...navigationItems,
]
const filtered = query.trim() === ''