diff --git a/ui/src/components/BreadcrumbBar.mobile.test.tsx b/ui/src/components/BreadcrumbBar.mobile.test.tsx new file mode 100644 index 00000000000..c656a13786b --- /dev/null +++ b/ui/src/components/BreadcrumbBar.mobile.test.tsx @@ -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("react-router-dom"); + return { + Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => ( + {children} + ), + 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( + + + + + + , + ); + }); + + const toggle = container.querySelector('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( + + + + + + , + ); + }); + + const toggle = container.querySelector('button[aria-label="Hide properties"]'); + expect(toggle).not.toBeNull(); + act(() => { + toggle!.click(); + }); + expect(onToggle).toHaveBeenCalledTimes(1); + + const items = [...container.querySelectorAll('[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( + + + + + + , + ); + }); + + const items = [...container.querySelectorAll('[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"); + }); +}); diff --git a/ui/src/components/BreadcrumbBar.tsx b/ui/src/components/BreadcrumbBar.tsx index dc09d363f38..c6307bd4ce3 100644 --- a/ui/src/components/BreadcrumbBar.tsx +++ b/ui/src/components/BreadcrumbBar.tsx @@ -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 ? ( + ), + JoinRequestResolver: () => null, +})); +vi.mock("./CoordinatorReviewPanel", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + CoordinatorReviewPanel: ({ item, artifact }: { item: AttentionItem; artifact: { kind: string } }) => ( +
+ Reviewing {item.subject.title} ({artifact.kind}) +
+ ), + }; +}); + +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( + + + + + , + ); + }); + 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('[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('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(); + }); +}); diff --git a/ui/src/components/coordinator/CoordinatorNeedsYou.tsx b/ui/src/components/coordinator/CoordinatorNeedsYou.tsx index 1590c6b9033..d95ea82fabf 100644 --- a/ui/src/components/coordinator/CoordinatorNeedsYou.tsx +++ b/ui/src/components/coordinator/CoordinatorNeedsYou.tsx @@ -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" ? : } 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("a[href]"); const mentioned = link ? needsYouMentionedArtifact(link.getAttribute("href")!, link.textContent) : null; if (!mentioned) return; @@ -410,7 +414,7 @@ export function CoordinatorNeedsYou() { : stalledReview ? <>

Choose how this task continues

This task is still in review with no active reviewer or continuation. Return it to work, request changes, or mark the task done.

