fix(ui): mobile parity for task detail, chat, goals, cases, and coordinator inbox (#23046)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Operators review tasks, agent conversations, goals, cases, and
coordinator inbox decisions from both desktop and mobile viewports.
> - On mobile viewports (`< 768px`), several core detail surfaces hide
or disable controls that only mount in desktop sidebars: streamlined
Task Detail hides both the Properties drawer trigger and the More task
actions menu; Agent Chat's top-right Show properties toggle toggles a
desktop-only panel; Goal Detail hides its Properties panel with no
mobile drawer; Coordinator Inbox disables artifact and approval
inspection; BreadcrumbBar crushes current page titles behind unshrinking
ancestors; Case Detail clips long unbroken IDs; wide Markdown tables and
rigid 4-column media grids overflow narrow screens.
> - Mobile operators need full access to task properties, task actions,
goal metadata, and decision artifacts without switching to a desktop
browser or fighting horizontal page overflow.
> - This pull request restores mobile sheet triggers and action menus
across Task Detail, Agent Chat, Goal Detail, and Coordinator Inbox,
fixes mobile breadcrumb priority and properties toggle visibility, wraps
long Case Detail titles, contains wide Markdown tables inside scrollable
bubble regions, updates rigid 4-column media grids to 2-to-4 responsive
grids, and adds unit tests plus 390×844 Storybook mobile views.
> - The benefit is complete mobile parity on Paperclip's core detail and
inbox workflows with zero horizontal overflow and no regressions on
desktop layouts.

## Linked Issues or Issue Description

**What happened?**
On viewports narrower than `768px` (such as `390×844` mobile):
- Streamlined Task Detail hides both the mobile `Properties` sheet
button (gated behind `!streamlinedTaskDetailEnabled`) and the `More task
actions` (`...`) menu (nested inside `hidden md:flex`), making
Properties, Plan, Artifacts, Subtasks, Copy, Archive, Privacy, and
subtree Pause/Resume/Cancel controls unreachable.
- On Agent Chat and mobile Task Detail routes, the top-right `Show
properties` toggle calls `toggleTaskSidePanel`, which only toggles
desktop-only `panelVisible` (`PropertiesPanel` is `hidden md:flex`)
instead of opening the mobile `Sheet`.
- `BreadcrumbBar` suppresses `propertiesToggle` on mobile task trails
and gives ancestor segments `shrink-0`, crushing the final page label to
one letter.
- `GoalDetail` hides its Properties toggle (`hidden md:inline-flex`) and
only writes to the desktop `PropertiesPanel`, leaving `<GoalProperties
/>` unreachable on mobile.
- `CaseDetail` renders `<h1>` without `break-words` / `wrap-anywhere` or
`min-w-0`, causing unbroken identifiers to overflow past `390px`.
- `CoordinatorNeedsYou` sets `artifact = null`, disables mentioned-link
interception, and sets `onViewDetails = undefined` on mobile, blocking
inspection of approval details and decision artifacts.
- Wide Markdown tables inside `TaskChatBubble` lack flex `min-w-0`
containment and explicit `max-w-full overflow-x-auto` utility classes on
the table scroll wrapper, and media grids in `IssueOutputSection`,
`IssueAttachmentsSection`, and `TaskChatBubble` use rigid `grid-cols-4`
on mobile.

**Expected behavior**
- Mobile users can open the `TaskSidePanel` `Sheet` from both the
streamlined Task Detail header and the `BreadcrumbBar` top-right toggle
(on both `/issues/:id` and `/chats/:agentRef`), and can open the `More
task actions` (`...`) menu.
- Mobile breadcrumbs keep the current page title legible by collapsing
>2 leading segments and shrinking ancestor segments before the current
crumb.
- Mobile `GoalDetail` provides a `Properties` button that opens
`<GoalProperties />` in a bottom `Sheet`.
- Mobile `CaseDetail` wraps unbroken identifiers cleanly within the
viewport.
- Mobile `CoordinatorNeedsYou` opens approval details, artifact rows,
and mentioned documents in a responsive bottom `Sheet` backed by
`<CoordinatorReviewPanel />`.
- Wide Markdown tables scroll horizontally within their bubble container
without expanding page width, and media grids adapt from 2 columns on
mobile to 4 columns on `sm+`.

**Steps to reproduce**
1. Open Paperclip UI at a `390×844` viewport.
2. Visit a streamlined task detail page, an agent chat page, a goal
detail page, a case detail page with a long unbroken token in its title,
and the Coordinator Inbox (`/decisions`).
3. Attempt to open Properties, More task actions, Goal Properties, or an
approval/plan artifact review panel, and inspect breadcrumb truncation
and table overflow.

**Paperclip version or commit**
Reproduced on `origin/master` (`85ad16b47e`).

## What Changed

- **`ui/src/pages/IssueDetail.tsx`**: Wired `toggleTaskSidePanel` and
`breadcrumbPanelControl.open` to `mobilePropsOpen` when `isMobile` is
true (including on `/chats/:agentRef`); moved `More task actions`
(`...`) out of `hidden md:flex` so it stays reachable on mobile; added a
mobile-only `Properties` button to streamlined Task Detail headers.
*(Note on file size rule: `IssueDetail.tsx` already exceeded 1,000
lines; this PR adds only +36 net lines directly in the existing header
and panel toggle hooks to avoid unnecessary churn.)*
- **`ui/src/components/BreadcrumbBar.tsx`**: Rendered `propertiesToggle`
on mobile task and chat trails whenever `showPropertiesToggle` or
`breadcrumbPanelControl` is present; collapsed >2-segment mobile trails
to parent + current and shrunk ancestor segments (`max-w-28`, `max-w-24`
for task parents) while giving the final crumb `flex-1 min-w-0`.
- **`ui/src/pages/GoalDetail.tsx`**: Added a mobile-only `Properties`
trigger button and bottom `<Sheet>` rendering `<GoalProperties />`.
- **`ui/src/pages/CaseDetail.tsx`**: Added `min-w-0`, `break-words`, and
`wrap-anywhere` to the page container, header, and `<h1>` title.
- **`ui/src/components/coordinator/CoordinatorNeedsYou.tsx`**: Removed
mobile disables on `needsYouArtifact`, mentioned document clicks, and
approval `onViewDetails`; guarded desktop `panelVisible` close sync with
`!isMobile`; added a bottom `<Sheet>` rendering `<CoordinatorReviewPanel
/>` (with multi-tab switching when multiple artifacts are open).
- **`ui/src/components/MarkdownBody.tsx` &
`ui/src/components/task-chat/TaskChatBubble.tsx`**: Added `max-w-full
overflow-x-auto` to the Markdown table scroll wrapper and `min-w-0
max-w-full` flex containment on chat bubbles.
- **`ui/src/components/issue-output/IssueOutputSection.tsx`,
`ui/src/components/IssueAttachmentsSection.tsx`,
`ui/src/components/task-chat/TaskChatBubble.tsx`**: Updated rigid
`grid-cols-4` media grids to `grid-cols-2 sm:grid-cols-4`.
- **Storybook & Tests**: Added/updated 390×844 mobile Storybook exports
(`TaskDetailMobile`, `AgentChatMobile`, `GoalDetailMobile`,
`CaseDetailMobile`, `CoordinatorInboxMobile`) and 7 Vitest suites
covering every changed surface.

## Verification

- Targeted Vitest (8 files, 94 tests pass):
`pnpm --filter @paperclipai/ui exec vitest run
src/components/MarkdownBody.test.tsx
src/components/BreadcrumbBar.mobile.test.tsx
src/pages/GoalDetail.mobile.test.tsx
src/pages/CaseDetail.mobile.test.tsx
src/components/coordinator/CoordinatorNeedsYou.mobile.test.tsx
src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx
src/components/task-chat/TaskChatBubble.mobile.test.tsx
src/pages/IssueDetail.mobile.test.tsx`
- Design token & sync gates (All 4 gates CLEAN + cliplab character in
sync):
  `pnpm check:token-gates`
- TypeScript build & typecheck (0 errors):
  `pnpm --filter @paperclipai/ui typecheck`
- Storybook catalog & map checks (372 files, 3490 stories; 30/30 catalog
& map tests pass):
`node scripts/storybook-catalog.mjs --check && node --test
scripts/check-maps.test.mjs scripts/storybook-catalog.test.mjs
scripts/storybook-feature-index.test.mjs`
- Revision verified: `20c7e91bdad95b4679cd1707e6881a3f414f71a4` on local
macOS worktree. Full repo CI suite and visual browser checks will run in
GitHub Actions.

## Risks

- Low risk: all new drawer/sheet paths and breadcrumb collapsing are
strictly gated to mobile (`isMobile` / `md:hidden`), preserving existing
desktop layouts and behaviors.
- Mobile `CoordinatorNeedsYou` review sheets intentionally bypass
desktop `PropertiesPanel` so desktop `panelVisible === false` does not
auto-dismiss the mobile sheet; desktop panel behavior is unchanged.

## Model Used

- **Provider & Model**: Google Gemini — Gemini 4 Neon (High)
- **Capabilities**: Extended reasoning/thinking, tool use, local code
execution, and automated test 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
- [x] 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
This commit is contained in:
Dotta authored and GitHub committed 2026-11-27 13:41:43 +00:00
1 parent ffd8dcb4af
commit 74f26f3b49
21 files changed
+1564 -42

No files matched your search

@@ -0,0 +1,189 @@
// @vitest-environment jsdom
import { act, useEffect, type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
import { MemoryRouter } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { BreadcrumbBar } from "./BreadcrumbBar";
import { BreadcrumbProvider, useBreadcrumbs, type Breadcrumb, type BreadcrumbPanelControl } from "../context/BreadcrumbContext";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const mockState = vi.hoisted(() => ({
isMobile: true,
toggleSidebar: vi.fn(),
panelVisible: false,
togglePanelVisible: vi.fn(),
}));
vi.mock("../context/SidebarContext", () => ({
useSidebar: () => ({
isMobile: mockState.isMobile,
toggleSidebar: mockState.toggleSidebar,
}),
}));
vi.mock("../context/PanelContext", () => ({
usePanel: () => ({
panelVisible: mockState.panelVisible,
togglePanelVisible: mockState.togglePanelVisible,
}),
}));
vi.mock("../context/CompanyContext", () => ({
useCompany: () => ({
selectedCompanyId: "company-1",
selectedCompany: { id: "company-1", issuePrefix: "PAP" },
}),
}));
vi.mock("@/plugins/slots", () => ({
usePluginSlots: () => ({ slots: [] }),
PluginSlotOutlet: () => null,
}));
vi.mock("@/plugins/launchers", () => ({
usePluginLaunchers: () => ({ launchers: [] }),
PluginLauncherOutlet: () => null,
}));
vi.mock("./coordinator/CoordinatorPresentation", () => ({
useCoordinatorPresentation: () => false,
}));
vi.mock("@/lib/router", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>("react-router-dom");
return {
Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => (
<a href={to} {...props}>{children}</a>
),
useLocation: actual.useLocation,
};
});
function SeedBreadcrumbs({
crumbs,
panelControl = null,
}: {
crumbs: Breadcrumb[];
panelControl?: BreadcrumbPanelControl | null;
}) {
const { setBreadcrumbs, setBreadcrumbPanelControl } = useBreadcrumbs();
useEffect(() => {
setBreadcrumbs(crumbs);
setBreadcrumbPanelControl(panelControl);
}, [crumbs, panelControl, setBreadcrumbs, setBreadcrumbPanelControl]);
return null;
}
describe("BreadcrumbBar mobile behavior", () => {
let container: HTMLDivElement;
let root: Root;
beforeEach(() => {
mockState.isMobile = true;
mockState.panelVisible = false;
mockState.toggleSidebar.mockReset();
mockState.togglePanelVisible.mockReset();
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
});
afterEach(() => {
act(() => {
root.unmount();
});
container.remove();
});
it("renders the properties toggle on a single-crumb mobile task trail when panel control is registered", () => {
const onToggle = vi.fn();
act(() => {
root.render(
<MemoryRouter>
<BreadcrumbProvider>
<SeedBreadcrumbs
crumbs={[
{ label: "Tasks", href: "/issues" },
{ label: "Fix mobile properties panel", identifier: "PAP-6794" },
]}
panelControl={{ open: false, onToggle }}
/>
<BreadcrumbBar showPropertiesToggle={false} />
</BreadcrumbProvider>
</MemoryRouter>,
);
});
const toggle = container.querySelector<HTMLButtonElement>('button[aria-label="Show properties"]');
expect(toggle).not.toBeNull();
act(() => {
toggle!.click();
});
expect(onToggle).toHaveBeenCalledTimes(1);
});
it("renders the properties toggle on a multi-crumb mobile subtask trail and shrinks ancestor before current crumb", () => {
const onToggle = vi.fn();
act(() => {
root.render(
<MemoryRouter>
<BreadcrumbProvider>
<SeedBreadcrumbs
crumbs={[
{ label: "Tasks", href: "/issues" },
{ label: "Find and stabilize every mobile layout bug", href: "/issues/PAP-6700" },
{ label: "Display status and properties cleanly", identifier: "PAP-6794" },
]}
panelControl={{ open: true, onToggle }}
/>
<BreadcrumbBar showPropertiesToggle={false} />
</BreadcrumbProvider>
</MemoryRouter>,
);
});
const toggle = container.querySelector<HTMLButtonElement>('button[aria-label="Hide properties"]');
expect(toggle).not.toBeNull();
act(() => {
toggle!.click();
});
expect(onToggle).toHaveBeenCalledTimes(1);
const items = [...container.querySelectorAll<HTMLLIElement>('[data-slot="breadcrumb-item"]')];
expect(items).toHaveLength(2);
expect(items[0]!.className).toContain("max-w-24");
expect(items[0]!.className).toContain("shrink");
expect(items[0]!.className).not.toContain("shrink-0");
expect(items[1]!.className).toContain("flex-1");
expect(items[1]!.className).toContain("min-w-0");
});
it("collapses leading root segments on mobile 3-segment trails so the current page label keeps width", () => {
act(() => {
root.render(
<MemoryRouter>
<BreadcrumbProvider>
<SeedBreadcrumbs
crumbs={[
{ label: "Agents", href: "/agents/all" },
{ label: "Antigravity", href: "/agents/antigravity/overview" },
{ label: "Identity" },
]}
/>
<BreadcrumbBar />
</BreadcrumbProvider>
</MemoryRouter>,
);
});
const items = [...container.querySelectorAll<HTMLLIElement>('[data-slot="breadcrumb-item"]')];
expect(items).toHaveLength(2);
expect(items[0]!.textContent).toBe("Antigravity");
expect(items[0]!.className).toContain("max-w-28");
expect(items[0]!.className).not.toContain("shrink-0");
expect(items[1]!.textContent).toBe("Identity");
expect(items[1]!.className).toContain("flex-1");
expect(items[1]!.className).toContain("min-w-0");
});
});
+18 -6
View File
@@ -78,11 +78,12 @@ export function BreadcrumbBar({ taskDetailLayout = false, showPropertiesToggle =
const { selectedCompanyId, selectedCompany } = useCompany();
const taskPanelOpen = breadcrumbPanelControl?.open ?? panelVisible;
const toggleTaskPanel = breadcrumbPanelControl?.onToggle ?? togglePanelVisible;
const propertiesToggle = showPropertiesToggle ? (
const canToggleProperties = showPropertiesToggle || (isMobile && Boolean(breadcrumbPanelControl));
const propertiesToggle = canToggleProperties ? (
<Button
variant="ghost"
size="icon-sm"
className="ml-5 size-9 shrink-0 text-muted-foreground"
className="ml-1 size-9 shrink-0 text-muted-foreground md:ml-5"
onClick={toggleTaskPanel}
aria-label={taskPanelOpen ? "Hide properties" : "Show properties"}
title={taskPanelOpen ? "Hide properties" : "Show properties"}
@@ -136,7 +137,10 @@ export function BreadcrumbBar({ taskDetailLayout = false, showPropertiesToggle =
const currentCrumb = breadcrumbs[breadcrumbs.length - 1];
const isTaskTrail = Boolean(currentCrumb.identifier);
const visibleBreadcrumbs = isMobile && isTaskTrail && breadcrumbs.length > 1 ? breadcrumbs.slice(1) : breadcrumbs;
const mobileBaseBreadcrumbs = isMobile && isTaskTrail && breadcrumbs.length > 1 ? breadcrumbs.slice(1) : breadcrumbs;
const visibleBreadcrumbs = isMobile && mobileBaseBreadcrumbs.length > 2
? mobileBaseBreadcrumbs.slice(-2)
: mobileBaseBreadcrumbs;
if (isMobile && isTaskTrail && visibleBreadcrumbs.length === 1) {
return (
<div className="h-(--sz-60px) shrink-0 flex items-center border-b border-border px-4">
@@ -149,6 +153,7 @@ export function BreadcrumbBar({ taskDetailLayout = false, showPropertiesToggle =
<CrumbIdentifier identifier={currentCrumb.identifier} />
</h1>
{globalToolbarSlots}
{propertiesToggle}
</div>
);
}
@@ -165,8 +170,15 @@ export function BreadcrumbBar({ taskDetailLayout = false, showPropertiesToggle =
const accessibleLabel = [crumb.label, crumb.identifier].filter(Boolean).join(" ");
return (
<Fragment key={i}>
{i > 0 && <BreadcrumbSeparator />}
<BreadcrumbItem className={cn(isLast || isTask ? "min-w-0" : "shrink-0", isTask && !isLast && "max-w-(--breadcrumb-parent-max-width)", pinnedIdentifier && "flex-1")}>
{i > 0 && <BreadcrumbSeparator className="shrink-0" />}
<BreadcrumbItem
className={cn(
isLast || isTask || isMobile ? "min-w-0" : "shrink-0",
!isLast && isMobile && (isTask ? "shrink max-w-24" : "shrink max-w-28"),
isTask && !isLast && !isMobile && "max-w-(--breadcrumb-parent-max-width)",
(pinnedIdentifier || (isMobile && isLast)) && "flex-1",
)}
>
{crumb.control ?? (isLast || !crumb.href ? (
crumb.leading || crumb.identifier ? (
<BreadcrumbPage aria-current={isLast ? "page" : undefined} aria-label={accessibleLabel} className={cn("flex min-w-0 gap-1.5", crumb.trailing ? "items-center" : "items-baseline", (isTask || pinnedIdentifier) && "flex-1")}>
@@ -265,7 +277,7 @@ export function BreadcrumbBar({ taskDetailLayout = false, showPropertiesToggle =
{menuButton}
{breadcrumbTrail}
{globalToolbarSlots}
{isMobile && isTaskTrail ? null : propertiesToggle}
{propertiesToggle}
</div>
);
}
@@ -293,7 +293,7 @@ export function IssueAttachmentsSection({
)}
{imageAttachments.length > 0 && (
<div className="grid grid-cols-4 gap-2">
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
{imageAttachments.map((attachment) => (
<div
key={attachment.id}
+1 -1
View File
@@ -632,7 +632,7 @@ describe("MarkdownBody", () => {
"| 2026-04-30T14:31:35Z | PAP-2505 | in_review_without_action_path | PAP-2779 | PAP-2910 |",
].join("\n"));
expect(html).toContain('class="paperclip-markdown-table-scroll"');
expect(html).toContain('class="paperclip-markdown-table-scroll max-w-full overflow-x-auto"');
expect(html).toContain('aria-label="Scrollable table"');
expect(html).toContain('tabindex="0"');
expect(html).toContain("<table>");
+6 -1
View File
@@ -860,7 +860,12 @@ function MarkdownBodyImpl({
</blockquote>
),
table: ({ node: _node, style: tableStyle, children: tableChildren, ...tableProps }) => (
<div className="paperclip-markdown-table-scroll" role="region" aria-label="Scrollable table" tabIndex={0}>
<div
className="paperclip-markdown-table-scroll max-w-full overflow-x-auto"
role="region"
aria-label="Scrollable table"
tabIndex={0}
>
<table {...tableProps} style={tableStyle as React.CSSProperties | undefined}>
{tableChildren}
</table>
@@ -0,0 +1,247 @@
// @vitest-environment jsdom
import { act, type ReactNode } from "react";
import { MemoryRouter } from "react-router-dom";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { AttentionItem } from "@paperclipai/shared";
import { CoordinatorNeedsYou } from "./CoordinatorNeedsYou";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const fixture = vi.hoisted(() => ({
items: [] as AttentionItem[],
openPanel: vi.fn(),
closePanel: vi.fn(),
setPanelVisible: vi.fn(),
navigate: vi.fn(),
}));
vi.mock("@/api/inboxDismissals", () => ({
inboxDismissalsApi: { restore: vi.fn(async () => ({})), dismiss: vi.fn(async () => ({})) },
}));
vi.mock("@/context/CompanyContext", () => ({
useCompany: () => ({ selectedCompanyId: "company-1" }),
}));
vi.mock("@/context/BreadcrumbContext", () => ({
useBreadcrumbs: () => ({ setBreadcrumbs: vi.fn() }),
}));
vi.mock("@/context/PanelContext", () => ({
usePanel: () => ({
openPanel: fixture.openPanel,
closePanel: fixture.closePanel,
setPanelVisible: fixture.setPanelVisible,
panelVisible: false,
}),
}));
vi.mock("@/context/SidebarContext", () => ({
useSidebar: () => ({ isMobile: true }),
}));
vi.mock("@/hooks/useCoordinatorWorkspaceEnabled", () => ({
useCoordinatorWorkspaceEnabled: () => ({ userId: "reviewer" }),
}));
vi.mock("@/lib/router", async (importOriginal) => ({
...(await importOriginal<typeof import("@/lib/router")>()),
useNavigate: () => fixture.navigate,
}));
vi.mock("@/api/agents", () => ({
agentsApi: { list: async () => [] },
}));
vi.mock("@/api/projects", () => ({
projectsApi: { list: async () => [] },
}));
vi.mock("@/api/access", () => ({
accessApi: {
listUserDirectory: async () => ({ users: [] }),
getCurrentBoardAccess: async () => ({
userId: "reviewer",
source: "session",
isInstanceAdmin: false,
companyIds: ["company-1"],
memberships: [{ companyId: "company-1", membershipRole: "admin", status: "active" }],
}),
},
}));
vi.mock("@/api/attention", () => ({
attentionApi: {
claim: vi.fn(async () => ({})),
close: vi.fn(async () => ({ until: null })),
list: async () => ({
items: fixture.items,
viewCounts: { mine: fixture.items.length, unassigned: 0, company: 0, archived: 0, all: fixture.items.length },
receipts: [],
}),
history: async () => ({ items: [], nextCursor: null }),
runHistory: async () => ({ items: [], nextCursor: null }),
},
}));
vi.mock("motion/react", () => ({
LayoutGroup: ({ children }: { children: ReactNode }) => children,
useReducedMotion: () => true,
motion: {
div: ({ children, id, tabIndex }: { children: ReactNode; id?: string; tabIndex?: number }) => (
<div id={id} tabIndex={tabIndex}>{children}</div>
),
},
}));
vi.mock("@/components/PropertiesPanel", () => ({
PROPERTIES_PANE_HEADER_SLOT_ID: "test-sidebar",
}));
vi.mock("@/components/DecisionResolver", () => ({
DecisionResolver: () => null,
}));
vi.mock("@/components/AttentionInteractionResolver", () => ({
AttentionInteractionResolver: ({ artifactRow }: { artifactRow?: ReactNode }) => (
<div data-testid="interaction-resolver">{artifactRow}</div>
),
}));
vi.mock("@/components/AttentionQueueRow", () => ({
ApprovalResolver: ({ onViewDetails }: { onViewDetails?: () => void }) => (
<button
type="button"
data-testid="approval-view-details"
disabled={!onViewDetails}
onClick={onViewDetails}
>
View details
</button>
),
JoinRequestResolver: () => null,
}));
vi.mock("./CoordinatorReviewPanel", async (importOriginal) => {
const actual = await importOriginal<typeof import("./CoordinatorReviewPanel")>();
return {
...actual,
CoordinatorReviewPanel: ({ item, artifact }: { item: AttentionItem; artifact: { kind: string } }) => (
<div data-testid="review-panel-body">
Reviewing {item.subject.title} ({artifact.kind})
</div>
),
};
});
describe("CoordinatorNeedsYou mobile review sheet", () => {
let container: HTMLDivElement;
let root: Root;
let client: QueryClient;
beforeEach(() => {
fixture.items = [];
fixture.openPanel.mockReset();
fixture.closePanel.mockReset();
fixture.setPanelVisible.mockReset();
fixture.navigate.mockReset();
localStorage.clear();
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
});
afterEach(async () => {
await act(async () => root.unmount());
client.clear();
container.remove();
});
async function renderInbox() {
await act(async () => {
root.render(
<QueryClientProvider client={client}>
<MemoryRouter initialEntries={["/decisions"]}>
<CoordinatorNeedsYou />
</MemoryRouter>
</QueryClientProvider>,
);
});
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
}
it("opens approval details inside a mobile Sheet instead of disabling onViewDetails", async () => {
fixture.items = [
{
id: "approval-1",
sourceKind: "approval",
inlineResolvable: true,
subject: {
id: "apr-1",
kind: "approval",
title: "Approve production deploy",
href: "/PAP/approvals/apr-1",
metadata: { type: "merge_pr" },
},
relatedIssue: {
id: "issue-1",
identifier: "PAP-101",
title: "Deploy release",
href: "/PAP/issues/PAP-101",
},
project: null,
originAgentName: null,
activityAt: new Date("2026-08-02T14:00:00Z").toISOString(),
audience: { kind: "user", userId: "reviewer", reason: "addressee" },
} as unknown as AttentionItem,
];
await renderInbox();
const button = container.querySelector<HTMLButtonElement>('[data-testid="approval-view-details"]');
expect(button).not.toBeNull();
expect(button!.disabled).toBe(false);
await act(async () => {
button!.click();
});
const sheet = document.querySelector('[data-testid="mobile-coordinator-review-sheet"]');
expect(sheet).not.toBeNull();
expect(sheet!.textContent).toContain("Reviewing Approve production deploy (approval)");
expect(fixture.openPanel).not.toHaveBeenCalled();
});
it("renders artifact rows on mobile and opens the artifact preview inside the mobile Sheet", async () => {
fixture.items = [
{
id: "plan-1",
sourceKind: "issue_thread_interaction",
inlineResolvable: true,
subject: {
id: "intx-1",
kind: "interaction",
title: "Approve rollout plan",
href: "/PAP/issues/PAP-102#plan",
metadata: { kind: "request_confirmation", issueId: "issue-2", targetDocumentKey: "plan" },
},
relatedIssue: {
id: "issue-2",
identifier: "PAP-102",
title: "Rollout plan",
href: "/PAP/issues/PAP-102",
},
project: null,
originAgentName: null,
activityAt: new Date("2026-08-02T14:30:00Z").toISOString(),
audience: { kind: "user", userId: "reviewer", reason: "addressee" },
} as unknown as AttentionItem,
];
await renderInbox();
const openArtifactButton = container.querySelector<HTMLButtonElement>('button[aria-label="Open Plan"]');
expect(openArtifactButton).not.toBeNull();
await act(async () => {
openArtifactButton!.click();
});
const sheet = document.querySelector('[data-testid="mobile-coordinator-review-sheet"]');
expect(sheet).not.toBeNull();
expect(sheet!.textContent).toContain("Reviewing Approve rollout plan (document)");
expect(fixture.openPanel).not.toHaveBeenCalled();
});
});
@@ -3,7 +3,7 @@ import { InboxRunHistory } from "./InboxRunHistory";
import { QueryErrorState, useQueryView } from "@/components/QueryView";
import { useCallback, useEffect, useMemo, useState, type MouseEvent as ReactMouseEvent } from "react";
import { useQuery } from "@tanstack/react-query";
import { ArrowLeft, ArrowUpRight, ChevronDown, FileText, Image as ImageIcon, Loader2 } from "lucide-react";
import { ArrowLeft, ArrowUpRight, ChevronDown, FileText, Image as ImageIcon, Loader2, X } from "lucide-react";
import { LayoutGroup, motion, useReducedMotion } from "motion/react";
import { attentionCardType, type AttentionCloseMode, type AttentionItem, type AttentionPersonalView } from "@paperclipai/shared";
import { accessApi } from "@/api/access";
@@ -37,6 +37,7 @@ import { InboxFilter } from "@/components/InboxFilter";
import { ToolbarSearch } from "@/components/ToolbarSearch";
import { Button } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
import { parseCssTimeMs } from "@/components/task-chat/motion-tokens";
import { timeAgo } from "@/lib/timeAgo";
import { CoordinatorDecisionReceipt as Receipt } from "./CoordinatorDecisionReceipt";
@@ -289,15 +290,18 @@ export function CoordinatorNeedsYou() {
const showReview = useCallback((item: AttentionItem, artifact?: NeedsYouArtifact | null) => {
openReviewTab(needsYouReviewTab(item, artifact));
setReviewPanelOpen(true);
setPanelVisible(true);
}, [openReviewTab, setPanelVisible]);
if (!isMobile) setPanelVisible(true);
}, [isMobile, openReviewTab, setPanelVisible]);
// The frame's close control hides the panel; its tabs come back with the next Review.
useEffect(() => { if (!panelVisible) setReviewPanelOpen(false); }, [panelVisible]);
useEffect(() => { if (!isMobile && !panelVisible) setReviewPanelOpen(false); }, [isMobile, panelVisible]);
// A resolved or closed card's tabs close with it.
useEffect(() => {
const open = new Set(pendingItems.map(item => item.id));
for (const tab of reviewTabs.tabs) if (!open.has(tab.payload.itemId)) closeReviewTab(tab.id);
}, [pendingItems, reviewTabs.tabs, closeReviewTab]);
useEffect(() => {
if (isMobile && reviewPanelOpen && reviewTabs.tabs.length === 0) setReviewPanelOpen(false);
}, [isMobile, reviewPanelOpen, reviewTabs.tabs.length]);
useEffect(() => { setBreadcrumbs([{ label: "Inbox" }]); }, [setBreadcrumbs]);
useEffect(() => {
setSettling([]); setReviewPanelOpen(false); resetReviewTabs({ tabs: [], activeTabId: null }); setNow(Date.now()); closePanel();
@@ -344,9 +348,9 @@ export function CoordinatorNeedsYou() {
const phase = !receipt ? "pending" : ["cancelled", "expired"].includes(receipt.outcome) ? "closed" : "resolved";
const refetchAll = () => { void feed.refetch(); void recent.refetch(); };
// Focus (PAP-770, PAP-775 IA5): a card about an artifact opens it beside the card.
const artifact = isMobile ? null : needsYouArtifact(item);
const artifact = needsYouArtifact(item);
// The card stays highlighted while any of its artifacts is open beside it (UI9).
const panelOpen = !isMobile && reviewPanelOpen && panelVisible;
const panelOpen = reviewPanelOpen && (isMobile || panelVisible);
const activeTab = panelOpen ? reviewTabs.tabs.find(tab => tab.id === reviewTabs.activeTabId) : undefined;
const reviewing = !!activeTab && activeTab.payload.itemId === item.id;
const reviewingOwn = !!artifact && panelOpen && reviewTabs.activeTabId === needsYouReviewTabId(item);
@@ -354,14 +358,14 @@ export function CoordinatorNeedsYou() {
const artifactRow = artifact && artifact.kind !== "approval" ? <NeedsYouPanelRow
icon={artifact.kind === "images" ? <ImageIcon /> : <FileText />}
title={artifact.kind === "document" && !artifact.title ? (artifact.key === "plan" ? "Plan" : documentKeyLabel(artifact.key)) : needsYouArtifactLabel(artifact)}
meta={reviewingOwn ? "Open in sidebar · Showing" : "Open in sidebar"}
label={`${reviewingOwn ? "Close" : "Open"} ${needsYouArtifactLabel(artifact)} in the sidebar`}
meta={isMobile ? (reviewingOwn ? "Showing details" : "View details") : (reviewingOwn ? "Open in sidebar · Showing" : "Open in sidebar")}
label={isMobile ? `${reviewingOwn ? "Close" : "Open"} ${needsYouArtifactLabel(artifact)}` : `${reviewingOwn ? "Close" : "Open"} ${needsYouArtifactLabel(artifact)} in the sidebar`}
onOpen={() => reviewingOwn ? closeReviewTab(needsYouReviewTabId(item)) : showReview(item)} /> : null;
// A plan, document, approval or attachment the card links to opens as a
// side-panel tab beside the card, not a page change (PAP-775, IA5).
// A modified click still opens the link itself.
const openMentionedDocument = (event: ReactMouseEvent) => {
if (isMobile || event.defaultPrevented || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;
if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;
const link = (event.target as HTMLElement).closest<HTMLAnchorElement>("a[href]");
const mentioned = link ? needsYouMentionedArtifact(link.getAttribute("href")!, link.textContent) : null;
if (!mentioned) return;
@@ -410,7 +414,7 @@ export function CoordinatorNeedsYou() {
: stalledReview ? <><div className="space-y-1.5"><h2>Choose how this task continues</h2><p className="text-sm text-muted-foreground">This task is still in review with no active reviewer or continuation. Return it to work, request changes, or mark the task done.</p></div><BlockedTaskCardBody item={item} companyId={selectedCompanyId!} agentMap={agentMap} userLabelMap={userLabelMap} leading={taskLink} footerContext={footerContext} onOpen={navigate} onResolved={refetchAll} /></>
: failedRun ? <>{heading}<FailedRunActions item={item} companyId={selectedCompanyId!} leading={taskLink} footerContext={footerContext} presentation="card" onResolved={refetchAll} /></>
: budget ? <>{heading}<BudgetAlertActions item={item} companyId={selectedCompanyId!} leading={taskLink} footerContext={footerContext} presentation="card" onResolved={refetchAll} /></>
: approval ? <>{heading}<ApprovalResolver item={item} companyId={selectedCompanyId!} toggle={taskLink} footerContext={footerContext} presentation="card" onViewDetails={isMobile ? undefined : () => showReview(item)} shareDraft onResolved={() => onResolved(item)} /></>
: approval ? <>{heading}<ApprovalResolver item={item} companyId={selectedCompanyId!} toggle={taskLink} footerContext={footerContext} presentation="card" onViewDetails={() => showReview(item)} shareDraft onResolved={() => onResolved(item)} /></>
: joinRequest ? <>{heading}<JoinRequestResolver item={item} companyId={selectedCompanyId!} toggle={taskLink} presentation="card" onResolved={() => onResolved(item)} /></>
: type === "review_task" ? <>{heading}<ReviewTaskCardBody item={item} companyId={selectedCompanyId!} agentMap={agentMap} userLabelMap={userLabelMap} leading={taskLink} footerContext={footerContext} onOpen={navigate} onResolved={refetchAll} /></>
: type === "blocked_task" ? <>{heading}<BlockedTaskCardBody item={item} companyId={selectedCompanyId!} agentMap={agentMap} userLabelMap={userLabelMap} leading={taskLink} footerContext={footerContext} onOpen={navigate} onResolved={refetchAll} /></>
@@ -452,6 +456,16 @@ export function CoordinatorNeedsYou() {
const sectionHeading = (section: NeedsYouSection) => <h2 className="text-base font-medium" data-needs-you-section={section}>
{NEEDS_YOU_SECTIONS[section].title}
</h2>;
const mobileActiveTab = isMobile && reviewPanelOpen
? reviewTabs.tabs.find(tab => tab.id === reviewTabs.activeTabId) ?? reviewTabs.tabs[0] ?? null
: null;
const mobileActiveItem = mobileActiveTab
? pendingItems.find(entry => entry.id === mobileActiveTab.payload.itemId) ?? null
: null;
const mobileActiveArtifact = mobileActiveTab && mobileActiveItem
? needsYouTabArtifact(mobileActiveItem, mobileActiveTab.payload)
: null;
return <LayoutGroup id="coordinator-decisions"><section className="coordinator-needs-you w-full space-y-6" aria-label="Inbox">
{archivedView ? <div className="flex items-center gap-2"><Button variant="ghost" size="icon-sm" aria-label="Back to Needs You" onClick={() => setView(null)}><ArrowLeft className="size-4" /></Button><h1 className="text-2xl font-medium">Archived</h1></div> : null}
<div data-canonical-toolbar="inbox" className="design-page-toolbar" role="toolbar" aria-label="Decisions controls">
@@ -507,5 +521,70 @@ export function CoordinatorNeedsYou() {
<AttentionSnoozedGroup count={snoozedItems.length} open={snoozedOpen} onToggle={() => setSnoozedOpen(open => !open)}>
<InboxLimitCards items={snoozedItems} renderCard={renderCard} />
</AttentionSnoozedGroup>
<Sheet open={isMobile && reviewPanelOpen} onOpenChange={(open) => { if (!open) setReviewPanelOpen(false); }}>
<SheetContent
side="bottom"
className="max-h-(--sz-85dvh) gap-0 overflow-hidden p-0 pb-(--sz-safe-bottom)"
data-testid="mobile-coordinator-review-sheet"
>
<SheetHeader className="border-b border-border px-4 py-3 pr-10">
<SheetTitle className="truncate text-sm">{mobileActiveTab?.label ?? "Review"}</SheetTitle>
</SheetHeader>
{reviewTabs.tabs.length > 1 ? (
<div className="flex items-center gap-1 overflow-x-auto border-b border-border px-4 py-2" role="tablist" aria-label="Open review artifacts">
{reviewTabs.tabs.map((tab) => {
const selected = tab.id === mobileActiveTab?.id;
return (
<div key={tab.id} className="inline-flex shrink-0 items-center rounded-md border border-border">
<button
type="button"
role="tab"
aria-selected={selected}
onClick={() => selectReviewTab(tab.id)}
className={cn(
"px-2.5 py-1 text-xs",
selected ? "bg-secondary font-medium text-foreground" : "text-muted-foreground hover:text-foreground",
)}
>
{tab.label}
</button>
<button
type="button"
aria-label={`Close ${tab.label}`}
onClick={() => closeReviewTab(tab.id)}
className="px-1.5 py-1 text-muted-foreground hover:text-foreground"
>
<X className="size-3" />
</button>
</div>
);
})}
</div>
) : null}
<div className="min-h-0 flex-1 overflow-y-auto px-4 py-4">
{mobileActiveTab && mobileActiveItem && mobileActiveArtifact ? (
<CoordinatorReviewPanel
key={mobileActiveTab.id}
companyId={selectedCompanyId}
item={mobileActiveItem}
artifact={mobileActiveArtifact}
agentMap={agentMap}
currentUserId={userId}
userLabelMap={userLabelMap}
onOpenTask={(href) => {
setReviewPanelOpen(false);
navigate(href);
}}
onResolved={() => {
closeReviewTab(mobileActiveTab.id);
if (reviewTabs.tabs.length <= 1) setReviewPanelOpen(false);
}}
/>
) : (
<p className="text-sm text-muted-foreground">This is no longer waiting on you.</p>
)}
</div>
</SheetContent>
</Sheet>
</section></LayoutGroup>;
}
@@ -137,7 +137,7 @@ export function IssueOutputSection({ workProducts, resolveCreatorName, onMediaCl
<div className="space-y-2">
<p className="text-(length:--text-micro) font-medium uppercase tracking-wide text-muted-foreground">Also produced</p>
{mediaRest.length > 0 ? (
<div className="grid grid-cols-4 gap-2">
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
{mediaRest.map((item) => (
<div key={item.id} id={`work-product-${item.id}`} className="scroll-mt-20">
<OutputMediaPreview
@@ -0,0 +1,142 @@
// @vitest-environment node
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import type { IssueAttachment, IssueWorkProduct } from "@paperclipai/shared";
import { ThemeProvider } from "@/context/ThemeContext";
import { IssueOutputSection } from "../issue-output/IssueOutputSection";
import { IssueAttachmentsSection } from "../IssueAttachmentsSection";
import { TaskChatBubble } from "./TaskChatBubble";
vi.mock("@/lib/router", () => ({
Link: ({ to, children, ...props }: { to: string; children: React.ReactNode } & React.ComponentProps<"a">) => (
<a href={to} {...props}>{children}</a>
),
useLocation: () => ({ pathname: "/PAP/issues/PAP-1", search: "", hash: "", state: null }),
}));
vi.mock("@/hooks/useArtifactsV1Enabled", () => ({
useArtifactsV1Enabled: () => ({ enabled: false }),
}));
vi.mock("@/hooks/useAgentChatRead", () => ({
useAgentChatRead: () => () => undefined,
}));
vi.mock("@/components/coordinator/CoordinatorPresentation", () => ({
useCoordinatorPresentation: () => false,
}));
vi.mock("@/components/EmailMessageCard", () => ({
useEmailComment: () => null,
}));
describe("Responsive media grids and chat bubble table containment", () => {
it("uses grid-cols-2 sm:grid-cols-4 in IssueOutputSection media grids", () => {
const now = new Date("2026-08-01T12:00:00Z");
const makeImage = (id: string, attachmentId: string, filename: string): IssueWorkProduct => ({
id,
companyId: "company-1",
projectId: null,
issueId: "issue-1",
executionWorkspaceId: null,
runtimeServiceId: null,
type: "artifact",
provider: "paperclip",
externalId: id,
title: filename,
url: `/api/attachments/${attachmentId}/content`,
status: "active",
reviewState: "none",
isPrimary: id === "wp-1",
healthStatus: "unknown",
summary: null,
metadata: {
attachmentId,
contentPath: `/api/attachments/${attachmentId}/content`,
openPath: `/api/attachments/${attachmentId}/content`,
downloadPath: `/api/attachments/${attachmentId}/content?download=1`,
contentType: "image/png",
byteSize: 1024,
originalFilename: filename,
},
createdByRunId: null,
createdAt: now,
updatedAt: now,
});
const html = renderToStaticMarkup(
<IssueOutputSection
workProducts={[
makeImage("wp-1", "11111111-1111-4111-8111-111111111111", "primary.png"),
makeImage("wp-2", "22222222-2222-4222-8222-222222222222", "second.png"),
]}
/>,
);
expect(html).toContain("grid grid-cols-2 gap-2 sm:grid-cols-4");
expect(html).not.toContain('class="grid grid-cols-4 gap-2"');
});
it("uses grid-cols-2 sm:grid-cols-4 in IssueAttachmentsSection image grids", () => {
const attachments: IssueAttachment[] = [
{
id: "att-1",
companyId: "company-1",
issueId: "issue-1",
issueCommentId: null,
assetId: "asset-1",
provider: "local",
objectKey: "att-1.png",
contentType: "image/png",
byteSize: 2048,
sha256: "abc",
originalFilename: "shot-1.png",
createdByAgentId: null,
createdByUserId: null,
createdAt: new Date("2026-08-01T12:00:00Z"),
updatedAt: new Date("2026-08-01T12:00:00Z"),
contentPath: "/api/attachments/att-1/content",
},
];
const html = renderToStaticMarkup(
<QueryClientProvider client={new QueryClient()}>
<IssueAttachmentsSection attachments={attachments} onImageClick={() => undefined} />
</QueryClientProvider>,
);
expect(html).toContain("grid grid-cols-2 gap-2 sm:grid-cols-4");
expect(html).not.toContain('class="grid grid-cols-4 gap-2"');
});
it("keeps TaskChatBubble flex containers min-w-0 max-w-full and uses responsive 2-to-4 column media grids", () => {
const html = renderToStaticMarkup(
<QueryClientProvider client={new QueryClient()}>
<ThemeProvider>
<TaskChatBubble
item={{
kind: "message",
id: "msg-1",
author: "agent",
authorName: "Chief of Staff",
text: [
"| Column A | Column B | Column C | Column D | Column E |",
"| --- | --- | --- | --- | --- |",
"| val-1 | val-2 | val-3 | val-4 | val-5 |",
"",
"![Shot 1](/api/attachments/a1/content)",
].join("\n"),
timestamp: "12:00 PM",
}}
/>
</ThemeProvider>
</QueryClientProvider>,
);
expect(html).toContain("flex w-full min-w-0 flex-col gap-1");
expect(html).toContain("min-w-0 max-w-full break-words py-2 text-sm");
expect(html).toContain("paperclip-markdown-table-scroll max-w-full overflow-x-auto");
expect(html).toContain("grid grid-cols-2 gap-2 sm:grid-cols-4");
});
});
@@ -275,7 +275,7 @@ function TaskChatBubbleContent({
data-conversation-message={isHuman ? "human" : "agent"}
ref={readRef}
className={cn(
"flex w-full flex-col gap-1",
"flex w-full min-w-0 flex-col gap-1",
animateEntry && "tc-enter-bubble",
isOwnMessage ? "items-end" : "items-start",
)}
@@ -306,7 +306,7 @@ function TaskChatBubbleContent({
isHuman ? "task-chat-human-bubble" : "task-chat-agent-bubble"
}
className={cn(
"break-words py-2 text-sm",
"min-w-0 max-w-full break-words py-2 text-sm",
isOwnMessage
? "max-w-(--pct-85) rounded-2xl rounded-br-sm bg-(--liveness-blue) px-3.5 text-white"
: "w-full bg-transparent px-1 text-foreground",
@@ -336,7 +336,7 @@ function TaskChatBubbleContent({
<span className="text-xs text-muted-foreground">
Images · {imageRefs.length}
</span>
<div className="grid grid-cols-4 gap-2">
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
{imageRefs
.slice(0, imageRefs.length > 4 ? 3 : 4)
.map((ref, index) => (
+121
View File
@@ -0,0 +1,121 @@
// @vitest-environment jsdom
import { act, type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { CaseDetail } from "./CaseDetail";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const caseFixture = {
id: "case-1",
companyId: "company-1",
projectId: null,
caseNumber: 4,
identifier: "PAP-C4",
caseType: "support",
key: "plain-thread-1",
title: "Investigate escalation (Plain th_01M7V3SF2W8R79ABCDEF0123456789)",
summary: "Unbroken token summary_th_01M7V3SF2W8R79ABCDEF0123456789",
status: "in_review",
fields: {},
parentCaseId: null,
parent: null,
labels: [],
documents: [],
taskDocuments: [],
attachments: [],
issueLinks: [],
workIssueId: null,
createdByAgentId: null,
createdByUserId: null,
completedAt: null,
createdAt: "2026-08-01T10:00:00Z",
updatedAt: "2026-08-01T10:00:00Z",
};
vi.mock("@/api/cases", () => ({
casesApi: {
get: vi.fn(async () => caseFixture),
listChildren: vi.fn(async () => []),
},
caseAttachmentUrl: () => "",
isImageAttachment: () => false,
}));
vi.mock("@/api/agents", () => ({
agentsApi: { list: vi.fn(async () => []) },
}));
vi.mock("@/api/projects", () => ({
projectsApi: { get: vi.fn(async () => null) },
}));
vi.mock("@/context/BreadcrumbContext", () => ({
useBreadcrumbs: () => ({ setBreadcrumbs: vi.fn() }),
}));
vi.mock("@/components/cases/CaseWorkSummary", () => ({
CaseWorkSummary: () => null,
}));
vi.mock("@/components/cases/CaseHandoffHistory", () => ({
CaseHandoffHistory: () => null,
}));
vi.mock("@/lib/router", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>("react-router-dom");
return {
...actual,
Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => (
<a href={to} {...props}>{children}</a>
),
useCaseHref: () => (identifier?: string) => (identifier ? `/cases/${identifier}` : "/cases"),
};
});
describe("CaseDetail mobile wrapping", () => {
let container: HTMLDivElement;
let root: Root;
let client: QueryClient;
beforeEach(() => {
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
});
afterEach(() => {
act(() => {
root.unmount();
});
client.clear();
container.remove();
});
it("applies break-words, wrap-anywhere, and min-w-0 to the CaseDetail heading so unbroken IDs cannot overflow 390px", async () => {
await act(async () => {
root.render(
<QueryClientProvider client={client}>
<MemoryRouter initialEntries={["/cases/PAP-C4"]}>
<Routes>
<Route path="/cases/:caseIdentifier" element={<CaseDetail />} />
</Routes>
</MemoryRouter>
</QueryClientProvider>,
);
});
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
const heading = container.querySelector("h1");
expect(heading).not.toBeNull();
expect(heading!.textContent).toContain("th_01M7V3SF2W8R79ABCDEF0123456789");
expect(heading!.className).toContain("min-w-0");
expect(heading!.className).toContain("break-words");
expect(heading!.className).toContain("wrap-anywhere");
});
});
+4 -4
View File
@@ -95,14 +95,14 @@ export function CaseDetail() {
const files = caseData.attachments.filter(attachment => !isImageAttachment(attachment));
const children = childrenQuery.data ?? [];
return <div className="mx-auto max-w-5xl space-y-8" data-testid="case-pages">
<header className="space-y-3">
return <div className="mx-auto min-w-0 max-w-5xl space-y-8" data-testid="case-pages">
<header className="min-w-0 space-y-3">
<div className="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
<CaseIdentifierKey identifier={caseData.identifier} caseKey={caseData.key} />
<span>{caseData.caseType}</span><CaseStatus status={caseData.status} />
</div>
<h1 className="text-2xl font-semibold tracking-tight">{caseData.title}</h1>
{caseData.summary && <p className={cn("max-w-3xl text-sm leading-relaxed text-muted-foreground", ANALYTICS_MASK_CLASS)}>{caseData.summary}</p>}
<h1 className="min-w-0 break-words wrap-anywhere text-2xl font-semibold tracking-tight">{caseData.title}</h1>
{caseData.summary && <p className={cn("min-w-0 max-w-3xl break-words text-sm leading-relaxed text-muted-foreground", ANALYTICS_MASK_CLASS)}>{caseData.summary}</p>}
{caseData.labels.length > 0 && <div className="flex flex-wrap gap-1.5" aria-label="Case labels">{caseData.labels.map(label => <Badge key={label.id} variant="secondary" className="font-normal">{label.name}</Badge>)}</div>}
</header>
+144
View File
@@ -0,0 +1,144 @@
// @vitest-environment jsdom
import { act, type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { GoalDetail } from "./GoalDetail";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const goalFixture = {
id: "goal-1",
companyId: "company-1",
title: "Ship mobile parity",
description: "Make goal properties accessible on mobile.",
level: "company",
status: "active",
parentId: null,
ownerAgentId: null,
createdAt: new Date("2026-08-01T10:00:00Z"),
updatedAt: new Date("2026-08-01T10:00:00Z"),
};
vi.mock("../api/goals", () => ({
goalsApi: {
get: vi.fn(async () => goalFixture),
list: vi.fn(async () => [goalFixture]),
update: vi.fn(async () => goalFixture),
},
}));
vi.mock("../api/projects", () => ({
projectsApi: {
list: vi.fn(async () => []),
},
}));
vi.mock("../api/assets", () => ({
assetsApi: {
uploadImage: vi.fn(),
},
}));
vi.mock("../context/CompanyContext", () => ({
useCompany: () => ({
selectedCompanyId: "company-1",
setSelectedCompanyId: vi.fn(),
}),
}));
vi.mock("../context/DialogContext", () => ({
useDialogActions: () => ({
openNewGoal: vi.fn(),
}),
}));
vi.mock("../context/PanelContext", () => ({
usePanel: () => ({
openPanel: vi.fn(),
closePanel: vi.fn(),
panelVisible: false,
setPanelVisible: vi.fn(),
}),
}));
vi.mock("../context/BreadcrumbContext", () => ({
useBreadcrumbs: () => ({
setBreadcrumbs: vi.fn(),
}),
}));
vi.mock("../components/GoalProperties", () => ({
GoalProperties: ({ goal }: { goal: { title: string } }) => (
<div data-testid="goal-properties-content">Goal properties for {goal.title}</div>
),
}));
vi.mock("../components/InlineEditor", () => ({
InlineEditor: ({ value, as: Tag = "div", className }: { value: string; as?: "h2" | "p" | "div"; className?: string }) => (
<Tag className={className}>{value}</Tag>
),
}));
vi.mock("@/lib/router", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>("react-router-dom");
return {
...actual,
Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => (
<a href={to} {...props}>{children}</a>
),
};
});
describe("GoalDetail mobile properties sheet", () => {
let container: HTMLDivElement;
let root: Root;
let client: QueryClient;
beforeEach(() => {
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
});
afterEach(() => {
act(() => {
root.unmount();
});
client.clear();
container.remove();
});
it("renders a mobile Properties trigger button and opens GoalProperties inside a mobile Sheet", async () => {
await act(async () => {
root.render(
<QueryClientProvider client={client}>
<MemoryRouter initialEntries={["/goals/goal-1"]}>
<Routes>
<Route path="/goals/:goalId" element={<GoalDetail />} />
</Routes>
</MemoryRouter>
</QueryClientProvider>,
);
});
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
const trigger = container.querySelector<HTMLButtonElement>('button[aria-label="Properties"]');
expect(trigger).not.toBeNull();
expect(trigger!.className).toContain("md:hidden");
expect(document.querySelector('[data-testid="mobile-goal-properties-sheet"]')).toBeNull();
await act(async () => {
trigger!.click();
});
const sheet = document.querySelector('[data-testid="mobile-goal-properties-sheet"]');
expect(sheet).not.toBeNull();
expect(sheet!.textContent).toContain("Goal properties for Ship mobile parity");
});
});
+36 -2
View File
@@ -1,5 +1,5 @@
import { companyProjectsQuery } from "@/lib/company-projects-query";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import { useParams } from "@/lib/router";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { goalsApi } from "../api/goals";
@@ -18,6 +18,8 @@ import { PageSkeleton } from "../components/PageSkeleton";
import { QueryErrorState, useQueryView } from "../components/QueryView";
import { cn, projectUrl } from "../lib/utils";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Plus, SlidersHorizontal } from "lucide-react";
import type { Goal, Project } from "@paperclipai/shared";
@@ -40,6 +42,7 @@ export function GoalPropertiesToggleButton({
panelVisible ? "opacity-0 pointer-events-none w-0 overflow-hidden" : "opacity-100",
)}
onClick={onShowProperties}
aria-label="Show properties"
title="Show properties"
>
<SlidersHorizontal className="h-4 w-4" />
@@ -54,6 +57,7 @@ export function GoalDetail() {
const { openPanel, closePanel, panelVisible, setPanelVisible } = usePanel();
const { setBreadcrumbs } = useBreadcrumbs();
const queryClient = useQueryClient();
const [mobilePropsOpen, setMobilePropsOpen] = useState(false);
const goalQuery = useQuery({
queryKey: queryKeys.goals.detail(goalId!),
@@ -147,7 +151,17 @@ export function GoalDetail() {
{goal.level}
</span>
<StatusBadge status={goal.status} />
<div className="ml-auto">
<div className="ml-auto flex items-center gap-1">
<Button
variant="ghost"
size="icon-xs"
className="inline-flex md:hidden shrink-0"
onClick={() => setMobilePropsOpen(true)}
aria-label="Properties"
title="Properties"
>
<SlidersHorizontal className="h-4 w-4" />
</Button>
<GoalPropertiesToggleButton
panelVisible={panelVisible}
onShowProperties={() => setPanelVisible(true)}
@@ -222,6 +236,26 @@ export function GoalDetail() {
)}
</TabsContent>
</Tabs>
<Sheet open={mobilePropsOpen} onOpenChange={setMobilePropsOpen}>
<SheetContent
side="bottom"
className="max-h-(--sz-85dvh) pb-(--sz-safe-bottom)"
data-testid="mobile-goal-properties-sheet"
>
<SheetHeader>
<SheetTitle className="text-sm">Properties</SheetTitle>
</SheetHeader>
<ScrollArea className="flex-1 overflow-y-auto">
<div className="px-4 pb-4">
<GoalProperties
goal={goal}
onUpdate={(data) => updateGoal.mutate(data)}
/>
</div>
</ScrollArea>
</SheetContent>
</Sheet>
</div>
);
}
+399
View File
@@ -0,0 +1,399 @@
// @vitest-environment jsdom
import { act, type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { Agent, Issue } from "@paperclipai/shared";
import { BreadcrumbBar } from "../components/BreadcrumbBar";
import { BreadcrumbProvider } from "../context/BreadcrumbContext";
import { PanelProvider } from "../context/PanelContext";
import { ThemeProvider } from "../context/ThemeContext";
import { ToastProvider } from "../context/ToastContext";
import { DialogProvider } from "../context/DialogContext";
import { IssueDetail, TaskDetailSurface } from "./IssueDetail";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const COMPANY_ID = "company-1";
const AGENT: Agent = {
id: "agent-cos",
companyId: COMPANY_ID,
name: "Chief of Staff",
urlKey: "chief-of-staff",
role: "ceo",
title: "Chief of Staff",
icon: null,
status: "idle",
reportsTo: null,
capabilities: null,
adapterType: "claude_local",
adapterConfig: {},
runtimeConfig: {},
budgetMonthlyCents: 0,
spentMonthlyCents: 0,
pauseReason: null,
pausedAt: null,
permissions: { canCreateAgents: false },
lastHeartbeatAt: null,
metadata: null,
createdAt: new Date("2026-08-01T10:00:00Z"),
updatedAt: new Date("2026-08-01T10:00:00Z"),
};
const BASE_ISSUE: Issue = {
id: "11111111-1111-4111-8111-111111111111",
companyId: COMPANY_ID,
projectId: null,
projectWorkspaceId: null,
goalId: null,
parentId: null,
title: "Streamlined mobile task detail test",
description: "Verify mobile Properties sheet and More task actions menu.",
status: "in_progress",
priority: "medium",
reviewPolicy: null,
assigneeAgentId: AGENT.id,
assigneeUserId: null,
responsibleUserId: null,
checkoutRunId: null,
executionRunId: null,
executionAgentNameKey: null,
executionLockedAt: null,
createdByAgentId: null,
createdByUserId: "user-1",
issueNumber: 6794,
identifier: "PAP-6794",
originKind: "manual",
originId: null,
originRunId: null,
requestDepth: 0,
billingCode: null,
assigneeAdapterOverrides: null,
executionPolicy: null,
executionState: null,
executionWorkspaceId: null,
executionWorkspacePreference: null,
executionWorkspaceSettings: null,
startedAt: null,
completedAt: null,
cancelledAt: null,
hiddenAt: null,
project: null,
goal: null,
currentExecutionWorkspace: null,
workProducts: [],
mentionedProjects: [],
myLastTouchAt: null,
lastExternalCommentAt: null,
lastActivityAt: null,
isUnreadForMe: false,
workMode: "standard",
createdAt: new Date("2026-08-01T10:00:00Z"),
updatedAt: new Date("2026-08-01T10:00:00Z"),
};
const CHAT_ISSUE: Issue = {
...BASE_ISSUE,
id: "22222222-2222-4222-8222-222222222222",
identifier: "PAP-9001",
title: "Chat with Chief of Staff",
conversationAgentId: AGENT.id,
};
const testState = vi.hoisted(() => ({
issue: null as Issue | null,
}));
vi.mock("../context/SidebarContext", () => ({
useSidebar: () => ({
isMobile: true,
sidebarOpen: false,
setSidebarOpen: vi.fn(),
toggleSidebar: vi.fn(),
}),
}));
vi.mock("../context/CompanyContext", () => ({
useCompany: () => ({
selectedCompanyId: COMPANY_ID,
selectedCompany: { id: COMPANY_ID, name: "Paperclip", issuePrefix: "PAP" },
companies: [{ id: COMPANY_ID, name: "Paperclip", issuePrefix: "PAP" }],
setSelectedCompanyId: vi.fn(),
}),
useOptionalCompany: () => ({
selectedCompanyId: COMPANY_ID,
selectedCompany: { id: COMPANY_ID, name: "Paperclip", issuePrefix: "PAP" },
companies: [{ id: COMPANY_ID, name: "Paperclip", issuePrefix: "PAP" }],
}),
}));
vi.mock("../context/LiveUpdatesProvider", async (importOriginal) => {
const actual = await importOriginal<typeof import("../context/LiveUpdatesProvider")>();
return {
...actual,
useTaskRunLiveUpdates: () => ({
subscribe: () => () => undefined,
}),
useTranscriptLiveStream: () => ({
events: [],
connected: false,
}),
};
});
vi.mock("../context/DesignSandboxContext", () => ({
useDesignSandbox: () => false,
}));
vi.mock("../hooks/useStreamlinedUiEnabled", () => ({
useStreamlinedUiEnabled: () => ({ enabled: true, loaded: true }),
}));
vi.mock("../hooks/useClassicTaskInterfaceEnabled", () => ({
useClassicTaskInterfaceEnabled: () => ({ enabled: false, loaded: true }),
}));
vi.mock("@/hooks/useCoordinatorWorkspaceEnabled", () => ({
useCoordinatorWorkspaceEnabled: () => ({ enabled: false, loaded: true, userId: "user-1" }),
}));
vi.mock("@/plugins/slots", () => ({
usePluginSlots: () => ({ slots: [] }),
PluginSlotOutlet: () => null,
PluginSlotMount: () => null,
}));
vi.mock("@/plugins/launchers", () => ({
usePluginLaunchers: () => ({ launchers: [] }),
PluginLauncherOutlet: () => null,
}));
vi.mock("../components/task-side-panel", () => ({
TaskSidePanel: ({ issue, onRequestClose }: { issue: Issue; onRequestClose?: () => void }) => (
<div data-testid="task-side-panel-sentinel">
<span>Side panel for {issue.identifier}</span>
{onRequestClose ? <button type="button" onClick={onRequestClose}>Close panel</button> : null}
</div>
),
}));
vi.mock("@/lib/router", async () => {
const actual = await vi.importActual<typeof import("react-router-dom")>("react-router-dom");
return {
...actual,
Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => (
<a href={to} {...props}>{children}</a>
),
};
});
function installMockFetch() {
const originalFetch = globalThis.fetch;
globalThis.fetch = vi.fn(async (input: RequestInfo | URL) => {
const rawUrl = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
const pathname = new URL(rawUrl, "http://localhost").pathname;
const json = (data: unknown) =>
new Response(JSON.stringify(data), {
status: 200,
headers: { "Content-Type": "application/json" },
});
if (pathname === "/api/auth/get-session") {
return json({ session: { userId: "user-1" }, user: { id: "user-1", name: "Riley Board" } });
}
if (pathname === "/api/instance/settings/experimental") {
return json({ enableStreamlinedUi: true, enableAgentChat: true });
}
if (pathname === "/api/workspace-preferences/me") {
return json({ userId: "user-1", coordinatorWorkspaceEnabled: false, updatedAt: null });
}
if (pathname === "/api/cli-auth/me") {
return json({ source: "local_implicit", isInstanceAdmin: true, companyIds: [COMPANY_ID], memberships: [] });
}
if (pathname === `/api/companies/${COMPANY_ID}/agents`) {
return json([AGENT]);
}
if (pathname === `/api/companies/${COMPANY_ID}/access/user-directory`) {
return json({ users: [{ principalId: "user-1", status: "active", user: { name: "Riley Board" } }] });
}
if (/^\/api\/issues\/[^/]+$/.test(pathname)) {
return json(testState.issue ?? BASE_ISSUE);
}
if (/^\/api\/issues\/[^/]+\/recent-comments$/.test(pathname)) {
return json({ comments: [], hasMore: false, latestCommentId: null });
}
if (/^\/api\/issues\/[^/]+\/queued-comments$/.test(pathname)) {
return json({ queues: [], items: [], revision: "rev-1" });
}
if (/^\/api\/issues\/[^/]+\/tree-control\/state$/.test(pathname)) {
return json({ activePauseHold: null });
}
if (/^\/api\/issues\/[^/]+\/documents\/plan$/.test(pathname)) {
return new Response(JSON.stringify({ error: "Not found" }), {
status: 404,
headers: { "Content-Type": "application/json" },
});
}
if (/^\/api\/issues\/[^/]+\/(active-run|runner-goal)$/.test(pathname)) {
return json(null);
}
if (/^\/api\/companies\/[^/]+\/email\/tasks\/[^/]+$/.test(pathname)) {
return json(null);
}
return json([]);
}) as typeof fetch;
return () => {
globalThis.fetch = originalFetch;
};
}
describe("IssueDetail & AgentChat mobile parity", () => {
let container: HTMLDivElement;
let root: Root;
let client: QueryClient;
let restoreFetch: () => void;
beforeEach(() => {
testState.issue = BASE_ISSUE;
restoreFetch = installMockFetch();
if (!globalThis.ResizeObserver) {
globalThis.ResizeObserver = class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
};
}
Object.defineProperty(HTMLElement.prototype, "scrollIntoView", {
configurable: true,
writable: true,
value: vi.fn(),
});
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
});
afterEach(async () => {
await act(async () => root.unmount());
client.clear();
container.remove();
restoreFetch();
});
async function flush() {
for (let i = 0; i < 6; i++) {
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 10));
});
}
}
function Harness({ children, initialEntry }: { children: ReactNode; initialEntry: string }) {
return (
<QueryClientProvider client={client}>
<ThemeProvider>
<ToastProvider>
<DialogProvider>
<PanelProvider>
<BreadcrumbProvider>
<MemoryRouter initialEntries={[initialEntry]}>
{children}
</MemoryRouter>
</BreadcrumbProvider>
</PanelProvider>
</DialogProvider>
</ToastProvider>
</ThemeProvider>
</QueryClientProvider>
);
}
it("exposes mobile Properties sheet trigger, BreadcrumbBar properties toggle, and More task actions menu on Streamlined IssueDetail", async () => {
await act(async () => {
root.render(
<Harness initialEntry="/PAP/issues/PAP-6794">
<BreadcrumbBar showPropertiesToggle={false} />
<Routes>
<Route path="/:companyPrefix/issues/:issueId" element={<IssueDetail />} />
</Routes>
</Harness>,
);
});
await flush();
const moreButton = container.querySelector<HTMLButtonElement>('button[aria-label="More task actions"]');
expect(moreButton).not.toBeNull();
expect(moreButton!.closest(".hidden")).toBeNull();
await act(async () => {
moreButton!.click();
});
await flush();
expect(document.body.textContent).toContain("Add subtask");
expect(document.body.textContent).toContain("Copy as markdown");
expect(document.body.textContent).toContain("Hide this task");
const mobilePropsBtn = container.querySelector<HTMLButtonElement>('button[aria-label="Properties"]');
expect(mobilePropsBtn).not.toBeNull();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).toBeNull();
await act(async () => {
mobilePropsBtn!.click();
});
await flush();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).not.toBeNull();
expect(document.querySelector('[data-testid="task-side-panel-sentinel"]')?.textContent).toContain("PAP-6794");
const hideToggle = container.querySelector<HTMLButtonElement>('button[aria-label="Hide properties"]');
expect(hideToggle).not.toBeNull();
await act(async () => {
hideToggle!.click();
});
await flush();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).toBeNull();
const showToggle = container.querySelector<HTMLButtonElement>('button[aria-label="Show properties"]');
expect(showToggle).not.toBeNull();
await act(async () => {
showToggle!.click();
});
await flush();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).not.toBeNull();
});
it("opens the mobile properties Sheet when clicking Show properties on mobile AgentChat", async () => {
testState.issue = CHAT_ISSUE;
await act(async () => {
root.render(
<Harness initialEntry="/PAP/chats/chief-of-staff">
<BreadcrumbBar showPropertiesToggle />
<TaskDetailSurface
conversation={{
agent: AGENT,
issue: CHAT_ISSUE,
ensureIssue: async () => CHAT_ISSUE,
}}
/>
</Harness>,
);
});
await flush();
const showToggle = container.querySelector<HTMLButtonElement>('button[aria-label="Show properties"]');
expect(showToggle).not.toBeNull();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).toBeNull();
await act(async () => {
showToggle!.click();
});
await flush();
expect(document.querySelector('[data-testid="mobile-task-side-panel"]')).not.toBeNull();
expect(document.querySelector('[data-testid="task-side-panel-sentinel"]')?.textContent).toContain("PAP-9001");
expect(container.querySelector<HTMLButtonElement>('button[aria-label="Hide properties"]')).not.toBeNull();
});
});
+41 -12
View File
@@ -4257,12 +4257,17 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
onArrival: registerArtifactTab,
});
const toggleTaskSidePanel = useCallback(() => {
if (isMobile) {
setMobilePropsOpen((open) => !open);
return;
}
if (!panelVisible || suppressPanelUntilPlan) {
openTaskSidePanel();
return;
}
setPanelVisible(false);
}, [
isMobile,
openTaskSidePanel,
panelVisible,
setPanelVisible,
@@ -6164,19 +6169,22 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
]);
useEffect(() => {
if (!streamlinedTaskDetailEnabled || !taskChatShellEnabled || !issue?.id) {
if ((!streamlinedTaskDetailEnabled && !isAgentChatRoute) || !taskChatShellEnabled || !issue?.id) {
setBreadcrumbPanelControl(null);
return;
}
setBreadcrumbPanelControl({
open: panelVisible && !suppressPanelUntilPlan,
open: isMobile ? mobilePropsOpen : panelVisible && !suppressPanelUntilPlan,
onToggle: toggleTaskSidePanel,
});
return () => setBreadcrumbPanelControl(null);
}, [
isAgentChatRoute,
isMobile,
issue?.id,
mobilePropsOpen,
panelVisible,
setBreadcrumbPanelControl,
streamlinedTaskDetailEnabled,
@@ -7785,7 +7793,12 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
)}
>
{streamlinedTaskDetailEnabled ? (
<div className="flex min-w-0 items-start gap-2 md:items-center md:pr-8">
<div
className={cn(
"flex min-w-0 items-start gap-2 md:items-center md:pr-8",
!(isMobile && isFromInbox) ? "pr-16" : "pr-8",
)}
>
{!proposedTaskHeader ? (
<div className="hidden md:block">{issueStatusControl}</div>
) : null}
@@ -8067,14 +8080,31 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
/>
</TooltipProvider>
) : null}
<div
data-slot="task-title-actions"
className={cn(
streamlinedTaskDetailEnabled &&
"absolute right-0 top-0 flex h-7 items-center",
)}
>
<IssuePrivacyActions
</div>
<div
data-slot="task-title-actions"
className={cn(
"flex shrink-0 items-center gap-0.5",
streamlinedTaskDetailEnabled
? "absolute right-0 top-0 h-7"
: isMobile && isFromInbox
? "ml-auto md:ml-0"
: undefined,
)}
>
{streamlinedTaskDetailEnabled && !(isMobile && isFromInbox) ? (
<Button
variant="ghost"
size="icon-xs"
className="md:hidden shrink-0"
onClick={() => setMobilePropsOpen(true)}
aria-label="Properties"
title="Properties"
>
<SlidersHorizontal className="h-4 w-4" />
</Button>
) : null}
<IssuePrivacyActions
issue={issue}
companyId={issue.companyId}
canManage={canManagePrivacy}
@@ -8215,7 +8245,6 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
</Popover>
)}
</IssuePrivacyActions>
</div>
</div>
</div>
@@ -119,3 +119,10 @@ export const Coordinator: Story = {
},
},
};
export const AgentChatMobile: Story = {
name: "19 · Mobile",
args: { scenario: "returning" },
globals: { viewport: { value: "mobile", isRotated: false } },
parameters: { layout: "fullscreen", waitForViewport: true },
};
@@ -1,11 +1,14 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Routes, Route } from "@/lib/router";
import { Layout } from "@/components/Layout";
import { CaseDetail } from "@/pages/CaseDetail";
import { CaseFieldsPanel, CaseFieldsTable } from "@/components/CaseFieldsPanel";
import { IssueCasesPanel } from "@/components/IssueCasesPanel";
import { PluginLauncherProvider } from "@/plugins/launchers";
import { instanceExperimentalSettingsSchema } from "@paperclipai/shared";
import { expect, within } from "storybook/test";
import {
caseDetail,
caseItem,
installCaseFixtures,
} from "../../support/capability-gaps/cases";
@@ -129,3 +132,32 @@ export const LinkedFromTask: Story = {
).toHaveAttribute("href", "/PAP/cases/PAP-C42");
},
};
export const CaseDetailMobile: Story = {
globals: { viewport: { value: "mobile", isRotated: false } },
parameters: {
layout: "fullscreen",
waitForViewport: true,
initialEntries: ["/PAP/cases/PAP-C42"],
},
beforeEach: () => {
const cleanup = prepareFixtureApi([
{
path: /^\/api\/cases\/(PAP-C42|case-gap)$/,
read: () => ({
...caseDetail,
title: "Investigate support escalation (Plain th_01M7V3SF2W8R79ABCDEF0123456789)",
}),
},
]).cleanup;
return cleanup;
},
render: () => (
<PluginLauncherProvider>
<Routes>
<Route path="/:companyPrefix" element={<Layout />}>
<Route path="cases/:caseIdentifier" element={<CaseDetail />} />
</Route>
</Routes>
</PluginLauncherProvider>
),
};
@@ -1,6 +1,8 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Routes, Route } from "@/lib/router";
import { Layout } from "@/components/Layout";
import { GoalDetail } from "@/pages/GoalDetail";
import { PluginLauncherProvider } from "@/plugins/launchers";
import { expect, userEvent, within } from "storybook/test";
import {
storybookGoals,
@@ -103,3 +105,20 @@ export const Failed: Story = { parameters: { fixtureState: "failure" } };
export const PermissionDenied: Story = {
parameters: { fixtureState: "permission" },
};
export const GoalDetailMobile: Story = {
globals: { viewport: { value: "mobile", isRotated: false } },
parameters: {
layout: "fullscreen",
waitForViewport: true,
initialEntries: ["/PAP/goals/goal-gap"],
},
render: () => (
<PluginLauncherProvider>
<Routes>
<Route path="/:companyPrefix" element={<Layout />}>
<Route path="goals/:goalId" element={<GoalDetail />} />
</Route>
</Routes>
</PluginLauncherProvider>
),
};
@@ -9,13 +9,17 @@ import type {
AttentionSourceKind,
} from "@paperclipai/shared";
import { Routes, Route } from "@/lib/router";
import { Layout } from "@/components/Layout";
import { CoordinatorNeedsYou } from "@/components/coordinator/CoordinatorNeedsYou";
import { WhatNeedsMe } from "@/pages/WhatNeedsMe";
import { DecisionQueuePage } from "@/pages/DecisionQueuePage";
import { AttentionQueueRow } from "@/components/AttentionQueueRow";
import { PluginLauncherProvider } from "@/plugins/launchers";
import type { DecisionQueueDto } from "@/api/decisionQueues";
import { queryKeys } from "@/lib/queryKeys";
import { coordinatorAttentionQueryKey } from "@/lib/coordinator-attention";
import { storybookAuthSession } from "../../fixtures/paperclipData";
import { installFixtureApi } from "../../support/capability-gaps/api";
const STORYBOOK_USER_ID = storybookAuthSession.user!.id;
@@ -603,3 +607,58 @@ export const CardTriageStrip: Story = {
</PrimeDeskFixtures>
),
};
export const CoordinatorInboxMobile: Story = {
globals: { viewport: { value: "mobile", isRotated: false } },
parameters: {
layout: "fullscreen",
waitForViewport: true,
initialEntries: ["/PAP/decisions"],
},
beforeEach: () =>
installFixtureApi([
{
path: "/api/workspace-preferences/me",
read: () => ({
userId: STORYBOOK_USER_ID,
coordinatorWorkspaceEnabled: true,
updatedAt: null,
}),
},
{
path: `/api/companies/${companyId}/access/user-directory`,
read: () => ({
users: [
{
principalId: STORYBOOK_USER_ID,
status: "active",
user: { name: "Riley Board" },
},
],
}),
},
{
path: `/api/companies/${companyId}/attention/history`,
read: () => ({ items: [], nextCursor: null }),
},
{
path: `/api/companies/${companyId}/attention/run-history`,
read: () => ({ items: [], nextCursor: null }),
},
{
path: `/api/companies/${companyId}/attention`,
read: () => feed(DESK_ITEMS),
},
]).cleanup,
render: () => (
<PrimeDeskFixtures items={DESK_ITEMS}>
<PluginLauncherProvider>
<Routes>
<Route path="/:companyPrefix" element={<Layout />}>
<Route path="decisions" element={<CoordinatorNeedsYou />} />
</Route>
</Routes>
</PluginLauncherProvider>
</PrimeDeskFixtures>
),
};
@@ -96,7 +96,11 @@ export const CompanyDashboard: Story = { render: () => <MonitoringPage path="/PA
export const InboxRecent: Story = { render: () => <MonitoringPage path="/PAP/inbox" /> };
export const ProfileRecentTasks: Story = { render: () => <MonitoringPage path="/PAP/users/riley" /> };
export const StatusCardWatchedTasks: Story = { render: () => <StatusCardDetailDrawer card={makeStatusCard({ mentionedIssueIds: [monitored.id] })} companyId={companyId} open onOpenChange={() => undefined} initialTab="watched" /> };
export const TaskDetailMobile: Story = { ...TaskDetail, globals: { viewport: { value: "mobile", isRotated: false } }, parameters: { waitForViewport: true } };
export const TaskDetailMobile: Story = {
...TaskDetail,
globals: { viewport: { value: "mobile", isRotated: false } },
parameters: { layout: "fullscreen", waitForViewport: true },
};
export const TaskDetailLight: Story = { ...TaskDetail, globals: { theme: "light" } };
export const TaskDetailDark: Story = { ...TaskDetail, globals: { theme: "dark" } };
export const SharedIndicators: Story = {