refactor: extract panel registry and pane context from workspace screen

Replace hardcoded renderContent() switch and per-kind descriptor logic
with a registry-based panel interface. Each panel type (agent, draft,
terminal, file) now self-registers with its component, useDescriptor
hook, and optional confirmClose. Panels access workspace context via
usePaneContext() instead of prop drilling. This prepares the workspace
screen for split pane support.
This commit is contained in:
Mohamed Boudra
2026-03-17 21:58:11 +07:00
parent abc8ad3fd4
commit 30dd54a318
17 changed files with 1105 additions and 817 deletions
@@ -10,11 +10,7 @@ function makeAgentTab(id: string): WorkspaceTabDescriptor {
key: `agent_${id}`,
tabId: `agent_${id}`,
kind: "agent",
agentId: id,
provider: "codex",
label: `Agent ${id}`,
subtitle: "",
titleState: "ready",
target: { kind: "agent", agentId: id },
};
}
@@ -23,9 +19,7 @@ function makeTerminalTab(id: string): WorkspaceTabDescriptor {
key: `terminal_${id}`,
tabId: `terminal_${id}`,
kind: "terminal",
terminalId: id,
label: `Terminal ${id}`,
subtitle: "",
target: { kind: "terminal", terminalId: id },
};
}
@@ -34,9 +28,7 @@ function makeFileTab(path: string): WorkspaceTabDescriptor {
key: `file_${path}`,
tabId: `file_${path}`,
kind: "file",
filePath: path,
label: path.split("/").pop() ?? path,
subtitle: path,
target: { kind: "file", path },
};
}