feat(FN-733): remove redundant Manage Agents button from header
- Remove Manage Agents button from Header component (accessible via sidebar) - Remove associated onClick handler and prop threading from App.tsx - Remove Header test cases for the deleted button - Remove unused useTerminal hook and its tests
This commit is contained in:
@@ -412,7 +412,6 @@ function AppInner() {
|
||||
const handleCloseGitManager = useCallback(() => setGitManagerOpen(false), []);
|
||||
|
||||
// Agent handlers
|
||||
const handleOpenAgents = useCallback(() => setAgentsOpen(true), []);
|
||||
const handleCloseAgents = useCallback(() => setAgentsOpen(false), []);
|
||||
|
||||
// Scripts handlers
|
||||
@@ -508,7 +507,6 @@ function AppInner() {
|
||||
onOpenGitManager={handleOpenGitManager}
|
||||
onOpenWorkflowSteps={() => setWorkflowStepsOpen(true)}
|
||||
onOpenMissions={viewMode === "project" && currentProject ? () => setMissionsOpen(true) : undefined}
|
||||
onOpenAgents={viewMode === "project" && currentProject ? handleOpenAgents : undefined}
|
||||
onOpenScripts={handleOpenScripts}
|
||||
onRunScript={handleRunScript}
|
||||
onToggleTerminal={handleToggleTerminal}
|
||||
|
||||
@@ -29,7 +29,6 @@ export interface HeaderProps {
|
||||
onOpenGitManager?: () => void;
|
||||
onOpenWorkflowSteps?: () => void;
|
||||
onOpenMissions?: () => void;
|
||||
onOpenAgents?: () => void;
|
||||
onOpenScripts?: () => void;
|
||||
onRunScript?: (name: string, command: string) => void;
|
||||
onToggleTerminal?: () => void;
|
||||
@@ -79,7 +78,6 @@ export function Header({
|
||||
onOpenGitManager,
|
||||
onOpenWorkflowSteps,
|
||||
onOpenMissions,
|
||||
onOpenAgents,
|
||||
onOpenScripts,
|
||||
onRunScript,
|
||||
onToggleTerminal,
|
||||
@@ -401,18 +399,6 @@ export function Header({
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Agents - desktop only */}
|
||||
{!isMobile && onOpenAgents && (
|
||||
<button
|
||||
className="btn-icon"
|
||||
onClick={onOpenAgents}
|
||||
title="Manage Agents"
|
||||
data-testid="agents-btn"
|
||||
>
|
||||
<Bot size={16} />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Scripts - desktop only */}
|
||||
{!isMobile && onOpenScripts && onRunScript && (
|
||||
<QuickScriptsDropdown
|
||||
@@ -524,18 +510,6 @@ export function Header({
|
||||
<GitHubLogo size={16} />
|
||||
<span>Import from GitHub</span>
|
||||
</button>
|
||||
{/* Agents - in overflow on mobile */}
|
||||
{onOpenAgents && (
|
||||
<button
|
||||
className="mobile-overflow-item"
|
||||
onClick={() => handleOverflowAction(onOpenAgents)}
|
||||
role="menuitem"
|
||||
data-testid="overflow-agents-btn"
|
||||
>
|
||||
<Bot size={16} />
|
||||
<span>Manage Agents</span>
|
||||
</button>
|
||||
)}
|
||||
{onOpenScripts && (
|
||||
<button
|
||||
className="mobile-overflow-item"
|
||||
|
||||
@@ -643,20 +643,6 @@ describe("Header", () => {
|
||||
expect(screen.queryByTestId("overflow-project-selector-btn")).toBeNull();
|
||||
});
|
||||
|
||||
it("shows agents button in overflow menu on mobile when onOpenAgents provided", () => {
|
||||
render(<Header onOpenSettings={vi.fn()} onOpenAgents={vi.fn()} />);
|
||||
fireEvent.click(screen.getByTitle("More header actions"));
|
||||
expect(screen.getByText("Manage Agents")).toBeDefined();
|
||||
});
|
||||
|
||||
it("agents overflow menu item calls onOpenAgents when clicked", () => {
|
||||
const onOpenAgents = vi.fn();
|
||||
render(<Header onOpenSettings={vi.fn()} onOpenAgents={onOpenAgents} />);
|
||||
fireEvent.click(screen.getByTitle("More header actions"));
|
||||
fireEvent.click(screen.getByText("Manage Agents"));
|
||||
expect(onOpenAgents).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("missions overflow menu item calls onOpenMissions when clicked", () => {
|
||||
const onOpenMissions = vi.fn();
|
||||
render(<Header onOpenSettings={vi.fn()} onOpenMissions={onOpenMissions} />);
|
||||
@@ -682,36 +668,6 @@ describe("Header", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── Agents Button ────────────────────────────────────────────────
|
||||
|
||||
it("renders agents button with correct title on desktop", () => {
|
||||
const onOpenAgents = vi.fn();
|
||||
render(<Header onOpenAgents={onOpenAgents} />);
|
||||
const btn = screen.getByTitle("Manage Agents");
|
||||
expect(btn).toBeDefined();
|
||||
});
|
||||
|
||||
it("calls onOpenAgents when agents button is clicked", () => {
|
||||
const onOpenAgents = vi.fn();
|
||||
render(<Header onOpenAgents={onOpenAgents} />);
|
||||
const btn = screen.getByTitle("Manage Agents");
|
||||
fireEvent.click(btn);
|
||||
expect(onOpenAgents).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("does not render agents button when onOpenAgents is not provided", () => {
|
||||
render(<Header />);
|
||||
const btn = screen.queryByTitle("Manage Agents");
|
||||
expect(btn).toBeNull();
|
||||
});
|
||||
|
||||
it("agents button has correct data-testid", () => {
|
||||
const onOpenAgents = vi.fn();
|
||||
render(<Header onOpenAgents={onOpenAgents} />);
|
||||
const btn = screen.getByTestId("agents-btn");
|
||||
expect(btn).toBeDefined();
|
||||
});
|
||||
|
||||
// ── Multi-Project Selector ────────────────────────────────────
|
||||
|
||||
it("shows ProjectSelector when 2+ projects provided", () => {
|
||||
|
||||
Reference in New Issue
Block a user