fix(web): restore product navigation coverage
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 24s
CD Pipeline / build-and-deploy (push) Successful in 4m52s
CD Pipeline / post-deploy-checks (push) Successful in 58s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 24s
CD Pipeline / build-and-deploy (push) Successful in 4m52s
CD Pipeline / post-deploy-checks (push) Successful in 58s
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
import React, { useEffect, useRef, useState, useCallback } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useRouter, usePathname } from 'next/navigation'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useLocale } from 'next-intl'
|
||||
import {
|
||||
Search,
|
||||
@@ -26,6 +26,7 @@ import { Z_INDEX } from '@/lib/constants/z-index'
|
||||
import {
|
||||
PRODUCT_BOTTOM_NAV_ITEMS,
|
||||
PRODUCT_NAV_SECTIONS,
|
||||
type ProductNavItem,
|
||||
} from '@/lib/navigation/product-ia'
|
||||
|
||||
interface PaletteItem {
|
||||
@@ -47,12 +48,15 @@ const COMMAND_PALETTE_PRIMARY_NAV_IDS = new Set([
|
||||
'operations',
|
||||
])
|
||||
|
||||
type PaletteNavSource = ProductNavItem & {
|
||||
parentId?: string
|
||||
}
|
||||
|
||||
export function CommandPalette() {
|
||||
const t = useTranslations('commandPalette')
|
||||
const tNav = useTranslations('nav')
|
||||
const router = useRouter()
|
||||
const locale = useLocale()
|
||||
const pathname = usePathname()
|
||||
const { openTerminal } = useTerminalStore()
|
||||
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -66,10 +70,21 @@ export function CommandPalette() {
|
||||
setOpen(false)
|
||||
}
|
||||
|
||||
const navigationItems: PaletteItem[] = [
|
||||
...PRODUCT_NAV_SECTIONS.flatMap(section => section.items),
|
||||
const navigationSources: PaletteNavSource[] = [
|
||||
...PRODUCT_NAV_SECTIONS.flatMap(section => section.items.flatMap(item => [
|
||||
item,
|
||||
...(item.children ?? []).map(child => ({
|
||||
...child,
|
||||
id: `${item.id}-${child.id}`,
|
||||
Icon: item.Icon,
|
||||
parentId: item.id,
|
||||
surface: 'secondary' as const,
|
||||
})),
|
||||
])),
|
||||
...PRODUCT_BOTTOM_NAV_ITEMS,
|
||||
].map((item) => {
|
||||
]
|
||||
|
||||
const navigationItems: PaletteItem[] = navigationSources.map((item) => {
|
||||
const path = item.href === '/' ? '' : item.href
|
||||
|
||||
return {
|
||||
@@ -82,6 +97,7 @@ export function CommandPalette() {
|
||||
item.id,
|
||||
item.href,
|
||||
item.labelKey,
|
||||
item.parentId ?? '',
|
||||
...(item.aliases ?? []),
|
||||
...(item.relatedPaths ?? []),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user