feat(01-03): decompose organization.tsx and dashboard.tsx into focused sub-components

- Split organization.tsx (1395 lines) into 12 files: AgentRoster, AgentCreator, AgentEditor, GoalList, GoalCreator, GoalEditor, ProjectList, ProjectCreator, ProjectEditor, OrgChart, helpers, orgTreeLayout
- Split dashboard.tsx (1053 lines) into 11 files: Dashboard, HealthCard, MetricsGrid, ActivityFeed, QuickActions, DepartmentOverview, TaskPipeline, SprintProgress, GoalProgress, KanbanBoard, NeedsAttention
- All sub-component files under 300 lines (max: 239 lines)
- Original files replaced with backward-compatible re-exports
- TypeScript compilation passes
This commit is contained in:
ZacharyZhang-NY committed 2026-03-22 01:54:20 -04:00
1 parent ccfdbe73a3
commit 16d10c0814
25 files changed
+2438 -2448

No files matched your search

@@ -0,0 +1,74 @@
import { useState } from "react";
import { Target } from "@phosphor-icons/react";
import type { AgentRecord, GoalRecord } from "@shared/types";
import { ActionButton, Input, Select, TextArea } from "../ui";
export function GoalCreator({
companyId,
agents,
goals,
onSaved,
}: {
companyId: string;
agents: AgentRecord[];
goals: GoalRecord[];
onSaved: () => Promise<void>;
}) {
const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const [ownerAgentId, setOwnerAgentId] = useState(agents[0]?.id ?? "");
const [parentId, setParentId] = useState("");
return (
<div className="grid gap-4">
<Input label="Goal title" value={title} onChange={setTitle} placeholder="Goal title" />
<TextArea
label="Success criteria"
value={description}
onChange={setDescription}
placeholder="What must become true for this goal to count as achieved?"
/>
<Select
label="Owner agent"
value={ownerAgentId}
onChange={setOwnerAgentId}
options={[
{ value: "", label: "No owner" },
...agents.map((agent) => ({ value: agent.id, label: agent.name })),
]}
/>
<Select
label="Parent goal"
value={parentId}
onChange={setParentId}
options={[
{ value: "", label: "No parent goal" },
...goals.map((g) => ({ value: g.id, label: g.title })),
]}
/>
<ActionButton
label="Create goal"
tone="accent"
onClick={() =>
void (async () => {
try {
await window.agentCompany.saveGoal({
companyId,
title,
description,
ownerAgentId: ownerAgentId || null,
parentId: parentId || null,
status: "active",
});
setTitle("");
setDescription("");
await onSaved();
} catch (error) {
void error;
}
})()
}
icon={Target}
/>
</div>
);
}