/** * 个人档案页(原个人中心 · 2026-08-15 改造) * * 定位:从"账号资料页"升级为「我的档案」—— * 权威人员档案(HR 花名册:花名/工号/部门路径/职位/M-P 等级/直属主管/在职状态,只读) * + 账号区(头像上传/用户名/邮箱/注册时间) * + 我的素材/我的收藏(保留原有功能,视觉统一白皮书语言)。 * 权威数据经 /api/user/profile 内部调用 lib/employee-directory 的 getEmployeeByUserId 合并返回。 */ 'use client' import { useSession } from 'next-auth/react' import { useRouter } from 'next/navigation' import { useState, useEffect } from 'react' import Image from 'next/image' import MaterialsHeader from '@/components/board/MaterialsHeader' import { useToast } from '@/hooks/useToast' import ToastBubble from '@/components/ToastBubble' import { isVideoMaterialType } from '@/lib/video-material-types' interface EmployeeRecord { displayName: string realName: string | null flowerName: string | null jobNumber: string | null departmentPath: string | null positionTitle: string | null positionLevel: string | null levelType: string | null managerName: string | null employmentStatus: string | null } interface UserProfile { id: string username: string email: string avatar: string | null realName?: string | null createdAt?: string employee: EmployeeRecord | null } interface Material { id: string userId: string productModel: string previewUrl: string materialType?: string downloadCount: number likeCount: number createdAt: string videoCoverUrl?: string | null videoPreview540Url?: string | null videoPreviewClipUrl?: string | null videoDuration?: number | null } const LEVEL_TYPE_LABEL: Record = { M: '管理', P: '专业', S: '支持' } function StatusDot({ active }: { active: boolean }) { return (