diff --git a/apps/desktop/scripts/visual-check.mjs b/apps/desktop/scripts/visual-check.mjs index 4310a4b..55e461e 100644 --- a/apps/desktop/scripts/visual-check.mjs +++ b/apps/desktop/scripts/visual-check.mjs @@ -26,9 +26,9 @@ const workspace = { { id: 'task-2', projectId, title: '检查迷你布局', summary: '验证窄屏下的导航和滚动。', completed: false, owner: '张明', due: null, createdAt: '今天 10:00', completedAt: null, tagId: 'tag-design', tag: '设计' }, ], aiSessions: [{ id: 'old-session', projectId, title: '梳理版本计划', summary: '项目会话', updatedAt: '今天', references: [] }], - notesSources: [ - { id: 'note-1', projectId, kind: 'note', title: '版本规划', updatedAt: '今天', tag: '产品', source: '项目笔记' }, - { id: 'source-1', projectId, kind: 'file', title: '需求说明.pdf', updatedAt: '昨天', tag: '资料', source: '上传文件' }, + documents: [ + { id: 'note-1', projectId, kind: 'markdown', name: '版本规划', extension: '.md', mimeType: 'text/markdown', updatedAt: '今天' }, + { id: 'source-1', projectId, kind: 'file', name: '需求说明.pdf', extension: '.pdf', mimeType: 'application/pdf', updatedAt: '昨天' }, ], cronPlans: [{ id: 'cron-1', projectId, title: '每周复盘', schedule: '0 17 * * 5', nextRun: null, enabled: true, lastResult: '', owner: '张明' }], } diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index bf47886..f4207b2 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -187,7 +187,7 @@ function HomeView({ workspace, openAction }: ViewProps) {
- +
@@ -239,8 +239,8 @@ function NotesView({ session, workspace, refresh }: ViewProps) {
笔记资料项目资料随手可取
{ const file = event.target.files?.[0]; if (!file) return; await uploadSource(session, workspace.project.id, file); await refresh(); event.target.value = '' }} />
- {workspace.notesSources.map((note, index) =>
{note.title}

{note.source || note.kind}

{note.tag || '资料'} · {note.updatedAt}
)} - {!workspace.notesSources.length && } + {workspace.documents.map((document, index) =>
{document.name}

{document.extension || document.mimeType || document.kind}

{document.kind || '资料'} · {document.updatedAt}
)} + {!workspace.documents.length && }
) diff --git a/apps/desktop/src/api.ts b/apps/desktop/src/api.ts index c851320..ae5f784 100644 --- a/apps/desktop/src/api.ts +++ b/apps/desktop/src/api.ts @@ -23,14 +23,14 @@ export type WorkspaceTask = { tag: string } -export type NoteSource = { +export type WorkspaceDocument = { id: string projectId: string kind: string - title: string + name: string + extension: string + mimeType: string updatedAt: string - tag: string - source: string } export type CronPlan = { @@ -48,7 +48,7 @@ export type Workspace = { project: Project & { initials: string; unreadCount: number } tags: Array<{ id: string; name: string }> tasks: WorkspaceTask[] - notesSources: NoteSource[] + documents: WorkspaceDocument[] aiSessions: Array<{ id: string; projectId: string; title: string; summary: string; updatedAt: string; references: string[] }> cronPlans: CronPlan[] } diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsx index 7fbba9d..a94c964 100644 --- a/apps/desktop/src/main.tsx +++ b/apps/desktop/src/main.tsx @@ -5,10 +5,34 @@ import '@arco-design/web-react/dist/css/arco.css' import { App } from './App' import './styles.css' +type ErrorBoundaryState = { error: Error | null } + +class AppErrorBoundary extends React.Component { + state: ErrorBoundaryState = { error: null } + + static getDerivedStateFromError(error: Error): ErrorBoundaryState { + return { error } + } + + render() { + if (this.state.error) { + return ( +
+

页面加载失败

+

请重新登录后再试;如果问题仍出现,请将此信息反馈给管理员。

+

{this.state.error.message}

+ +
+ ) + } + return this.props.children + } +} + ReactDOM.createRoot(document.getElementById('root')!).render( - + , )