MCPcopy Create free account
hub / github.com/Nimrobo/superdense / WorkThreadView

Function WorkThreadView

packages/web/src/components/WorkThreadView.tsx:12–50  ·  view source on GitHub ↗
({ id, onBack, onOpenSession }: Props)

Source from the content-addressed store, hash-verified

10}
11
12export function WorkThreadView({ id, onBack, onOpenSession }: Props) {
13 const [thread, setThread] = useState<WorkThread | null>(null);
14 const [projectName, setProjectName] = useState<string | undefined>();
15 const [error, setError] = useState<string | null>(null);
16
17 useEffect(() => {
18 Promise.all([api.getThread(id), api.listProjects()])
19 .then(([result, projects]) => {
20 const project = projects.items.find((item) => item.id === result.thread.projectProfileId);
21 setThread(result.thread);
22 setProjectName(project?.name ?? (project ? projectLabel(project.projectKey) : undefined));
23 setError(null);
24 })
25 .catch((err) => setError(err instanceof Error ? err.message : String(err)));
26 }, [id]);
27
28 if (error)
29 return (
30 <div className="work-body">
31 <div className="error">Failed to load: {error}</div>
32 </div>
33 );
34 if (!thread) return <div className="empty">Loading...</div>;
35
36 return (
37 <>
38 <div className="work-header">
39 <button className="back-btn" onClick={onBack}>
40 Back
41 </button>
42 <div className="work-heading">
43 <div className="work-title">{thread.provisionalTitle}</div>
44 <div className="work-sub">{thread.lifecycle}</div>
45 </div>
46 </div>
47 <ThreadDetails thread={thread} projectName={projectName} onOpenSession={onOpenSession} />
48 </>
49 );
50}

Callers

nothing calls this directly

Calls 1

projectLabelFunction · 0.85

Tested by

no test coverage detected