| 2080 | } |
| 2081 | |
| 2082 | function ProjectGraphWorkspace(props: { |
| 2083 | project: SourceRecord | null; |
| 2084 | graph: ProjectGraphRecord | null; |
| 2085 | onOpenEvent: (eventId: string) => void; |
| 2086 | onOpenEntity: (entityId: string) => void; |
| 2087 | }) { |
| 2088 | const { t, language } = useI18n(); |
| 2089 | const graph = props.graph; |
| 2090 | |
| 2091 | if (!props.project) { |
| 2092 | return ( |
| 2093 | <section className="flex min-h-0 flex-1 items-center justify-center px-6"> |
| 2094 | <EmptyState title={t("先创建项目", "Create a project first")} description={t("项目里有文档、事件和实体后,图谱会在这里显示。", "The graph appears after the project has documents, events, and entities.")} /> |
| 2095 | </section> |
| 2096 | ); |
| 2097 | } |
| 2098 | |
| 2099 | if (!graph || graph.entities.length === 0 || graph.events.length === 0) { |
| 2100 | return ( |
| 2101 | <section className="flex min-h-0 flex-1 items-center justify-center px-6"> |
| 2102 | <EmptyState title={t("暂无图谱数据", "No graph data yet")} description={t("上传并完成提取后,可以查看实体、事件和关系。", "Upload documents and finish extraction to view entities, events, and relations.")} /> |
| 2103 | </section> |
| 2104 | ); |
| 2105 | } |
| 2106 | |
| 2107 | return ( |
| 2108 | <section className="flex min-h-0 flex-1 p-2 md:p-4"> |
| 2109 | <div className="min-h-0 flex-1"> |
| 2110 | <ProjectGraphFlow |
| 2111 | graph={graph} |
| 2112 | language={language} |
| 2113 | onOpenEvent={props.onOpenEvent} |
| 2114 | onOpenEntity={props.onOpenEntity} |
| 2115 | /> |
| 2116 | </div> |
| 2117 | </section> |
| 2118 | ); |
| 2119 | } |
| 2120 | |
| 2121 | function ActivityPanel(props: { |
| 2122 | className?: string; |