Files
PaperClipAI/ui/src/components/TaskListToolbar.tsx
T
TonioandPaperclip 4e1d49067c Align Inbox, Tasks and Audit toolbar controls (#22675)
## Thinking Path

> - Paperclip helps people manage agents and tasks.
> - Operators switch between Tasks, Inbox, and Audit to review work.
> - Inconsistent menus and shifting controls make those pages harder to
use.
> - Shared dropdown components keep the controls familiar.
> - This change aligns the menus and keeps room for both Audit
descriptions.

## Linked Issues or Issue Description

**What happened?**

Inbox used native dropdowns. Menus could touch the edge of a phone
screen. The Audit scope control moved when its description wrapped.

**Expected behavior**

Menus keep at least 8px of clearance. Switching Audit scope preserves
the control position.

**Steps to reproduce**

Open each Inbox filter and the Tasks view and filter menus at 320px and
390px. Switch between Activity and Agent Actions on Audit.

## What Changed

- Use Tasks-style menus and shorter filter labels in Inbox.
- Give Inbox and Tasks menus 8px of collision padding.
- Align Audit segments and reserve space for the taller scope
description.

## Verification

- All 129 tests across the Inbox, Audit feed, Tasks page and filter
suites passed after rebase at 88a68f9594.
- Before rebase, browser checks covered mobile menu clearance and Audit
scope switching at 320px and 390px.

## Risks

Inbox filters now use keyboard-navigable menu buttons. This changes how
assistive technology announces the controls.

## Model Used

OpenAI Codex (GPT-6), with local code execution and browser
verification.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-23 13:32:14 -08:00

52 lines
4.1 KiB
TypeScript

import type { ComponentProps, ReactNode, Ref } from "react";
import { ChevronDown, CirclePlus, Columns3, List, ListTree } from "lucide-react";
import { IssueFiltersPopover } from "./IssueFiltersPopover";
import { Button } from "./ui/button";
import { ToolbarSearch } from "./ToolbarSearch";
import { FlyoutHeader, FlyoutOptions } from "./ui/flyout";
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./ui/dropdown-menu";
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
import { taskListViews as views, type TaskListView } from "@/lib/task-list-views";
/** Canonical proposed task toolbar; review under Components / Toolbars / Tasks. */
export function TaskListToolbar({ view, onViewChange, viewOptions = views, viewControl, query, onQueryChange, searchRef, layout, onLayoutChange, allExpanded, onToggleExpanded, onNewTask, filters }: {
view: TaskListView;
onViewChange: (view: TaskListView) => void;
viewOptions?: readonly { value: TaskListView; label: string }[];
viewControl?: ReactNode;
query: string;
onQueryChange: (query: string) => void;
searchRef?: Ref<HTMLInputElement>;
layout: "list" | "board";
onLayoutChange: (layout: "list" | "board") => void;
allExpanded: boolean;
onToggleExpanded: () => void;
onNewTask: () => void;
filters: ComponentProps<typeof IssueFiltersPopover>;
}) {
return (
<div data-canonical-toolbar="tasks" className="design-page-toolbar" role="toolbar" aria-label="Task list controls">
{viewControl ?? <DropdownMenu>
<DropdownMenuTrigger asChild><Button variant="outline" className="design-toolbar-button design-view-trigger" aria-label={`Task view: ${viewOptions.find(option => option.value === view)!.label}`}>{viewOptions.find(option => option.value === view)!.label}<ChevronDown aria-hidden /></Button></DropdownMenuTrigger>
<DropdownMenuContent collisionPadding={8} align="start" className="task-list-options" aria-label="Task views">
<DropdownMenuLabel asChild><FlyoutHeader className="task-list-options-heading">Views</FlyoutHeader></DropdownMenuLabel>
<DropdownMenuRadioGroup asChild value={view} onValueChange={value => onViewChange(value as TaskListView)}><FlyoutOptions className="task-list-options-items">
{viewOptions.map(option => <DropdownMenuRadioItem className="task-list-options-item" key={option.value} value={option.value}>{option.label}</DropdownMenuRadioItem>)}
</FlyoutOptions></DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>}
<ToolbarSearch query={query} onQueryChange={onQueryChange} inputRef={searchRef} label="Search tasks" placeholder="Search tasks…" />
<div className="design-view-toggle" role="group" aria-label="Task layout">
{[{ value: "list", label: "List view", icon: List }, { value: "board", label: "Board view", icon: Columns3 }].map(({ value, label, icon: Icon }) => (
<Tooltip key={value}><TooltipTrigger asChild><Button variant="ghost" className="design-toolbar-button design-toolbar-icon" aria-label={label} aria-pressed={layout === value} onClick={() => onLayoutChange(value as "list" | "board")}><Icon aria-hidden /></Button></TooltipTrigger><TooltipContent>{label}</TooltipContent></Tooltip>
))}
</div>
<div className="design-toolbar-actions">
<Tooltip><TooltipTrigger asChild><Button variant="outline" className="design-toolbar-button design-toolbar-icon" disabled={layout !== "list"} aria-label={allExpanded ? "Collapse all tasks" : "Expand all tasks"} onClick={onToggleExpanded}><ListTree aria-hidden /></Button></TooltipTrigger><TooltipContent>{allExpanded ? "Collapse all tasks" : "Expand all tasks"}</TooltipContent></Tooltip>
<div className="design-toolbar-filter"><IssueFiltersPopover {...filters} presentation="refreshed" buttonVariant="outline" iconOnly enableExternalObjectFilters={false} /></div>
<Button className="design-toolbar-button design-new-task" onClick={onNewTask}><CirclePlus aria-hidden />New Task</Button>
</div>
</div>
);
}