"use client"; import { useEffect, useMemo, useState } from "react"; import mockData from "./data/mock-data.json"; type View = "overview" | "components" | "content" | "board" | "schedule"; type Toast = { id: number; message: string }; type BoardColumn = (typeof mockData.board)[number]; const navGroups = [ { label: "工作台", items: [ { id: "overview" as View, icon: "⌂", label: "概览" }, { id: "components" as View, icon: "◈", label: "组件样式", badge: "18" }, ], }, { label: "业务管理", items: [ { id: "content" as View, icon: "▤", label: "内容管理", children: ["图文列表", "卡片内容", "分类标签"] }, { id: "board" as View, icon: "▦", label: "流程泳道", badge: "9" }, { id: "schedule" as View, icon: "◷", label: "定时任务" }, ], }, { label: "系统设置", items: [ { id: "components" as View, icon: "♙", label: "成员与权限" }, { id: "components" as View, icon: "⚙", label: "基础设置" }, ], }, ]; const pageMeta: Record = { overview: { title: "下午好,林知夏", subtitle: "这里是团队今天的工作概览,祝你高效完成每一项计划。" }, components: { title: "组件样式", subtitle: "可直接复用的标签、按钮、菜单与交互状态。" }, content: { title: "内容管理", subtitle: "通过图片文字列表与卡片视图管理业务内容。" }, board: { title: "流程泳道", subtitle: "拖动任务卡片,快速同步团队当前进度。" }, schedule: { title: "定时任务", subtitle: "纯前端模拟任务配置、状态切换与执行记录。" }, }; export default function Home() { const [activeView, setActiveView] = useState("overview"); const [expandedMenus, setExpandedMenus] = useState(["内容管理"]); const [sidebarOpen, setSidebarOpen] = useState(false); const [search, setSearch] = useState(""); const [toasts, setToasts] = useState([]); const [board, setBoard] = useState(mockData.board); const [dragged, setDragged] = useState<{ cardId: string; columnId: string } | null>(null); const [schedules, setSchedules] = useState(mockData.schedules); const [scheduleModal, setScheduleModal] = useState(false); const [profileOpen, setProfileOpen] = useState(false); useEffect(() => { const saved = window.localStorage.getItem("orbit-schedules"); if (saved) { try { setSchedules(JSON.parse(saved)); } catch { window.localStorage.removeItem("orbit-schedules"); } } }, []); useEffect(() => { window.localStorage.setItem("orbit-schedules", JSON.stringify(schedules)); }, [schedules]); const notify = (message: string) => { const id = Date.now(); setToasts((current) => [...current, { id, message }]); window.setTimeout(() => setToasts((current) => current.filter((item) => item.id !== id)), 2600); }; const navigate = (view: View) => { setActiveView(view); setSidebarOpen(false); setSearch(""); }; const filteredProjects = useMemo( () => mockData.projects.filter((project) => `${project.title}${project.description}${project.tag}`.toLowerCase().includes(search.toLowerCase())), [search], ); const moveCard = (targetColumnId: string) => { if (!dragged || dragged.columnId === targetColumnId) return; let movingCard: BoardColumn["cards"][number] | undefined; const nextBoard = board.map((column) => { if (column.id !== dragged.columnId) return column; movingCard = column.cards.find((card) => card.id === dragged.cardId); return { ...column, cards: column.cards.filter((card) => card.id !== dragged.cardId) }; }); if (!movingCard) return; setBoard(nextBoard.map((column) => column.id === targetColumnId ? { ...column, cards: [...column.cards, movingCard!] } : column)); setDragged(null); notify("任务状态已更新"); }; const toggleSchedule = (id: number) => { setSchedules((current) => current.map((schedule) => schedule.id === id ? { ...schedule, enabled: !schedule.enabled } : schedule)); notify("任务状态已保存到本地"); }; return (
{sidebarOpen &&
{profileOpen &&
}

{activeView === "overview" ? "2026 年 8 月 7 日 · 星期五" : "WBBR STYLE TEMPLATE"}

{pageMeta[activeView].title}

{pageMeta[activeView].subtitle}

{activeView === "overview" && } {activeView === "components" && } {activeView === "content" && } {activeView === "board" && } {activeView === "schedule" && setScheduleModal(true)} />}
{scheduleModal && setScheduleModal(false)} onSave={(name, frequency) => { setSchedules((current) => [...current, { id: Math.max(...current.map((item) => item.id), 0) + 1, name, type: "自定义任务", cron: frequency === "每天" ? "0 9 * * *" : "0 9 * * 1", frequency: frequency === "每天" ? "每天 09:00" : "每周一 09:00", lastRun: "尚未执行", nextRun: frequency === "每天" ? "明天 09:00" : "下周一 09:00", enabled: true, success: 100 }]); setScheduleModal(false); notify("新任务已保存到本地"); }} />}
{toasts.map((toast) =>
{toast.message}
)}
); } function Overview({ onNavigate, notify }: { onNavigate: (view: View) => void; notify: (message: string) => void }) { return ( <>
{mockData.stats.map((stat, index) =>
{["▣", "✓", "♙", "↗"][index]}

{stat.label}

{stat.value}
{stat.change}
)}
onNavigate("content")} />
{mockData.projects.map((project) =>
{project.title}{project.status}

{project.description}

{project.progress}%
{project.owner.slice(-1)}{project.owner}{project.date}
)}
onNavigate("board")} />
{[["评审新版工作台原型", "10:00", true], ["与研发确认排期", "11:30", true], ["整理组件规范文档", "14:00", false], ["增长实验周会", "16:30", false]].map(([title, time, done]) => )}
notify("暂无更多动态")} />
{[["周", "周屿", "完成了任务", "后台筛选器交互优化", "12 分钟前", "green"], ["许", "许言", "上传了文件", "八月增长计划-v3.pdf", "35 分钟前", "blue"], ["陈", "陈序", "评论了", "确认新用户引导文案", "1 小时前", "orange"], ["林", "林知夏", "创建了项目", "新版工作台视觉升级", "2 小时前", "purple"]].map(([avatar, name, verb, target, time, tone]) =>
{avatar}

{name} {verb} {target}{time}

)}
); } function ComponentsShowcase({ notify }: { notify: (message: string) => void }) { const [tab, setTab] = useState("基础组件"); return (
{["基础组件", "状态样式", "菜单示例"].map((item) => )}
{tab === "基础组件" && <>
进行中已完成待处理评审中已逾期默认标签可关闭 ×
} {tab === "状态样式" &&
保存成功你的修改已经同步到本地。
i版本提示这是一个纯前端 JSON 数据模板。
!注意浏览器缓存清除后,本地修改将会重置。
×操作失败请检查必填字段后重试。
} {tab === "菜单示例" &&

项目操作


快速前往

最近访问
}
); } function ContentView({ projects, notify }: { projects: typeof mockData.projects; notify: (message: string) => void }) { const [display, setDisplay] = useState<"list" | "cards">("list"); return (
{projects.length === 0 ?

没有找到匹配内容

试试更换搜索关键词。

: display === "list" ?
{projects.map((project) =>
{`${project.title}项目配图`}
{project.tag}{project.status}

{project.title}

{project.description}

负责人 {project.owner} · 截止 {project.date}
{project.progress}%
)}
:
{projects.map((project) =>
{project.tag}
{project.status}

{project.title}

{project.description}

{project.owner.slice(-1)}{project.owner}{project.progress}%
)}
}
); } function BoardView({ board, dragged, setDragged, moveCard, notify }: { board: BoardColumn[]; dragged: { cardId: string; columnId: string } | null; setDragged: (value: { cardId: string; columnId: string } | null) => void; moveCard: (columnId: string) => void; notify: (message: string) => void }) { return <>
+8
{board.map((column) =>
event.preventDefault()} onDrop={() => moveCard(column.id)}>
{column.title}{column.cards.length}
{column.cards.map((card) =>
setDragged({ cardId: card.id, columnId: column.id })} onDragEnd={() => setDragged(null)}>
{card.id}

{card.title}

{card.tag}{card.priority === "紧急" && 紧急}
{card.owner.slice(-1)}{card.owner}
)}
)}
; } function ScheduleView({ schedules, toggleSchedule, notify, onCreate }: { schedules: typeof mockData.schedules; toggleSchedule: (id: number) => void; notify: (message: string) => void; onCreate: () => void }) { const activeCount = schedules.filter((item) => item.enabled).length; return <>

任务总数{schedules.length}

运行中{activeCount}

本月执行128

平均成功率98.5%

{schedules.map((schedule) => )}
任务名称执行规则最近执行下次执行成功率状态
{schedule.type === "消息通知" ? "✧" : schedule.type === "文件归档" ? "▤" : "↻"}
{schedule.name}{schedule.type}
{schedule.frequency}{schedule.cron}{schedule.lastRun}{schedule.nextRun}{schedule.success}%{schedule.enabled ? "运行中" : "已停用"}
; } function ScheduleModal({ onClose, onSave }: { onClose: () => void; onSave: (name: string, frequency: string) => void }) { const [name, setName] = useState(""); const [frequency, setFrequency] = useState("每天"); return
event.stopPropagation()} onSubmit={(event) => { event.preventDefault(); if (name.trim()) onSave(name.trim(), frequency); }}>

新建定时任务

配置完成后会保存到当前浏览器。

执行频率
; } function PanelHeader({ title, subtitle, action, onAction }: { title: string; subtitle: string; action?: string; onAction?: () => void }) { return

{title}

{subtitle}

{action && }
; }