返回 AiToEarn
types.ts
1 /**
2 * LayoutSidebar - 侧边栏共享类型定义
3 */
4
5 import type { SettingsTab } from '@/store/settingsModal'
6
7 /** 侧边栏通用 Props */
8 export interface SidebarCommonProps {
9 /** 是否收缩状态 */
10 collapsed: boolean
11 }
12
13 /** 底部功能区回调 Props */
14 export interface BottomSectionCallbacks {
15 /** 打开设置弹框 */
16 onOpenSettings: (defaultTab?: SettingsTab) => void
17 }
18
19 /** 底部功能区 Props */
20 export interface BottomSectionProps extends SidebarCommonProps, BottomSectionCallbacks {}
21
22 /** 用户区域 Props */
23 export interface UserSectionProps extends SidebarCommonProps {
24 /** 登录回调 */
25 onLogin: () => void
26 /** 打开设置弹框 */
27 onOpenSettings: (defaultTab?: SettingsTab) => void
28 }
29
30 /** Logo 区域 Props */
31 export interface LogoSectionProps extends SidebarCommonProps {
32 /** 展开/收缩回调 */
33 onToggle: () => void
34 }
35
36 /** 导航项数据类型 */
37 export interface NavItemData {
38 path?: string
39 translationKey: string
40 icon?: React.ReactNode
41 children?: NavItemData[]
42 }
43
44 /** 导航区域 Props */
45 export interface NavSectionProps extends SidebarCommonProps {
46 /** 导航项列表 */
47 items: NavItemData[]
48 /** 当前激活的路由 */
49 currentRoute: string
50 }
51
52 /** 用户下拉菜单 Props */
53 export interface UserDropdownMenuProps extends SidebarCommonProps {
54 /** 打开设置弹框 */
55 onOpenSettings: (defaultTab?: SettingsTab) => void
56 }
57
57 lines TYPESCRIPT