: failedRun ? <>{heading} : budget ? <>{heading} - : approval ? <>{heading} showReview(item)} shareDraft onResolved={() => onResolved(item)} /> + : approval ? <>{heading} showReview(item)} shareDraft onResolved={() => onResolved(item)} /> : joinRequest ? <>{heading} onResolved(item)} /> : type === "review_task" ? <>{heading} : type === "blocked_task" ? <>{heading} @@ -452,6 +456,16 @@ export function CoordinatorNeedsYou() { const sectionHeading = (section: NeedsYouSection) =>

{NEEDS_YOU_SECTIONS[section].title}

; + 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
{archivedView ?

Archived

: null}
@@ -507,5 +521,70 @@ export function CoordinatorNeedsYou() { setSnoozedOpen(open => !open)}> + { if (!open) setReviewPanelOpen(false); }}> + + + {mobileActiveTab?.label ?? "Review"} + + {reviewTabs.tabs.length > 1 ? ( +
+ {reviewTabs.tabs.map((tab) => { + const selected = tab.id === mobileActiveTab?.id; + return ( +
+ + +
+ ); + })} +
+ ) : null} +
+ {mobileActiveTab && mobileActiveItem && mobileActiveArtifact ? ( + { + setReviewPanelOpen(false); + navigate(href); + }} + onResolved={() => { + closeReviewTab(mobileActiveTab.id); + if (reviewTabs.tabs.length <= 1) setReviewPanelOpen(false); + }} + /> + ) : ( +

This is no longer waiting on you.

+ )} +
+
+
; } diff --git a/ui/src/components/issue-output/IssueOutputSection.tsx b/ui/src/components/issue-output/IssueOutputSection.tsx index db57d791d17..496f6edb586 100644 --- a/ui/src/components/issue-output/IssueOutputSection.tsx +++ b/ui/src/components/issue-output/IssueOutputSection.tsx @@ -137,7 +137,7 @@ export function IssueOutputSection({ workProducts, resolveCreatorName, onMediaCl

Also produced

{mediaRest.length > 0 ? ( -
+
{mediaRest.map((item) => (
({ + Link: ({ to, children, ...props }: { to: string; children: React.ReactNode } & React.ComponentProps<"a">) => ( + {children} + ), + 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( + , + ); + + 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( + + undefined} /> + , + ); + + 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( + + + + + , + ); + + 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"); + }); +}); diff --git a/ui/src/components/task-chat/TaskChatBubble.tsx b/ui/src/components/task-chat/TaskChatBubble.tsx index 780aad8f305..97b6ea1a0e8 100644 --- a/ui/src/components/task-chat/TaskChatBubble.tsx +++ b/ui/src/components/task-chat/TaskChatBubble.tsx @@ -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({ Images · {imageRefs.length} -
+
{imageRefs .slice(0, imageRefs.length > 4 ? 3 : 4) .map((ref, index) => ( diff --git a/ui/src/pages/CaseDetail.mobile.test.tsx b/ui/src/pages/CaseDetail.mobile.test.tsx new file mode 100644 index 00000000000..4d7dd9dae5c --- /dev/null +++ b/ui/src/pages/CaseDetail.mobile.test.tsx @@ -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("react-router-dom"); + return { + ...actual, + Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => ( + {children} + ), + 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( + + + + } /> + + + , + ); + }); + 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"); + }); +}); diff --git a/ui/src/pages/CaseDetail.tsx b/ui/src/pages/CaseDetail.tsx index 07bb4bc3a40..131ec2c54cb 100644 --- a/ui/src/pages/CaseDetail.tsx +++ b/ui/src/pages/CaseDetail.tsx @@ -95,14 +95,14 @@ export function CaseDetail() { const files = caseData.attachments.filter(attachment => !isImageAttachment(attachment)); const children = childrenQuery.data ?? []; - return
-
+ return
+
{caseData.caseType}
-

{caseData.title}

- {caseData.summary &&

{caseData.summary}

} +

{caseData.title}

+ {caseData.summary &&

{caseData.summary}

} {caseData.labels.length > 0 &&
{caseData.labels.map(label => {label.name})}
}
diff --git a/ui/src/pages/GoalDetail.mobile.test.tsx b/ui/src/pages/GoalDetail.mobile.test.tsx new file mode 100644 index 00000000000..59d4ca2e7ad --- /dev/null +++ b/ui/src/pages/GoalDetail.mobile.test.tsx @@ -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 } }) => ( +
Goal properties for {goal.title}
+ ), +})); + +vi.mock("../components/InlineEditor", () => ({ + InlineEditor: ({ value, as: Tag = "div", className }: { value: string; as?: "h2" | "p" | "div"; className?: string }) => ( + {value} + ), +})); + +vi.mock("@/lib/router", async () => { + const actual = await vi.importActual("react-router-dom"); + return { + ...actual, + Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => ( + {children} + ), + }; +}); + +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( + + + + } /> + + + , + ); + }); + await act(async () => { + await new Promise((resolve) => setTimeout(resolve, 0)); + }); + + const trigger = container.querySelector('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"); + }); +}); diff --git a/ui/src/pages/GoalDetail.tsx b/ui/src/pages/GoalDetail.tsx index edfce1697e9..3f01b7098dc 100644 --- a/ui/src/pages/GoalDetail.tsx +++ b/ui/src/pages/GoalDetail.tsx @@ -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" > @@ -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} -
+
+ setPanelVisible(true)} @@ -222,6 +236,26 @@ export function GoalDetail() { )} + + + + + Properties + + +
+ updateGoal.mutate(data)} + /> +
+
+
+
); } diff --git a/ui/src/pages/IssueDetail.mobile.test.tsx b/ui/src/pages/IssueDetail.mobile.test.tsx new file mode 100644 index 00000000000..08e950498f1 --- /dev/null +++ b/ui/src/pages/IssueDetail.mobile.test.tsx @@ -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(); + 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 }) => ( +
+ Side panel for {issue.identifier} + {onRequestClose ? : null} +
+ ), +})); + +vi.mock("@/lib/router", async () => { + const actual = await vi.importActual("react-router-dom"); + return { + ...actual, + Link: ({ to, children, ...props }: { to: string; children: ReactNode } & React.ComponentProps<"a">) => ( + {children} + ), + }; +}); + +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 ( + + + + + + + + {children} + + + + + + + + ); + } + + it("exposes mobile Properties sheet trigger, BreadcrumbBar properties toggle, and More task actions menu on Streamlined IssueDetail", async () => { + await act(async () => { + root.render( + + + + } /> + + , + ); + }); + await flush(); + + const moreButton = container.querySelector('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('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('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('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( + + + CHAT_ISSUE, + }} + /> + , + ); + }); + await flush(); + + const showToggle = container.querySelector('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('button[aria-label="Hide properties"]')).not.toBeNull(); + }); +}); diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsx index 156e436a985..906e009df7a 100644 --- a/ui/src/pages/IssueDetail.tsx +++ b/ui/src/pages/IssueDetail.tsx @@ -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 ? ( -
+
{!proposedTaskHeader ? (
{issueStatusControl}
) : null} @@ -8067,14 +8080,31 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS /> ) : null} -
- +
+ {streamlinedTaskDetailEnabled && !(isMobile && isFromInbox) ? ( + + ) : null} + )} -
diff --git a/ui/storybook/stories/agent-chat/agent-chat.stories.tsx b/ui/storybook/stories/agent-chat/agent-chat.stories.tsx index 4eeeb7dab43..55ae94c8ba7 100644 --- a/ui/storybook/stories/agent-chat/agent-chat.stories.tsx +++ b/ui/storybook/stories/agent-chat/agent-chat.stories.tsx @@ -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 }, +}; diff --git a/ui/storybook/stories/cases/case-detail.stories.tsx b/ui/storybook/stories/cases/case-detail.stories.tsx index b324e75f204..4d402768bf4 100644 --- a/ui/storybook/stories/cases/case-detail.stories.tsx +++ b/ui/storybook/stories/cases/case-detail.stories.tsx @@ -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: () => ( + + + }> + } /> + + + + ), +}; diff --git a/ui/storybook/stories/goals/goal-alignment.stories.tsx b/ui/storybook/stories/goals/goal-alignment.stories.tsx index 6bb724ee37f..76163eeae5d 100644 --- a/ui/storybook/stories/goals/goal-alignment.stories.tsx +++ b/ui/storybook/stories/goals/goal-alignment.stories.tsx @@ -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: () => ( + + + }> + } /> + + + + ), +}; diff --git a/ui/storybook/stories/inbox-search/decisions-desk.stories.tsx b/ui/storybook/stories/inbox-search/decisions-desk.stories.tsx index 60bcd8f162c..c9786ce4930 100644 --- a/ui/storybook/stories/inbox-search/decisions-desk.stories.tsx +++ b/ui/storybook/stories/inbox-search/decisions-desk.stories.tsx @@ -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 = { ), }; + +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: () => ( + + + + }> + } /> + + + + + ), +}; diff --git a/ui/storybook/stories/tasks/monitoring-status.stories.tsx b/ui/storybook/stories/tasks/monitoring-status.stories.tsx index 17b8e25a962..9664161eec1 100644 --- a/ui/storybook/stories/tasks/monitoring-status.stories.tsx +++ b/ui/storybook/stories/tasks/monitoring-status.stories.tsx @@ -96,7 +96,11 @@ export const CompanyDashboard: Story = { render: () => }; export const ProfileRecentTasks: Story = { render: () => }; export const StatusCardWatchedTasks: Story = { render: () => 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 = {