mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 22:49:00 +01:00
Align Inbox, Tasks and Audit toolbar controls
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
45221a17ea
commit
88a68f9594
7 files changed
+123
-66
No files matched your search
@@ -208,6 +208,7 @@ export function IssueFiltersPopover({
|
|||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
|
collisionPadding={8}
|
||||||
aria-label="Filters"
|
aria-label="Filters"
|
||||||
align="end"
|
align="end"
|
||||||
className={refreshed ? "task-filters-popover" : streamlined
|
className={refreshed ? "task-filters-popover" : streamlined
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function TaskListToolbar({ view, onViewChange, viewOptions = views, viewC
|
|||||||
<div data-canonical-toolbar="tasks" className="design-page-toolbar" role="toolbar" aria-label="Task list controls">
|
<div data-canonical-toolbar="tasks" className="design-page-toolbar" role="toolbar" aria-label="Task list controls">
|
||||||
{viewControl ?? <DropdownMenu>
|
{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>
|
<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 align="start" className="task-list-options" aria-label="Task views">
|
<DropdownMenuContent collisionPadding={8} align="start" className="task-list-options" aria-label="Task views">
|
||||||
<DropdownMenuLabel asChild><FlyoutHeader className="task-list-options-heading">Views</FlyoutHeader></DropdownMenuLabel>
|
<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">
|
<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>)}
|
{viewOptions.map(option => <DropdownMenuRadioItem className="task-list-options-item" key={option.value} value={option.value}>{option.label}</DropdownMenuRadioItem>)}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export function TaskViewsMenu({
|
|||||||
<ChevronDown aria-hidden="true" className="h-3.5 w-3.5 text-muted-foreground" />
|
<ChevronDown aria-hidden="true" className="h-3.5 w-3.5 text-muted-foreground" />
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="start" className="w-(--sz-260px)">
|
<DropdownMenuContent collisionPadding={8} align="start" className="w-(--sz-260px)">
|
||||||
{TASK_VIEW_GROUPS.map((group, groupIndex) => (
|
{TASK_VIEW_GROUPS.map((group, groupIndex) => (
|
||||||
<div key={group.label}>
|
<div key={group.label}>
|
||||||
{groupIndex > 0 ? <DropdownMenuSeparator /> : null}
|
{groupIndex > 0 ? <DropdownMenuSeparator /> : null}
|
||||||
|
|||||||
@@ -98,6 +98,20 @@ async function renderPage(url = fixture.url) {
|
|||||||
await flush(); await flush();
|
await flush(); await flush();
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
async function menuItems(trigger: HTMLButtonElement) {
|
||||||
|
if (trigger.getAttribute("aria-expanded") !== "true") {
|
||||||
|
await act(async () => { trigger.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 })); });
|
||||||
|
}
|
||||||
|
return [...document.querySelectorAll<HTMLElement>('[role="menu"] [role="menuitem"]')];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function chooseMenuItem(trigger: HTMLButtonElement, label: string) {
|
||||||
|
const item = (await menuItems(trigger)).find(option => option.textContent === label);
|
||||||
|
expect(item, label).toBeDefined();
|
||||||
|
await act(async () => item!.click());
|
||||||
|
await flush();
|
||||||
|
}
|
||||||
|
|
||||||
describe("Coordinator Needs You — Archived view and history filters (PAP-749 task 2e)", () => {
|
describe("Coordinator Needs You — Archived view and history filters (PAP-749 task 2e)", () => {
|
||||||
const hidden = (id: string, kind: "dismiss" | "snooze", snoozedUntil: string | null = null) => ({
|
const hidden = (id: string, kind: "dismiss" | "snooze", snoozedUntil: string | null = null) => ({
|
||||||
id, sourceKind: "issue_thread_interaction", inlineResolvable: false, dismissalKey: `attention:${id}`, changeFingerprint: `${id}.me`,
|
id, sourceKind: "issue_thread_interaction", inlineResolvable: false, dismissalKey: `attention:${id}`, changeFingerprint: `${id}.me`,
|
||||||
@@ -117,7 +131,7 @@ describe("Coordinator Needs You — Archived view and history filters (PAP-749 t
|
|||||||
expect(container.querySelector("[data-attention-view-menu]")).not.toBeNull();
|
expect(container.querySelector("[data-attention-view-menu]")).not.toBeNull();
|
||||||
expect(container.querySelector("h1")?.textContent).toBe("Archived");
|
expect(container.querySelector("h1")?.textContent).toBe("Archived");
|
||||||
expect(container.querySelector('[aria-label="Back to Needs You"]')).not.toBeNull();
|
expect(container.querySelector('[aria-label="Back to Needs You"]')).not.toBeNull();
|
||||||
expect(container.querySelector('select[aria-label="Filter decisions by assignee"]')).toBeNull();
|
expect(container.querySelector('button[aria-label="Filter decisions by assignee"]')).toBeNull();
|
||||||
const archivedCard = container.querySelector<HTMLElement>('[data-attention-card="arch"]')!;
|
const archivedCard = container.querySelector<HTMLElement>('[data-attention-card="arch"]')!;
|
||||||
expect(archivedCard.querySelector('[data-attention-hidden="archived"]')?.textContent).toMatch(/^Archived /);
|
expect(archivedCard.querySelector('[data-attention-hidden="archived"]')?.textContent).toMatch(/^Archived /);
|
||||||
const group = container.querySelector<HTMLElement>("[data-attention-snoozed-group]")!;
|
const group = container.querySelector<HTMLElement>("[data-attention-snoozed-group]")!;
|
||||||
@@ -325,11 +339,11 @@ describe("Coordinator Needs You", () => {
|
|||||||
expect(container.querySelector("h1")).toBeNull();
|
expect(container.querySelector("h1")).toBeNull();
|
||||||
expect(container.textContent).not.toContain("Someone needs you to choose");
|
expect(container.textContent).not.toContain("Someone needs you to choose");
|
||||||
// Grouped by type by default.
|
// Grouped by type by default.
|
||||||
const group = toolbar.querySelector<HTMLSelectElement>('select[aria-label="Group decisions"]')!;
|
const group = toolbar.querySelector<HTMLButtonElement>('button[aria-label="Group decisions"]')!;
|
||||||
expect(group.value).toBe("type");
|
expect(group.value).toBe("type");
|
||||||
expect([...group.options].map((option) => option.textContent)).toEqual(["By type", "By task", "By agent", "By project", "No grouping"]);
|
expect((await menuItems(group)).map((option) => option.textContent)).toEqual(["By type", "By task", "By agent", "By project", "No grouping"]);
|
||||||
expect(container.querySelector('[data-needs-you-section="decisions"]')).toBeNull();
|
expect(container.querySelector('[data-needs-you-section="decisions"]')).toBeNull();
|
||||||
await act(async () => { group.value = "none"; group.dispatchEvent(new Event("change", { bubbles: true })); });
|
await chooseMenuItem(group, "No grouping");
|
||||||
expect(container.querySelector("[data-needs-you-section]")).toBeNull();
|
expect(container.querySelector("[data-needs-you-section]")).toBeNull();
|
||||||
expect(container.querySelectorAll("article")).toHaveLength(3);
|
expect(container.querySelectorAll("article")).toHaveLength(3);
|
||||||
// Search narrows the cards.
|
// Search narrows the cards.
|
||||||
@@ -449,12 +463,12 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
expect(fixture.listCalls).toContainEqual({ all: true, view: "mine" });
|
expect(fixture.listCalls).toContainEqual({ all: true, view: "mine" });
|
||||||
expect(fixture.listCalls.some((call) => (call as { view?: string }).view !== "mine")).toBe(false);
|
expect(fixture.listCalls.some((call) => (call as { view?: string }).view !== "mine")).toBe(false);
|
||||||
// PAP-775: For you is the page (no tab, no chips); the toolbar's assignee
|
// PAP-775: For you is the page (no tab, no chips); the toolbar's assignee
|
||||||
// filter says "Assigned to you" and widens to the other views.
|
// filter says "By assigned" and widens to the other views.
|
||||||
expect(tab("mine")).toBeNull();
|
expect(tab("mine")).toBeNull();
|
||||||
expect(tab("unassigned")).toBeNull();
|
expect(tab("unassigned")).toBeNull();
|
||||||
const assignee = () => container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = () => container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
expect(assignee().value).toBe("me");
|
expect(assignee().value).toBe("me");
|
||||||
expect(assignee().selectedOptions[0]?.textContent).toBe("Assigned to you");
|
expect(assignee().textContent).toBe("By assigned");
|
||||||
// Why me? is the type label's tooltip, not text on the card; your own card doesn't name you.
|
// Why me? is the type label's tooltip, not text on the card; your own card doesn't name you.
|
||||||
expect([...container.querySelectorAll<HTMLElement>("[data-attention-type-label]")].map((label) => [label.textContent, label.title]))
|
expect([...container.querySelectorAll<HTMLElement>("[data-attention-type-label]")].map((label) => [label.textContent, label.title]))
|
||||||
.toEqual([["Confirm or decline", "Why me? Sent to you"], ["Confirm or decline", "Why me? You are the reviewer"]]);
|
.toEqual([["Confirm or decline", "Why me? Sent to you"], ["Confirm or decline", "Why me? You are the reviewer"]]);
|
||||||
@@ -463,7 +477,7 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
expect(container.querySelector("[data-attention-unassigned-banner]")).toBeNull();
|
expect(container.querySelector("[data-attention-unassigned-banner]")).toBeNull();
|
||||||
expect(client.getQueryCache().find({ queryKey: ["attention", "company", "reviewer", "mine"], exact: false })).toBeTruthy();
|
expect(client.getQueryCache().find({ queryKey: ["attention", "company", "reviewer", "mine"], exact: false })).toBeTruthy();
|
||||||
|
|
||||||
await act(async () => { assignee().value = "unassigned"; assignee().dispatchEvent(new Event("change", { bubbles: true })); }); await flush();
|
await chooseMenuItem(assignee(), "No owner yet");
|
||||||
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=unassigned");
|
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=unassigned");
|
||||||
expect(assignee().value).toBe("unassigned");
|
expect(assignee().value).toBe("unassigned");
|
||||||
expect(fixture.listCalls).toContainEqual({ all: true, view: "unassigned" });
|
expect(fixture.listCalls).toContainEqual({ all: true, view: "unassigned" });
|
||||||
@@ -481,9 +495,9 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
fixture.viewCounts = { mine: 0, unassigned: 0, company: 1 };
|
fixture.viewCounts = { mine: 0, unassigned: 0, company: 1 };
|
||||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||||
await render(client);
|
await render(client);
|
||||||
const assignee = container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
expect(assignee.value).toBe("company");
|
expect(assignee.value).toBe("company");
|
||||||
expect(assignee.selectedOptions[0]?.textContent).toBe("Company alerts");
|
expect(assignee.textContent).toBe("Company alerts");
|
||||||
expect(fixture.listCalls).toContainEqual({ all: true, view: "company" });
|
expect(fixture.listCalls).toContainEqual({ all: true, view: "company" });
|
||||||
await flush();
|
await flush();
|
||||||
// A1 (PAP-775): the type label starts with the person the card is for.
|
// A1 (PAP-775): the type label starts with the person the card is for.
|
||||||
@@ -677,10 +691,10 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||||
await render(client);
|
await render(client);
|
||||||
// PAP-775: Everyone is "All assignees" in the toolbar's assignee filter, and
|
// PAP-775: Everyone is "All assignees" in the toolbar's assignee filter, and
|
||||||
// "Assigned to you" returns to the page.
|
// "By assigned" returns to the page.
|
||||||
const assignee = () => container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = () => container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||||
expect(assignee().selectedOptions[0]?.textContent).toBe("All assignees");
|
expect(assignee().textContent).toBe("All assignees");
|
||||||
expect(container.querySelector("[data-needs-you-summary]")?.textContent).toBe("2 decisions");
|
expect(container.querySelector("[data-needs-you-summary]")?.textContent).toBe("2 decisions");
|
||||||
expect(fixture.listCalls).toContainEqual({ all: true, view: "all" });
|
expect(fixture.listCalls).toContainEqual({ all: true, view: "all" });
|
||||||
expect(client.getQueryCache().find({ queryKey: ["attention", "company", "reviewer", "all"], exact: false })).toBeTruthy();
|
expect(client.getQueryCache().find({ queryKey: ["attention", "company", "reviewer", "all"], exact: false })).toBeTruthy();
|
||||||
@@ -714,9 +728,9 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
await render(client); await flush();
|
await render(client); await flush();
|
||||||
// A viewer has no Everyone — ?view=all falls back to For you (the page), and
|
// A viewer has no Everyone — ?view=all falls back to For you (the page), and
|
||||||
// the assignee filter offers no "All assignees" and no other people (PAP-775).
|
// the assignee filter offers no "All assignees" and no other people (PAP-775).
|
||||||
const assignee = container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
expect(assignee.value).toBe("me");
|
expect(assignee.value).toBe("me");
|
||||||
expect([...assignee.options].map((option) => option.textContent)).toEqual(["Assigned to you", "No owner yet", "Company alerts"]);
|
expect((await menuItems(assignee)).map((option) => option.textContent)).toEqual(["Assigned to you", "No owner yet", "Company alerts"]);
|
||||||
expect(container.querySelector('[data-attention-view="all"]')).toBeNull();
|
expect(container.querySelector('[data-attention-view="all"]')).toBeNull();
|
||||||
expect(fixture.listCalls.some((call) => (call as { view?: string }).view === "all")).toBe(false);
|
expect(fixture.listCalls.some((call) => (call as { view?: string }).view === "all")).toBe(false);
|
||||||
client.clear();
|
client.clear();
|
||||||
@@ -859,25 +873,25 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
fixture.viewCounts = { mine: 1, unassigned: 1, company: 0, archived: 0, all: 3 };
|
fixture.viewCounts = { mine: 1, unassigned: 1, company: 0, archived: 0, all: 3 };
|
||||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||||
await render(client);
|
await render(client);
|
||||||
const assignee = () => container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = () => container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
const choose = async (value: string) => { await act(async () => { assignee().value = value; assignee().dispatchEvent(new Event("change", { bubbles: true })); }); await flush(); };
|
const choose = (label: string) => chooseMenuItem(assignee(), label);
|
||||||
const cards = () => [...container.querySelectorAll("[data-attention-card]")].map(card => card.getAttribute("data-attention-card"));
|
const cards = () => [...container.querySelectorAll("[data-attention-card]")].map(card => card.getAttribute("data-attention-card"));
|
||||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||||
// The viewer is "Assigned to you", never a person option of their own.
|
// The viewer is "By assigned", never a person option of their own.
|
||||||
expect([...assignee().options].map(option => [option.value, option.textContent])).toEqual([
|
expect((await menuItems(assignee())).map(option => option.textContent)).toEqual([
|
||||||
["me", "Assigned to you"], ["all", "All assignees"], ["user:dotta", "Dotta"], ["unassigned", "No owner yet"], ["company", "Company alerts"]]);
|
"Assigned to you", "All assignees", "Dotta", "No owner yet", "Company alerts"]);
|
||||||
expect(cards()).toEqual(["m1", "d1", "pool"]);
|
expect(cards()).toEqual(["m1", "d1", "pool"]);
|
||||||
// One person narrows Everyone, and the person lives in the URL.
|
// One person narrows Everyone, and the person lives in the URL.
|
||||||
await choose("user:dotta");
|
await choose("Dotta");
|
||||||
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=all&for=dotta");
|
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=all&for=dotta");
|
||||||
expect(assignee().value).toBe("user:dotta");
|
expect(assignee().value).toBe("user:dotta");
|
||||||
expect(cards()).toEqual(["d1"]);
|
expect(cards()).toEqual(["d1"]);
|
||||||
// Back to everyone drops the person.
|
// Back to everyone drops the person.
|
||||||
await choose("all");
|
await choose("All assignees");
|
||||||
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=all");
|
expect(container.querySelector("[data-location]")?.textContent).toBe("?view=all");
|
||||||
expect(cards()).toEqual(["m1", "d1", "pool"]);
|
expect(cards()).toEqual(["m1", "d1", "pool"]);
|
||||||
// "Assigned to you" is the page itself.
|
// "By assigned" is the page itself.
|
||||||
await choose("me");
|
await choose("Assigned to you");
|
||||||
expect(container.querySelector("[data-location]")?.textContent).toBe("");
|
expect(container.querySelector("[data-location]")?.textContent).toBe("");
|
||||||
client.clear();
|
client.clear();
|
||||||
});
|
});
|
||||||
@@ -887,9 +901,8 @@ describe("Coordinator Needs You views (PAP-749 task 1b)", () => {
|
|||||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||||
await render(client);
|
await render(client);
|
||||||
await vi.waitFor(() => expect(container.querySelector('[data-attention-card="m2"]')).toBeTruthy());
|
await vi.waitFor(() => expect(container.querySelector('[data-attention-card="m2"]')).toBeTruthy());
|
||||||
const assignee = container.querySelector<HTMLSelectElement>('select[aria-label="Filter decisions by assignee"]')!;
|
const assignee = container.querySelector<HTMLButtonElement>('button[aria-label="Filter decisions by assignee"]')!;
|
||||||
expect(assignee.value).toBe("me");
|
expect(assignee.value).toBe("me");
|
||||||
expect(assignee.getAttribute("data-attention-assignee")).toBe("me");
|
|
||||||
// The old "For anyone" filter is gone.
|
// The old "For anyone" filter is gone.
|
||||||
expect(container.querySelector("[data-attention-audience-filter]")).toBeNull();
|
expect(container.querySelector("[data-attention-audience-filter]")).toBeNull();
|
||||||
expect(container.querySelector("[data-needs-you-summary]")?.textContent).toBe("2 decisions");
|
expect(container.querySelector("[data-needs-you-summary]")?.textContent).toBe("2 decisions");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { QueryErrorState, useQueryView } from "@/components/QueryView";
|
import { QueryErrorState, useQueryView } from "@/components/QueryView";
|
||||||
import { useCallback, useEffect, useMemo, useState, type MouseEvent as ReactMouseEvent } from "react";
|
import { useCallback, useEffect, useMemo, useState, type MouseEvent as ReactMouseEvent } from "react";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { ArrowLeft, ArrowUpRight, ChevronDown, FileText, Image as ImageIcon, Loader2 } from "lucide-react";
|
import { ArrowLeft, ArrowUpRight, Check, ChevronDown, FileText, Image as ImageIcon, Loader2 } from "lucide-react";
|
||||||
import { LayoutGroup, motion, useReducedMotion } from "motion/react";
|
import { LayoutGroup, motion, useReducedMotion } from "motion/react";
|
||||||
import { attentionCardType, type AttentionCloseMode, type AttentionItem, type AttentionPersonalView } from "@paperclipai/shared";
|
import { attentionCardType, type AttentionCloseMode, type AttentionItem, type AttentionPersonalView } from "@paperclipai/shared";
|
||||||
import { accessApi } from "@/api/access";
|
import { accessApi } from "@/api/access";
|
||||||
@@ -32,8 +32,7 @@ import { DecisionCardFooter } from "@/components/DecisionCardFooter";
|
|||||||
import { useSidePanelTabs } from "@/components/side-panel";
|
import { useSidePanelTabs } from "@/components/side-panel";
|
||||||
import { ToolbarSearch } from "@/components/ToolbarSearch";
|
import { ToolbarSearch } from "@/components/ToolbarSearch";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||||
import { NativeSelect } from "@/components/ui/select";
|
|
||||||
import { parseCssTimeMs } from "@/components/task-chat/motion-tokens";
|
import { parseCssTimeMs } from "@/components/task-chat/motion-tokens";
|
||||||
import { timeAgo } from "@/lib/timeAgo";
|
import { timeAgo } from "@/lib/timeAgo";
|
||||||
import { CoordinatorDecisionReceipt as Receipt } from "./CoordinatorDecisionReceipt";
|
import { CoordinatorDecisionReceipt as Receipt } from "./CoordinatorDecisionReceipt";
|
||||||
@@ -48,6 +47,33 @@ import { cn } from "@/lib/utils";
|
|||||||
|
|
||||||
type Group = "type" | "none" | "task" | "agent" | "project";
|
type Group = "type" | "none" | "task" | "agent" | "project";
|
||||||
|
|
||||||
|
function InboxFilter<T extends string>({ label, heading, value, options, onChange, defaultLabel }: {
|
||||||
|
label: string;
|
||||||
|
heading: string;
|
||||||
|
value: T;
|
||||||
|
options: readonly { value: T; label: string }[];
|
||||||
|
onChange: (value: T) => void;
|
||||||
|
defaultLabel?: string;
|
||||||
|
}) {
|
||||||
|
const selected = options.find(option => option.value === value);
|
||||||
|
return <DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button variant="outline" size="sm" value={value} aria-label={label}>
|
||||||
|
<span className="max-w-(--sz-160px) truncate font-medium">{defaultLabel ?? selected?.label}</span>
|
||||||
|
<ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="start" collisionPadding={8} className="w-(--sz-260px)" aria-label={heading}>
|
||||||
|
<DropdownMenuLabel>{heading}</DropdownMenuLabel>
|
||||||
|
{options.map(option => <DropdownMenuItem key={option.value} aria-current={option.value === value || undefined}
|
||||||
|
className="items-start gap-2" onSelect={() => onChange(option.value)}>
|
||||||
|
<Check aria-hidden className={cn("mt-0.5 size-3.5 shrink-0", value !== option.value && "opacity-0")} />
|
||||||
|
<span className={cn("truncate", value === option.value && "font-medium")}>{option.label}</span>
|
||||||
|
</DropdownMenuItem>)}
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>;
|
||||||
|
}
|
||||||
|
|
||||||
/** Rule 7: a card that cannot answer inline links to the exact control, named by its verb. */
|
/** Rule 7: a card that cannot answer inline links to the exact control, named by its verb. */
|
||||||
function openLabel(item: AttentionItem) {
|
function openLabel(item: AttentionItem) {
|
||||||
return (item.decisionVerbs ?? []).find((verb) => verb.id === "open_recovery" || verb.id === "inspect")?.label ?? "Open to review";
|
return (item.decisionVerbs ?? []).find((verb) => verb.id === "open_recovery" || verb.id === "inspect")?.label ?? "Open to review";
|
||||||
@@ -374,7 +400,7 @@ export function CoordinatorNeedsYou() {
|
|||||||
if (!selectedCompanyId) return <p className="text-sm text-muted-foreground">Choose a company to see its decisions.</p>;
|
if (!selectedCompanyId) return <p className="text-sm text-muted-foreground">Choose a company to see its decisions.</p>;
|
||||||
// Decision history is a view of the main pane (PAP-770), not a side panel
|
// Decision history is a view of the main pane (PAP-770), not a side panel
|
||||||
// that repeats Recent Decisions beside them.
|
// that repeats Recent Decisions beside them.
|
||||||
if (historyOpen) return <section className="coordinator-needs-you mx-auto w-full max-w-4xl space-y-6" aria-label="Decision history" data-coordinator-decision-history>
|
if (historyOpen) return <section className="coordinator-needs-you w-full space-y-6" aria-label="Decision history" data-coordinator-decision-history>
|
||||||
<Button variant="ghost" size="sm" onClick={closeHistory}><ArrowLeft className="size-4" />Needs You</Button>
|
<Button variant="ghost" size="sm" onClick={closeHistory}><ArrowLeft className="size-4" />Needs You</Button>
|
||||||
<DecisionHistoryPanel companyId={selectedCompanyId} agents={agentQuery.data ?? []} userLabelMap={userLabelMap} header={<h1 className="text-2xl font-medium">Decision history</h1>} />
|
<DecisionHistoryPanel companyId={selectedCompanyId} agents={agentQuery.data ?? []} userLabelMap={userLabelMap} header={<h1 className="text-2xl font-medium">Decision history</h1>} />
|
||||||
</section>;
|
</section>;
|
||||||
@@ -386,27 +412,36 @@ export function CoordinatorNeedsYou() {
|
|||||||
const sectionHeading = (section: NeedsYouSection) => <h2 className="text-base font-medium" data-needs-you-section={section}>
|
const sectionHeading = (section: NeedsYouSection) => <h2 className="text-base font-medium" data-needs-you-section={section}>
|
||||||
{NEEDS_YOU_SECTIONS[section].title}
|
{NEEDS_YOU_SECTIONS[section].title}
|
||||||
</h2>;
|
</h2>;
|
||||||
return <LayoutGroup id="coordinator-decisions"><section className="coordinator-needs-you mx-auto w-full max-w-4xl space-y-6" aria-label="Needs You">
|
return <LayoutGroup id="coordinator-decisions"><section className="coordinator-needs-you w-full space-y-6" aria-label="Needs You">
|
||||||
{archivedView ? <div className="flex items-center gap-2"><Button variant="ghost" size="icon-sm" aria-label="Back to Needs You" onClick={() => setView("mine")}><ArrowLeft className="size-4" /></Button><h1 className="text-2xl font-medium">Archived</h1></div> : null}
|
{archivedView ? <div className="flex items-center gap-2"><Button variant="ghost" size="icon-sm" aria-label="Back to Needs You" onClick={() => setView("mine")}><ArrowLeft className="size-4" /></Button><h1 className="text-2xl font-medium">Archived</h1></div> : null}
|
||||||
{/* Assigned to you by default (PAP-775); the assignee filter widens to all
|
{/* Assigned to you by default (PAP-775); the assignee filter widens to all
|
||||||
assignees, one person, no owner yet or company alerts. Archived and
|
assignees, one person, no owner yet or company alerts. Archived and
|
||||||
Decision history sit in View. */}
|
Decision history sit in View. */}
|
||||||
<div role="toolbar" aria-label="Decisions controls" className="flex flex-wrap items-center gap-2">
|
<div data-canonical-toolbar="inbox" className="design-page-toolbar" role="toolbar" aria-label="Decisions controls">
|
||||||
<div className="min-w-44 flex-1"><ToolbarSearch query={query} onQueryChange={setQuery} label="Search decisions" placeholder="Search…" /></div>
|
<ToolbarSearch query={query} onQueryChange={setQuery} label="Search decisions" placeholder="Search…" />
|
||||||
<NativeSelect aria-label="Filter decisions by agent" value={agentFilter} onChange={(event) => setAgentFilter(event.target.value)} className="w-auto"><option value="">All agents</option>{(agentQuery.data ?? []).map((agent) => <option key={agent.id} value={agent.id}>{agent.name}</option>)}</NativeSelect>
|
<div className="design-toolbar-actions">
|
||||||
<NativeSelect aria-label="Filter decisions by project" value={projectFilter} onChange={(event) => setProjectFilter(event.target.value)} className="w-auto"><option value="">All projects</option>{projects.map(([id, name]) => <option key={id} value={id}>{name}</option>)}</NativeSelect>
|
<InboxFilter label="Filter decisions by agent" heading="Agents" value={agentFilter} onChange={setAgentFilter}
|
||||||
{assignee ? <NativeSelect aria-label="Filter decisions by assignee" data-attention-assignee={assignee} value={assignee} onChange={(event) => chooseAssignee(event.target.value as CoordinatorAssignee)} className="w-auto">
|
defaultLabel={agentFilter ? undefined : "By agents"}
|
||||||
{assigneeOptions.map(option => <option key={option.value} value={option.value}>{option.label}</option>)}
|
options={[{ value: "", label: "All agents" }, ...(agentQuery.data ?? []).map(agent => ({ value: agent.id, label: agent.name }))]} />
|
||||||
{assignee.startsWith("user:") && !assigneeOptions.some(option => option.value === assignee) ? <option value={assignee}>Someone else</option> : null}
|
<InboxFilter label="Filter decisions by project" heading="Projects" value={projectFilter} onChange={setProjectFilter}
|
||||||
</NativeSelect> : null}
|
defaultLabel={projectFilter ? undefined : "By projects"}
|
||||||
<NativeSelect aria-label="Group decisions" value={groupBy} onChange={(event) => setGroupBy(event.target.value as Group)} className="w-auto"><option value="type">By type</option><option value="task">By task</option><option value="agent">By agent</option><option value="project">By project</option><option value="none">No grouping</option></NativeSelect>
|
options={[{ value: "", label: "All projects" }, ...projects.map(([value, label]) => ({ value, label }))]} />
|
||||||
<DropdownMenu>
|
{assignee && <InboxFilter label="Filter decisions by assignee" heading="Assigned to" value={assignee} onChange={chooseAssignee}
|
||||||
<DropdownMenuTrigger asChild><Button variant="ghost" size="sm" data-attention-view-menu>View<ChevronDown className="size-4" /></Button></DropdownMenuTrigger>
|
defaultLabel={assignee === "me" ? "By assigned" : undefined}
|
||||||
<DropdownMenuContent align="end">
|
options={assignee.startsWith("user:") && !assigneeOptions.some(option => option.value === assignee)
|
||||||
<DropdownMenuItem onSelect={() => setView("archived")}>Archived{viewCounts.archived ? ` · ${viewCounts.archived}` : ""}</DropdownMenuItem>
|
? [...assigneeOptions, { value: assignee, label: "Someone else" }] : assigneeOptions} />}
|
||||||
<DropdownMenuItem onSelect={showHistory}>Decision history</DropdownMenuItem>
|
<InboxFilter<Group> label="Group decisions" heading="Group by" value={groupBy} onChange={setGroupBy}
|
||||||
</DropdownMenuContent>
|
options={[{ value: "type", label: "By type" }, { value: "task", label: "By task" }, { value: "agent", label: "By agent" },
|
||||||
</DropdownMenu>
|
{ value: "project", label: "By project" }, { value: "none", label: "No grouping" }]} />
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild><Button variant="ghost" size="sm" data-attention-view-menu>View<ChevronDown className="size-4" /></Button></DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end" collisionPadding={8} className="w-(--sz-260px)">
|
||||||
|
<DropdownMenuLabel>View</DropdownMenuLabel>
|
||||||
|
<DropdownMenuItem onSelect={() => setView("archived")}>Archived{viewCounts.archived ? ` · ${viewCounts.archived}` : ""}</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onSelect={showHistory}>Decision history</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{feed.data ? <p className="text-sm text-muted-foreground" data-needs-you-summary>
|
{feed.data ? <p className="text-sm text-muted-foreground" data-needs-you-summary>
|
||||||
{summarySections.map((section, index) => {
|
{summarySections.map((section, index) => {
|
||||||
|
|||||||
+6
-3
@@ -4987,16 +4987,19 @@ html:has(.design-proposal-theme) .design-navigation-group-label {
|
|||||||
font-size: var(--design-page-type-size);
|
font-size: var(--design-page-type-size);
|
||||||
line-height: var(--design-page-type-leading);
|
line-height: var(--design-page-type-leading);
|
||||||
font-weight: var(--font-weight-normal);
|
font-weight: var(--font-weight-normal);
|
||||||
background: var(--design-page-control-surface);
|
background-color: var(--design-page-control-surface);
|
||||||
color: var(--muted-foreground);
|
color: var(--muted-foreground);
|
||||||
}
|
}
|
||||||
|
[data-canonical-toolbar] select:not([multiple], .appearance-none) {
|
||||||
|
padding-inline-end: var(--native-select-end-padding);
|
||||||
|
}
|
||||||
[data-canonical-toolbar] button:not([data-toolbar-clear]):is([data-size="icon"], [data-size="icon-sm"], [data-size="icon-xs"], .design-toolbar-icon) {
|
[data-canonical-toolbar] button:not([data-toolbar-clear]):is([data-size="icon"], [data-size="icon-sm"], [data-size="icon-xs"], .design-toolbar-icon) {
|
||||||
width: var(--collection-toolbar-height);
|
width: var(--collection-toolbar-height);
|
||||||
padding-inline: 0;
|
padding-inline: 0;
|
||||||
}
|
}
|
||||||
[data-canonical-toolbar] :is(button:not([data-toolbar-clear], .canonical-tab), a[data-slot="button"], select, [data-toolbar-control]):is(:hover, [aria-pressed="true"], [aria-selected="true"], [data-active="true"], [data-state="open"]) {
|
[data-canonical-toolbar] :is(button:not([data-toolbar-clear], .canonical-tab), a[data-slot="button"], select, [data-toolbar-control]):is(:hover, [aria-pressed="true"], [aria-selected="true"], [data-active="true"], [data-state="open"]) {
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
background: var(--muted-highlight);
|
background-color: var(--muted-highlight);
|
||||||
}
|
}
|
||||||
[data-canonical-toolbar] button:is([data-toolbar-primary], .design-new-task) {
|
[data-canonical-toolbar] button:is([data-toolbar-primary], .design-new-task) {
|
||||||
margin-inline-start: 0;
|
margin-inline-start: 0;
|
||||||
@@ -5265,7 +5268,7 @@ html:not(.dark) .coordinator-sidebar {
|
|||||||
.coordinator-decision-card [data-attention-context] :is(p, span, button, time) { font-size: var(--text-xs); line-height: var(--text-xs--line-height); }
|
.coordinator-decision-card [data-attention-context] :is(p, span, button, time) { font-size: var(--text-xs); line-height: var(--text-xs--line-height); }
|
||||||
.coordinator-decision-card [data-decision-prompt] { font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-medium); }
|
.coordinator-decision-card [data-decision-prompt] { font-size: var(--text-base); line-height: var(--text-base--line-height); font-weight: var(--font-weight-medium); }
|
||||||
/* The Needs You toolbar fits one row: the search takes what the filters leave. */
|
/* The Needs You toolbar fits one row: the search takes what the filters leave. */
|
||||||
.coordinator-needs-you [data-toolbar-search] { width: 100%; min-width: 0; }
|
.coordinator-needs-you > :not([role="toolbar"]) { max-width: var(--container-4xl); margin-inline: auto; }
|
||||||
.coordinator-needs-you [data-toolbar-search] input { flex: 1; width: auto; }
|
.coordinator-needs-you [data-toolbar-search] input { flex: 1; width: auto; }
|
||||||
.coordinator-decision-card [data-needs-you-panel] :is(p, label) { font-size: var(--text-compact); line-height: calc(var(--spacing) * 5); }
|
.coordinator-decision-card [data-needs-you-panel] :is(p, label) { font-size: var(--text-compact); line-height: calc(var(--spacing) * 5); }
|
||||||
.coordinator-decision-card [data-needs-you-panel] :is(p, label, span).text-xs { font-size: var(--text-xs); line-height: calc(var(--spacing) * 4.5); }
|
.coordinator-decision-card [data-needs-you-panel] :is(p, label, span).text-xs { font-size: var(--text-xs); line-height: calc(var(--spacing) * 4.5); }
|
||||||
|
|||||||
@@ -564,10 +564,13 @@ export function AuditFeed({
|
|||||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-lg font-semibold text-foreground">Activity</h2>
|
<h2 className="text-lg font-semibold text-foreground">Activity</h2>
|
||||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
<p className="mt-1 grid max-w-2xl text-sm text-muted-foreground">
|
||||||
{resolvedMode === "agents"
|
<span className="col-start-1 row-start-1" style={{ visibility: resolvedMode === "agents" ? "hidden" : "visible" }}>
|
||||||
? "Every recorded agent action, newest first — with the responsible person and run behind each one."
|
Everything happening in your organization, newest first — people, agents, and the system. Each line is one recorded action.
|
||||||
: "Everything happening in your organization, newest first — people, agents, and the system. Each line is one recorded action."}
|
</span>
|
||||||
|
<span className="col-start-1 row-start-1" style={{ visibility: resolvedMode === "agents" ? "visible" : "hidden" }}>
|
||||||
|
Every recorded agent action, newest first — with the responsible person and run behind each one.
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -575,16 +578,18 @@ export function AuditFeed({
|
|||||||
|
|
||||||
{showModeToggle ? (
|
{showModeToggle ? (
|
||||||
<Tabs data-canonical-toolbar="audit-scope" value={resolvedMode} onValueChange={(value) => onModeChange?.(value as AuditFeedMode)}>
|
<Tabs data-canonical-toolbar="audit-scope" value={resolvedMode} onValueChange={(value) => onModeChange?.(value as AuditFeedMode)}>
|
||||||
<TabsList className="design-view-toggle" aria-label="Activity scope">
|
<div className="design-view-toggle">
|
||||||
<TabsTrigger value="all">Activity</TabsTrigger>
|
<TabsList aria-label="Activity scope">
|
||||||
<TabsTrigger
|
<TabsTrigger value="all">Activity</TabsTrigger>
|
||||||
value="agents"
|
<TabsTrigger
|
||||||
disabled={accessTier === "basic"}
|
value="agents"
|
||||||
title={accessTier === "basic" ? "Agent Actions requires audit access" : undefined}
|
disabled={accessTier === "basic"}
|
||||||
>
|
title={accessTier === "basic" ? "Agent Actions requires audit access" : undefined}
|
||||||
Agent Actions
|
>
|
||||||
</TabsTrigger>
|
Agent Actions
|
||||||
</TabsList>
|
</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</div>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user