- 新增 data/view.ts 与 useViewRoute:视图与地址双向同步,支持前进后退 - 条目地址带上所属分组,刷新 / 收藏后「返回」有确定落点 - 服务端只把 /c/** 回落到 index.html,其余路径仍返回 404 - 明细页返回按钮去掉左侧箭头图标
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import type { Project } from '../../api'
|
|
import type { NavTarget } from '../../data/nav'
|
|
import type { Category } from '../../data/types'
|
|
import { CategoryNav } from './CategoryNav'
|
|
import { ProfileCard } from './ProfileCard'
|
|
import { ServicePanel } from './ServicePanel'
|
|
|
|
/**
|
|
* 左侧栏容器:用户资料 + 本地服务面板 + 分类导航。
|
|
* 只负责布局与数据透传,具体内容由三个子组件分别渲染。
|
|
*/
|
|
type SidebarProps = {
|
|
projects: Project[]
|
|
/** 内容目录;侧栏直接由它派生 */
|
|
categories: Category[]
|
|
live: boolean
|
|
refreshing: boolean
|
|
onRefresh: () => void
|
|
activeCategoryId?: string
|
|
activeGroupId?: string
|
|
onNavigate: (target: NavTarget) => void
|
|
}
|
|
|
|
export function Sidebar({
|
|
projects,
|
|
categories,
|
|
live,
|
|
refreshing,
|
|
onRefresh,
|
|
activeCategoryId,
|
|
activeGroupId,
|
|
onNavigate,
|
|
}: SidebarProps) {
|
|
return (
|
|
<aside className="sidebar">
|
|
<ProfileCard />
|
|
|
|
<ServicePanel
|
|
projects={projects}
|
|
live={live}
|
|
refreshing={refreshing}
|
|
onRefresh={onRefresh}
|
|
/>
|
|
|
|
<CategoryNav
|
|
categories={categories}
|
|
activeCategoryId={activeCategoryId}
|
|
activeGroupId={activeGroupId}
|
|
onNavigate={onNavigate}
|
|
/>
|
|
</aside>
|
|
)
|
|
}
|