diff --git a/src/renderer/components/company-operations/DocumentCenter.tsx b/src/renderer/components/company-operations/DocumentCenter.tsx index d1a8a8af..3a4594bc 100644 --- a/src/renderer/components/company-operations/DocumentCenter.tsx +++ b/src/renderer/components/company-operations/DocumentCenter.tsx @@ -1,7 +1,7 @@ import { useMemo, useState } from "react"; -import { FileText, FloppyDisk, NotePencil, Trash } from "../ui/icons"; +import { FileText, FloppyDisk, NotePencil, Plus, Trash } from "../ui/icons"; import type { AgentRecord, DocumentRecord, GoalRecord, ProjectRecord, WorkProductRecord } from "@shared/types"; -import { ActionButton, ConfirmDialog, InlineNotice, Input, ListFrame, ListRow, Modal, Select, StatusPill, TextArea } from "../ui"; +import { ActionButton, ConfirmDialog, EmptyState, InlineNotice, Input, ListFrame, ListRow, Modal, Select, StatusPill, TextArea } from "../ui"; import { useT } from "../../i18n"; import { documentTypeOptions, documentStatusOptions, splitTags, parseTags } from "./helpers"; import { SectionHeader } from "./SectionHeader"; @@ -120,10 +120,18 @@ export function DocumentCenter({ companyId, documents, workProducts, agents, pro const activeDocument = useMemo(() => documents.find((document) => document.id === editingId) ?? null, [documents, editingId]); const totalCount = documents.length + workProducts.length; + const isEmpty = totalCount === 0; return (
setEditingId(NEW_ENTITY_ID)} /> + {isEmpty ? ( + setEditingId(NEW_ENTITY_ID)} />} + /> + ) : null} {documents.length > 0 ? (
diff --git a/src/renderer/i18n/en.ts b/src/renderer/i18n/en.ts index 4d1dbfaf..4259a660 100644 --- a/src/renderer/i18n/en.ts +++ b/src/renderer/i18n/en.ts @@ -873,6 +873,10 @@ export const en: Record = { "ops.documentCenter": "Document Center", "ops.documentsProse": "Prose documents", "ops.documentsWorkProducts": "Files & deliverables", + "ops.documentsEmptyTitle": "No documents yet", + "ops.documentsEmptyDetail": "Agents register files here automatically when they write to the workspace, and can publish prose documents (PRDs, specs, post-mortems) via POST /api/companies/{id}/documents.", + "ops.documentsEmptyAction": "Create the first document", + "ops.documentsSelectCompany": "Select a company from the workspace switcher to see its documents.", "ops.knowledgeBase": "Knowledge Base", "ops.meetings": "Meetings", "ops.sprintBoard": "Sprint Board", diff --git a/src/renderer/i18n/zh.ts b/src/renderer/i18n/zh.ts index 85a1a47d..ea16f661 100644 --- a/src/renderer/i18n/zh.ts +++ b/src/renderer/i18n/zh.ts @@ -873,6 +873,10 @@ export const zh: Record = { "ops.documentCenter": "文档中心", "ops.documentsProse": "文稿", "ops.documentsWorkProducts": "文件与交付物", + "ops.documentsEmptyTitle": "还没有文档", + "ops.documentsEmptyDetail": "Agent 在 workspace 里写文件时会被自动登记为交付物;结构化文稿(PRD、技术规格、复盘)需要调用 POST /api/companies/{id}/documents 发布。", + "ops.documentsEmptyAction": "创建第一份文档", + "ops.documentsSelectCompany": "请先在工作区切换器中选择一家公司,才能查看它的文档。", "ops.knowledgeBase": "知识库", "ops.meetings": "会议", "ops.sprintBoard": "迭代看板", diff --git a/src/renderer/views/sections/OperationsSections.tsx b/src/renderer/views/sections/OperationsSections.tsx index 12cb254d..092d80a8 100644 --- a/src/renderer/views/sections/OperationsSections.tsx +++ b/src/renderer/views/sections/OperationsSections.tsx @@ -18,7 +18,8 @@ import { DocumentCenter } from "../../components/company-operations/DocumentCent import { KnowledgeBaseManager } from "../../components/company-operations/KnowledgeBaseManager"; import { MeetingsManager } from "../../components/company-operations/MeetingsManager"; import { SprintManager } from "../../components/company-operations/SprintManager"; -import { Panel } from "../../components/ui"; +import { EmptyState, Panel } from "../../components/ui"; +import { useT } from "../../i18n"; import { unwrap } from "../../lib/desktop"; import { useAppStore } from "../../state/store"; import { useSectionContext } from "../../hooks/useSectionContext"; @@ -29,6 +30,7 @@ interface OperationsSectionsProps { } export function OperationsSections({ section }: OperationsSectionsProps) { + const t = useT(); const { snapshot, currentCompany, @@ -212,16 +214,23 @@ export function OperationsSections({ section }: OperationsSectionsProps) { /> ) : null} - {section === "documents" && currentCompany ? ( - + {section === "documents" ? ( + currentCompany ? ( + + ) : ( + + ) ) : null} {section === "knowledge" && currentCompany ? (