/**
* 左侧导航:全局模块 + 当前项目的 7 个环节。
*
* · 折叠轨道(≤900px)只留图标:中文标签放不下一行,两行换行会把 nav 撑到
* 比视口还高,看起来像「按钮消失」,因此标签交给 title / aria-label。
* · 折叠宽度沿用旧样式表里真正生效的那一档(68px / ≤560 66px),
* 主内容区宽度是 calc(100% - 同一个数),两处必须一起改。
* · sticky top 取 --nex-bar:旧样式表尾部又写了一遍 top:0,
* 会把第一个图标藏到顶栏底下,这里统一按顶栏高度让开。
*/
import type { ReactNode } from 'react'
import { NavLink, useLocation } from 'react-router-dom'
import { cn } from '../../lib/cn'
import { modules } from './nav'
import { useCurrentStageNote } from './PipelineConsole'
const NAV_ITEM = cn(
'flex items-center gap-2.5 rounded-tile px-[9px] py-[10px] text-body font-medium text-ink-3 no-underline',
'hover:bg-hover hover:text-ink max-nav:justify-center max-nav:gap-0 max-nav:min-h-[38px] max-nav:px-[2px] max-nav:py-[9px] max-nav:text-center'
)
const NAV_ICON = 'w-[18px] flex-none text-center text-ui text-muted max-nav:w-auto max-nav:text-md'
const NAV_LABEL = 'max-nav:hidden'
function NavItem({ to, icon, label, hint, chosen }: {
to: string; icon: ReactNode; label: string; hint?: string; chosen: boolean
}) {
const text = hint ? `${label}:${hint}` : label
return (
{icon}
{label}
)
}
export function SideNav({ projectId, projectTitle }: { projectId: string; projectTitle: string }) {
const { pathname } = useLocation()
const stageNote = projectId ? useCurrentStageNote(projectId) : ''
return (
)
}
export default SideNav