refactor: extract dashboard, workspace, tool-types, and tool-configs components (Task 4.3)

- Extract DashboardSummary, ActiveSessionsList, ProjectsSection, QuickCreateForm,
  RecentSessionsSection from dashboard.tsx (480 → 110 lines)
- Extract WorkspaceSidebar from repo-workspace.tsx
- Extract ToolTypeList + ToolTypeForm from tool-types.tsx (409 → 135 lines)
- Extract ToolConfigList + ToolConfigForm from tool-configs.tsx (391 → 178 lines)
- Add use-dashboard-actions hook for shared dashboard action handlers
- Update feature barrels with new exports

Quality gates: tsc (pass), eslint (pass)
Refs: repo-restructure Task 4.3
This commit is contained in:
Developer
2026-06-02 22:23:13 +00:00
parent 6bd7443e68
commit a6eb6ec788
32 changed files with 1583 additions and 1104 deletions
@@ -0,0 +1,58 @@
import { render, screen, waitFor } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import { ToolTypesTab } from "./ToolTypesTab";
vi.mock("../../../api/tool_types", () => ({
listToolTypes: vi.fn(),
createToolType: vi.fn(),
deleteToolType: vi.fn(),
updateToolType: vi.fn(),
}));
import { listToolTypes } from "../../../api/tool_types";
describe("ToolTypesTab", () => {
it("renders loading state initially", () => {
render(<ToolTypesTab />);
expect(screen.getByText(/loading tool types/i)).toBeInTheDocument();
});
it("renders tool types heading after loading", async () => {
const mockedList = listToolTypes as ReturnType<typeof vi.fn>;
mockedList.mockResolvedValueOnce([
{
id: "1",
name: "code-server",
display_name: "VS Code Server",
description: "Web-based IDE",
category: "editor",
interfaces: ["web"],
default_port: 8443,
definition_type: "compose",
compose_template: "version: '3.8'\nservices:\n app:",
dockerfile_template: null,
readiness_probe: null,
required_variables: [],
is_builtin: true,
},
]);
render(<ToolTypesTab />);
await waitFor(() => {
expect(screen.getByText("Tool Types")).toBeInTheDocument();
});
expect(screen.getByText("VS Code Server")).toBeInTheDocument();
});
it("renders error state on failure", async () => {
const mockedList = listToolTypes as ReturnType<typeof vi.fn>;
mockedList.mockRejectedValueOnce(new Error("Network error"));
render(<ToolTypesTab />);
await waitFor(() => {
expect(screen.getByText(/failed to load tool types/i)).toBeInTheDocument();
});
});
});