mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 09:05:15 +01:00
fix(ui): polish mobile tables, popovers, PageTabBar callers, and settings (#23048)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Operators use the board UI on mobile viewports (`390x844`) to inspect routines, members, costs, projects, dashboards, skills, and settings > - Wide tables overflowed the page horizontally, several `PageTabBar` callers omitted `value`/`onValueChange` (breaking their mobile section dropdowns), `w-96` popovers and floating save bars clipped or overlapped the bottom nav, and key controls were hover-only or cramped on narrow screens > - Mobile operators could not scroll clipped columns, switch sections, switch diff files, or tap hidden row actions on phones > - This pull request constrains table scrollers and flex/grid ancestors, wires all missing `PageTabBar` mobile callbacks, caps wide popovers and floating save bars using existing viewport tokens, polishes narrow layouts across collections and settings, and adds 390×844 Storybook views and Vitest regressions > - The benefit is clean mobile layout without horizontal page overflow and working touch controls across tables, tabs, popovers, dashboards, and settings ## Linked Issues or Issue Description Related mobile responsiveness PRs: #23045, #23046, #23047. **What happened?** On mobile viewports (`< 768px`, tested at `390x844`): - Wide tables in Routines, Members, Costs, Connections, and tool profile views caused horizontal page overflow or permanently clipped columns (`overflow-hidden`). - `AuditHub`, `Costs` (Providers/Billers), `Approvals`, `Inbox`, and `LegacyInbox` omitted `value` and/or `onValueChange` on `PageTabBar`, bypassing its mobile `<select>` section switcher. - `w-96` popovers in `RoutinePage` and `WorkspaceServiceControlBar` overflowed narrow viewports; the `CompanySkills` diff dialog hid its file picker on `< md` and its floating save bar overlapped `MobileBottomNav`. - `ProjectDetail` task toolbars crushed the search field on `< sm`, `Dashboard` charts rendered 2 cramped columns with uneven metric card heights, `Agents` hid row `Chat` buttons on touch devices, and `Inbox` hid nesting controls on `< sm`. **Expected behavior** Every collection, table, popover, dashboard, and settings screen stays within the mobile viewport (`scrollWidth <= innerWidth`), wide tables scroll horizontally inside their containers, mobile `PageTabBar` dropdowns switch sections cleanly, and touch users can reach all row actions, diff files, and nesting controls. **Steps to reproduce** 1. Open the board UI at `390x844` (or the added Storybook `*Mobile` stories). 2. Navigate to Routines, Settings → Members, Settings → Profile, Audit → Costs, Approvals, Project Detail, Dashboard, and Company Skills diff view. 3. Observe horizontal overflow, missing mobile tab switchers, hidden diff file picker, and cramped toolbars/charts prior to this change. **Paperclip version or commit** `85ad16b47e` (`master`) **Deployment mode** Local dev (pnpm dev) ## What Changed - **Horizontal table scroll containment & ancestor constraints**: - Wrapped and constrained tables plus flex/grid ancestors (`overflow-x-auto max-w-full`, `min-w-0`) in `RoutineTable.tsx`, `Routines.tsx`, `CompanyAccess.tsx`, `CostByUserTable.tsx`, `Costs.tsx`, `ProfileSettings.tsx`, `Connections.tsx`, `AgentToolsTab.tsx`, `RoutineHistoryTab.tsx`, `RoutineVariablesEditor.tsx`, `ProfilesTab.tsx`, `ProfileDetail.tsx`, `ProfilesIndex.tsx`, and `SmokeLabTab.tsx`. - Fixed `ProfileSettings.tsx` avatar upload `<label>` sizing (`inline-block w-fit`) so the camera badge stays anchored to the avatar circle. - **Wired missing `PageTabBar` mobile callbacks**: - Passed `value` and `onValueChange` to `PageTabBar` in `AuditHub.tsx`, `Costs.tsx` (Providers and Billers), `Approvals.tsx`, `Inbox.tsx`, and `LegacyInbox.tsx`. - **Popovers & floating bars**: - Capped `w-96` popovers in `RoutinePage.tsx` and `WorkspaceServiceControlBar.tsx` with `max-w-(--sz-calc-4)` and wrapping footer rows. - Added a mobile file `<select>` (`md:hidden`) in the `CompanySkills.tsx` version diff dialog and lifted its floating save bar above `MobileBottomNav` (`bottom-20 md:bottom-6 max-w-(--sz-calc-4) flex-wrap`). - **Touch visibility & responsive layout polish**: - Switched `ProjectDetail.tsx` task lists to `toolbarPresentation="collection"` so the toolbar wraps cleanly on `< sm`, and added `flex-wrap` to its left-membership notice banner. - Made the `Agents.tsx` inline row `Chat` button touch-visible via `pointer-coarse:opacity-100`. - Exposed mobile parent-child nesting toggle and row expand chevrons in `Inbox.tsx` and `LegacyInbox.tsx`. - Stacked `Dashboard.tsx` chart cards to `grid-cols-1 sm:grid-cols-2` and aligned the 2×2 summary metric cards with `auto-rows-fr items-stretch`. - Added responsive wrapping and width caps in `CompanySettings.tsx`, `Secrets.tsx`, `SkillStudio.tsx`, `GrokBotSetupContent.tsx`, and `ActionTestDialog.tsx`. - **Storybook & Vitest coverage**: - Added 390×844 mobile Storybook views for Routines (`RoutinesListMobile`, `RoutineDetailMobile`), Members (`MembersMobile`), Costs (`CostsMobile`), ProjectDetail (`ProjectDetailMobile`), CompanySettings (`CompanySettingsMobile`), and Dashboard (`DashboardMobile`). - Added `ui/src/pages/mobile-collections-responsive.test.tsx`. ## Verification - `pnpm exec vitest run ui/src/pages/mobile-collections-responsive.test.tsx ui/src/pages/CompanyAccess.test.tsx ui/src/pages/Dashboard.test.ts` — 3 files, 35/35 passed - `pnpm --filter @paperclipai/ui typecheck` — passed (0 errors) - `pnpm check:token-gates` — all 4 gates CLEAN + cliplab character in sync - `node scripts/storybook-catalog.mjs --check` — passed (373 files, 3494 stories) - `node --test scripts/check-maps.test.mjs scripts/storybook-catalog.test.mjs scripts/storybook-feature-index.test.mjs` — 30/30 passed ## Risks - Low risk: layout-only responsive class updates, missing prop wiring on `PageTabBar` callers, and additive mobile Storybook stories/tests. Desktop breakpoints (`sm:` / `md:` / `lg:` / `xl:`) preserve existing layouts. - Several edited pages (`CompanySkills.tsx`, `Inbox.tsx`, `LegacyInbox.tsx`, `Secrets.tsx`, `SkillStudio.tsx`, `Costs.tsx`, `ProfilesTab.tsx`, `RoutineHistoryTab.tsx`, `ActionTestDialog.tsx`) were already over 1,000 lines on `master`; this PR keeps edits minimal and localized without introducing new subsystems into those files. ## Model Used - Google Gemini 4 Neon (High) via Antigravity (tool use, code execution, multi-agent code review) ## 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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
74f26f3b49
commit
26c72ed7ca
36 files changed
+940
-132
No files matched your search
@@ -6,12 +6,12 @@ import { formatTokens } from "../lib/utils";
|
||||
|
||||
export function CostByUserTable({ report }: { report: CostByUserReport }) {
|
||||
return (
|
||||
<Card className="gap-3 py-4">
|
||||
<Card className="min-w-0 max-w-full gap-3 py-4">
|
||||
<CardHeader className="gap-0 px-5">
|
||||
<CardTitle className="text-base">By user</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="px-5">
|
||||
<div className="overflow-x-auto">
|
||||
<CardContent className="min-w-0 px-5">
|
||||
<div className="max-w-full overflow-x-auto">
|
||||
<table aria-label="Costs by user" className="w-full text-sm">
|
||||
<thead className="text-muted-foreground">
|
||||
<tr className="border-b border-border">
|
||||
|
||||
@@ -847,28 +847,30 @@ function RoutineRevisionDiffModal({
|
||||
{fieldChanges.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No structural field changes.</p>
|
||||
) : (
|
||||
<table className="w-full text-sm border border-border rounded-md overflow-hidden">
|
||||
<thead>
|
||||
<tr className="text-xs uppercase tracking-wide bg-muted/30 text-muted-foreground">
|
||||
<th className="px-3 py-2 text-left">Field</th>
|
||||
<th className="px-3 py-2 text-left">Old value</th>
|
||||
<th className="px-3 py-2 text-left">New value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{fieldChanges.map((change) => (
|
||||
<tr key={change.field} className="border-t border-border/60">
|
||||
<td className="px-3 py-2 align-top text-xs font-medium">{change.field}</td>
|
||||
<td className="px-3 py-2 align-top text-xs text-red-700 dark:text-red-300">
|
||||
{change.oldValue ?? "—"}
|
||||
</td>
|
||||
<td className="px-3 py-2 align-top text-xs text-emerald-700 dark:text-emerald-300">
|
||||
{change.newValue ?? "—"}
|
||||
</td>
|
||||
<div className="max-w-full overflow-x-auto rounded-md border border-border">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-xs uppercase tracking-wide bg-muted/30 text-muted-foreground">
|
||||
<th className="px-3 py-2 text-left">Field</th>
|
||||
<th className="px-3 py-2 text-left">Old value</th>
|
||||
<th className="px-3 py-2 text-left">New value</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{fieldChanges.map((change) => (
|
||||
<tr key={change.field} className="border-t border-border/60">
|
||||
<td className="px-3 py-2 align-top text-xs font-medium">{change.field}</td>
|
||||
<td className="px-3 py-2 align-top text-xs text-red-700 dark:text-red-300">
|
||||
{change.oldValue ?? "—"}
|
||||
</td>
|
||||
<td className="px-3 py-2 align-top text-xs text-emerald-700 dark:text-emerald-300">
|
||||
{change.newValue ?? "—"}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
<section className="space-y-2">
|
||||
@@ -951,7 +953,7 @@ function DiffTable({ rows }: { rows: DiffRow[] }) {
|
||||
added: "+",
|
||||
};
|
||||
return (
|
||||
<div className="rounded-md border border-border text-xs font-mono leading-6 overflow-hidden">
|
||||
<div className="max-w-full overflow-x-auto rounded-md border border-border text-xs font-mono leading-6">
|
||||
<div className="grid grid-cols-(--gtc-1) border-b border-border/60 bg-muted/30 px-3 py-2 text-(length:--text-micro) uppercase tracking-wide text-muted-foreground">
|
||||
<span>Old</span>
|
||||
<span>New</span>
|
||||
|
||||
@@ -6,7 +6,7 @@ export function routineColumnGrid(columns: RoutineColumn[], selectMode = false)
|
||||
return [selectMode ? "var(--routine-select-width)" : null, "minmax(var(--routine-title-min), 1fr)", ...columns.map(column => `var(--routine-column-${column})`), "var(--routine-actions-width)"].filter(Boolean).join(" ");
|
||||
}
|
||||
export function RoutineTable({ columns, children, label, selectMode = false }: { columns: RoutineColumn[]; children: ReactNode; label: string; selectMode?: boolean }) {
|
||||
return <div className="overflow-x-auto"><div role="table" aria-label={label} className="routine-table">
|
||||
return <div className="max-w-full overflow-x-auto"><div role="table" aria-label={label} className="routine-table">
|
||||
<div role="row" className="routine-table-grid px-3 py-2 text-xs text-muted-foreground" style={{ gridTemplateColumns: routineColumnGrid(columns, selectMode) }}>
|
||||
{selectMode ? <span role="columnheader"><span className="sr-only">Select</span></span> : null}
|
||||
<span role="columnheader">Routine</span>
|
||||
|
||||
@@ -477,7 +477,7 @@ export function RoutineVariablesHint() {
|
||||
These are filled in automatically — no setup needed and they will not appear in the
|
||||
Variables list.
|
||||
</p>
|
||||
<div className="overflow-hidden rounded-lg border border-border/70">
|
||||
<div className="max-w-full overflow-x-auto rounded-lg border border-border/70">
|
||||
<table className="w-full text-left text-xs">
|
||||
<thead className="bg-muted/40 text-muted-foreground">
|
||||
<tr>
|
||||
|
||||
@@ -462,7 +462,7 @@ function MultiServiceBar({
|
||||
<ChevronDown className="size-3 text-muted-foreground" />
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="end" className="w-96 p-0" onOpenAutoFocus={(event) => event.preventDefault()}>
|
||||
<PopoverContent align="end" className="w-96 max-w-(--sz-calc-4) p-0" onOpenAutoFocus={(event) => event.preventDefault()}>
|
||||
<div className="px-4 pb-1 pt-3 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
||||
Services · {services.length}
|
||||
</div>
|
||||
@@ -471,7 +471,7 @@ function MultiServiceBar({
|
||||
<ServicePopoverRow key={entry.key} entry={entry} onAction={onAction} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 border-t border-border px-4 py-2">
|
||||
<div className="flex flex-wrap items-center gap-1 border-t border-border px-4 py-2">
|
||||
<Button variant="ghost" size="xs" onClick={() => onAction("start", null)}>Start all</Button>
|
||||
<Button variant="ghost" size="xs" onClick={() => onAction("stop", null)}>Stop all</Button>
|
||||
<Button variant="ghost" size="xs" onClick={() => onAction("restart", null)}>Restart all</Button>
|
||||
|
||||
@@ -45,7 +45,7 @@ export function GrokBotSetupContent(p: GrokBotSetupContentProps) {
|
||||
<DialogTitle className="text-xl font-semibold tracking-tight">{ready ? "Your Grok Bot is connected" : "Connect your Grok Bot"}</DialogTitle>
|
||||
<DialogDescription className="text-sm leading-relaxed">{ready ? `${p.details.botName} can receive assignments and work with ${p.companyName}.` : `Bring an existing Bot into ${p.companyName}. It continues to run in Grok Bot.`}</DialogDescription>
|
||||
</div>
|
||||
<ol aria-label="Grok Bot setup" className="grid grid-cols-4 gap-2 text-xs text-muted-foreground">
|
||||
<ol aria-label="Grok Bot setup" className="grid grid-cols-2 gap-2 text-xs text-muted-foreground sm:grid-cols-4">
|
||||
{steps.map((label, index) => <li key={label} aria-current={p.step === index ? "step" : undefined} className={p.step === index ? "font-medium text-foreground" : ""}>{index + 1}. {label}</li>)}
|
||||
</ol>
|
||||
{p.error && <div role="alert" className="space-y-2 text-sm text-destructive"><p>{p.error}</p><Button variant="outline" disabled={p.busy} onClick={p.onRetry}>Try again</Button></div>}
|
||||
|
||||
@@ -180,10 +180,10 @@ function ScheduleRow({
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
{/* Wider when Pause/Resume joins Remove and Save, so the footer stays on one row. */}
|
||||
<PopoverContent align="start" className={cn("flex flex-col gap-4", onSetPaused ? "w-96" : "w-80")}>
|
||||
<PopoverContent align="start" className={cn("flex max-w-(--sz-calc-4) flex-col gap-4", onSetPaused ? "w-96" : "w-80")}>
|
||||
<ScheduleEditor value={cron} onChange={setCron} onValidityChange={setValid} />
|
||||
<p className="text-xs text-muted-foreground">Times are in {timezone}.</p>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
@@ -606,9 +606,9 @@ export function AgentToolsTab({ agent, companyId }: { agent: AgentDetailRecord;
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
<div className="grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
{/* Allowed tools table */}
|
||||
<div className="lg:col-span-2">
|
||||
<div className="min-w-0 lg:col-span-2">
|
||||
<div className="rounded-lg border border-border">
|
||||
<div className="flex items-center justify-between gap-2 border-b border-border px-3 py-2.5">
|
||||
<h3 className="text-sm font-semibold text-foreground">Allowed tools</h3>
|
||||
@@ -621,7 +621,8 @@ export function AgentToolsTab({ agent, companyId }: { agent: AgentDetailRecord;
|
||||
No tools are allowed for this agent. Bind a tool profile to grant access.
|
||||
</p>
|
||||
) : (
|
||||
<table className="w-full text-sm">
|
||||
<div className="max-w-full overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border text-left text-xs text-muted-foreground">
|
||||
<th className="px-3 py-2 font-medium">Tool</th>
|
||||
@@ -656,6 +657,7 @@ export function AgentToolsTab({ agent, companyId }: { agent: AgentDetailRecord;
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -478,7 +478,7 @@ export function Agents({ initialView = "list" }: { initialView?: AgentsView } =
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover/agent-row:opacity-100 focus-visible:opacity-100"
|
||||
className="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover/agent-row:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100"
|
||||
aria-label={`Chat with ${agent.name}`}
|
||||
onClick={() => navigate(`/chats/${agentRouteRef(agent)}`)}
|
||||
>
|
||||
|
||||
+15
-11
@@ -104,17 +104,21 @@ export function Approvals() {
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Tabs value={statusFilter} onValueChange={(v) => navigate(`/approvals/${v}`)}>
|
||||
<PageTabBar items={[
|
||||
{ value: "pending", label: <>Pending{pendingCount > 0 && (
|
||||
<Badge variant="ghost" className={cn(
|
||||
"ml-1.5 px-1.5 text-(length:--text-nano)",
|
||||
"bg-yellow-500/20 text-yellow-500"
|
||||
)}>
|
||||
{pendingCount}
|
||||
</Badge>
|
||||
)}</> },
|
||||
{ value: "all", label: "All" },
|
||||
]} />
|
||||
<PageTabBar
|
||||
value={statusFilter}
|
||||
onValueChange={(v) => navigate(`/approvals/${v}`)}
|
||||
items={[
|
||||
{ value: "pending", label: <>Pending{pendingCount > 0 && (
|
||||
<Badge variant="ghost" className={cn(
|
||||
"ml-1.5 px-1.5 text-(length:--text-nano)",
|
||||
"bg-yellow-500/20 text-yellow-500"
|
||||
)}>
|
||||
{pendingCount}
|
||||
</Badge>
|
||||
)}</> },
|
||||
{ value: "all", label: "All" },
|
||||
]}
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ export function CompanyAccess() {
|
||||
const assignedIssues = assignedIssuesQuery.data ?? [];
|
||||
|
||||
return (
|
||||
<div className="max-w-6xl space-y-8">
|
||||
<div className="min-w-0 max-w-6xl space-y-8">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<ShieldCheck className="h-5 w-5 text-muted-foreground" />
|
||||
@@ -299,7 +299,7 @@ export function CompanyAccess() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Tabs value={activeTab} onValueChange={handleTabChange} className="flex flex-col gap-4">
|
||||
<Tabs value={activeTab} onValueChange={handleTabChange} className="flex min-w-0 max-w-full flex-col gap-4">
|
||||
{!hideInvitesTab && (
|
||||
<PageTabBar
|
||||
items={[
|
||||
@@ -311,7 +311,7 @@ export function CompanyAccess() {
|
||||
onValueChange={handleTabChange}
|
||||
/>
|
||||
)}
|
||||
<TabsContent value="members" className="space-y-8">
|
||||
<TabsContent value="members" className="min-w-0 max-w-full space-y-8">
|
||||
|
||||
{access && !access.currentUserRole && (
|
||||
<div className="rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200">
|
||||
@@ -319,7 +319,7 @@ export function CompanyAccess() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<section className="space-y-4">
|
||||
<section className="min-w-0 max-w-full space-y-4">
|
||||
{access?.canApproveJoinRequests && pendingHumanJoinRequests.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
@@ -364,7 +364,7 @@ export function CompanyAccess() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="overflow-x-auto">
|
||||
<div className="max-w-full overflow-x-auto">
|
||||
<table className="w-full min-w-(--sz-44rem) text-left text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border text-muted-foreground">
|
||||
@@ -593,7 +593,7 @@ export function CompanyAccess() {
|
||||
</Dialog>
|
||||
</TabsContent>
|
||||
{!hideInvitesTab && (
|
||||
<TabsContent value="invites">
|
||||
<TabsContent value="invites" className="min-w-0 max-w-full">
|
||||
<InvitesSection />
|
||||
</TabsContent>
|
||||
)}
|
||||
|
||||
@@ -311,7 +311,7 @@ export function CompanySettings() {
|
||||
Appearance
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="flex flex-wrap items-start gap-4">
|
||||
<div className="shrink-0">
|
||||
<CompanyPatternIcon
|
||||
companyName={companyName || selectedCompany.name}
|
||||
@@ -319,7 +319,7 @@ export function CompanySettings() {
|
||||
className="rounded-(--rad-14)"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 space-y-3">
|
||||
<div className="min-w-0 flex-1 space-y-3">
|
||||
<Field
|
||||
label="Logo"
|
||||
hint="Upload a PNG, JPEG, WEBP, GIF, or SVG logo image."
|
||||
|
||||
@@ -2589,12 +2589,12 @@ function SkillVersionDiffDialog({
|
||||
{(leftQuery.isLoading || rightQuery.isLoading) && <p className="text-sm text-muted-foreground">Loading selected versions…</p>}
|
||||
</DialogHeader>
|
||||
<div className="flex flex-wrap items-center gap-3 text-xs">
|
||||
<label className="flex items-center gap-2">
|
||||
<label className="flex min-w-0 items-center gap-2">
|
||||
<Badge variant="outline" className="border-red-500/30 bg-red-500/10 uppercase tracking-wider text-red-400">Old</Badge>
|
||||
<select
|
||||
value={leftVersionId ?? ""}
|
||||
onChange={(event) => onLeftVersionChange(event.target.value || null)}
|
||||
className="h-8 w-44 rounded-md border border-border bg-background px-2 text-xs"
|
||||
className="h-8 w-full max-w-44 rounded-md border border-border bg-background px-2 text-xs sm:w-44"
|
||||
>
|
||||
<option value="">Initial</option>
|
||||
{sorted.map((version) => (
|
||||
@@ -2602,12 +2602,12 @@ function SkillVersionDiffDialog({
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="flex items-center gap-2">
|
||||
<label className="flex min-w-0 items-center gap-2">
|
||||
<Badge variant="outline" className="border-green-500/30 bg-green-500/10 uppercase tracking-wider text-green-400">New</Badge>
|
||||
<select
|
||||
value={right?.id ?? ""}
|
||||
onChange={(event) => onRightVersionChange(event.target.value || null)}
|
||||
className="h-8 w-44 rounded-md border border-border bg-background px-2 text-xs"
|
||||
className="h-8 w-full max-w-44 rounded-md border border-border bg-background px-2 text-xs sm:w-44"
|
||||
>
|
||||
{sorted.map((version) => (
|
||||
<option key={version.id} value={version.id}>{versionLabel(version)}</option>
|
||||
@@ -2616,6 +2616,23 @@ function SkillVersionDiffDialog({
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{allPaths.length > 0 ? (
|
||||
<div className="md:hidden">
|
||||
<label className="flex items-center gap-2 text-xs">
|
||||
<span className="shrink-0 text-muted-foreground">File</span>
|
||||
<select
|
||||
aria-label="Diff file"
|
||||
value={effectivePath}
|
||||
onChange={(event) => setSelectedPath(event.target.value)}
|
||||
className="h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 font-mono text-xs text-foreground"
|
||||
>
|
||||
{allPaths.map((path) => (
|
||||
<option key={path} value={path}>{path}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex min-h-0 flex-1 gap-3">
|
||||
<aside className="hidden w-56 shrink-0 overflow-auto border-r border-border pr-3 md:block">
|
||||
{allPaths.map((path) => (
|
||||
@@ -3528,7 +3545,7 @@ export function SkillDetailPage({
|
||||
{/* Floating save bar: stays visible while a file edit is dirty so the
|
||||
unsaved state is obvious (PAP-10907 J). */}
|
||||
{isDirty ? (
|
||||
<div className="fixed bottom-6 left-1/2 z-40 flex -translate-x-1/2 items-center gap-3 rounded-full border border-border bg-background/95 px-4 py-2 shadow-lg backdrop-blur">
|
||||
<div className="fixed bottom-(--sz-calc-14) left-1/2 z-40 flex max-w-(--sz-calc-4) -translate-x-1/2 flex-wrap items-center justify-center gap-3 rounded-2xl border border-border bg-background/95 px-4 py-2 shadow-lg backdrop-blur sm:rounded-full md:bottom-6">
|
||||
<span className="text-sm text-muted-foreground">Unsaved changes</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
+18
-18
@@ -605,7 +605,7 @@ export function Costs({
|
||||
const showOverviewLoading = spendLoading && customReady;
|
||||
const overviewError = !spendData && spendError;
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="min-w-0 max-w-full space-y-6">
|
||||
{scopedAgentError && (
|
||||
<p role="alert" className="text-sm text-destructive">Could not load agent details. Totals below show recorded organization costs.</p>
|
||||
)}
|
||||
@@ -737,7 +737,7 @@ export function Costs({
|
||||
) : null}
|
||||
|
||||
{incidentMutation.error && <p role="alert" className="text-sm text-destructive">Could not update the budget. Check any pending runs or unpriced usage shown on this page, then try again.</p>}
|
||||
<Tabs value={mainTab} onValueChange={(value) => { setMainTab(value as typeof mainTab); setSearchParams(current => { const next = new URLSearchParams(current); next.set("tab", value); return next; }, { replace: true }); }}>
|
||||
<Tabs className="min-w-0 max-w-full" value={mainTab} onValueChange={(value) => { setMainTab(value as typeof mainTab); setSearchParams(current => { const next = new URLSearchParams(current); next.set("tab", value); return next; }, { replace: true }); }}>
|
||||
{!lockTab ? (
|
||||
<div className="max-w-full overflow-x-auto pb-2">
|
||||
<TabsList variant="line" className="justify-start">
|
||||
@@ -752,9 +752,9 @@ export function Costs({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<TabsContent value="fast-responses" className="mt-4">{showCustomPrompt ? <p className="text-sm text-muted-foreground">Select a start and end date to load data.</p> : <FastResponseHistory companyId={companyId} from={from} to={to} />}</TabsContent>
|
||||
<TabsContent value="decisions" className="mt-4">{showCustomPrompt ? <p className="text-sm text-muted-foreground">Select a start and end date to load data.</p> : <DecisionHistory companyId={companyId} from={from} to={to} />}</TabsContent>
|
||||
<TabsContent value="overview" className="mt-4 space-y-4">
|
||||
<TabsContent value="fast-responses" className="mt-4 min-w-0 max-w-full">{showCustomPrompt ? <p className="text-sm text-muted-foreground">Select a start and end date to load data.</p> : <FastResponseHistory companyId={companyId} from={from} to={to} />}</TabsContent>
|
||||
<TabsContent value="decisions" className="mt-4 min-w-0 max-w-full">{showCustomPrompt ? <p className="text-sm text-muted-foreground">Select a start and end date to load data.</p> : <DecisionHistory companyId={companyId} from={from} to={to} />}</TabsContent>
|
||||
<TabsContent value="overview" className="mt-4 min-w-0 max-w-full space-y-4">
|
||||
{showCustomPrompt ? (
|
||||
<p className="text-sm text-muted-foreground">Select a start and end date to load data.</p>
|
||||
) : showOverviewLoading ? (
|
||||
@@ -763,8 +763,8 @@ export function Costs({
|
||||
<p className="text-sm text-destructive">Cost data could not be loaded. Please try again shortly.</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="grid gap-4 xl:grid-cols-(--gtc-32)">
|
||||
<div className="min-w-0 space-y-4">
|
||||
<div className="grid min-w-0 gap-4 xl:grid-cols-(--gtc-32)">
|
||||
<div className="min-w-0 max-w-full space-y-4">
|
||||
<Card className="gap-3 py-4">
|
||||
<CardHeader className="gap-0 px-5">
|
||||
<CardTitle className="text-base">By agent</CardTitle>
|
||||
@@ -861,7 +861,7 @@ export function Costs({
|
||||
{userSpendData && <CostByUserTable report={userSpendData} />}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="min-w-0 max-w-full space-y-4">
|
||||
<Card className="gap-3 py-4">
|
||||
<CardHeader className="gap-0 px-5">
|
||||
<CardTitle className="text-base">By project</CardTitle>
|
||||
@@ -922,7 +922,7 @@ export function Costs({
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="budgets" className="mt-4 space-y-4">
|
||||
<TabsContent value="budgets" className="mt-4 min-w-0 max-w-full space-y-4">
|
||||
{policyMutation.error && <p role="alert" className="text-sm text-destructive">Could not update the budget policy. Review your settings and try again.</p>}
|
||||
{budgetLoading ? (
|
||||
<PageSkeleton variant="costs" />
|
||||
@@ -1035,13 +1035,13 @@ export function Costs({
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="providers" className="mt-4 space-y-4">
|
||||
<TabsContent value="providers" className="mt-4 min-w-0 max-w-full space-y-4">
|
||||
{showCustomPrompt ? (
|
||||
<p className="text-sm text-muted-foreground">Select a start and end date to load data.</p>
|
||||
) : (
|
||||
<>
|
||||
<Tabs value={effectiveProvider} onValueChange={setActiveProvider}>
|
||||
<PageTabBar items={providerTabItems} value={effectiveProvider} />
|
||||
<Tabs className="min-w-0 max-w-full" value={effectiveProvider} onValueChange={setActiveProvider}>
|
||||
<PageTabBar items={providerTabItems} value={effectiveProvider} onValueChange={setActiveProvider} />
|
||||
|
||||
<TabsContent value="all" className="mt-4">
|
||||
{providers.length === 0 ? (
|
||||
@@ -1096,13 +1096,13 @@ export function Costs({
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="billers" className="mt-4 space-y-4">
|
||||
<TabsContent value="billers" className="mt-4 min-w-0 max-w-full space-y-4">
|
||||
{showCustomPrompt ? (
|
||||
<p className="text-sm text-muted-foreground">Select a start and end date to load data.</p>
|
||||
) : (
|
||||
<>
|
||||
<Tabs value={effectiveBiller} onValueChange={setActiveBiller}>
|
||||
<PageTabBar items={billerTabItems} value={effectiveBiller} />
|
||||
<Tabs className="min-w-0 max-w-full" value={effectiveBiller} onValueChange={setActiveBiller}>
|
||||
<PageTabBar items={billerTabItems} value={effectiveBiller} onValueChange={setActiveBiller} />
|
||||
|
||||
<TabsContent value="all" className="mt-4">
|
||||
{billers.length === 0 ? (
|
||||
@@ -1151,7 +1151,7 @@ export function Costs({
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="finance" className="mt-4 space-y-4">
|
||||
<TabsContent value="finance" className="mt-4 min-w-0 max-w-full space-y-4">
|
||||
{financeData?.summary.providerReportedCentsExact !== undefined && <p className="text-sm text-muted-foreground">Provider API cost reports: {formatCents(financeData.summary.providerReportedCents ?? 0)}. Report totals overlap invoices and run estimates and are shown separately from recorded charges.</p>}
|
||||
|
||||
{showCustomPrompt ? (
|
||||
@@ -1170,8 +1170,8 @@ export function Costs({
|
||||
eventCount={financeData?.summary.eventCount ?? 0}
|
||||
/>
|
||||
|
||||
<div className="grid gap-4 xl:grid-cols-(--gtc-33)">
|
||||
<div className="space-y-4">
|
||||
<div className="grid min-w-0 gap-4 xl:grid-cols-(--gtc-33)">
|
||||
<div className="min-w-0 space-y-4">
|
||||
<Card>
|
||||
<CardHeader className="px-5 pt-5 pb-2">
|
||||
<CardTitle className="text-base">By biller</CardTitle>
|
||||
|
||||
@@ -410,7 +410,7 @@ export function Dashboard() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className={cn("grid grid-cols-2 xl:grid-cols-4", designSandbox ? "gap-4" : "gap-1 sm:gap-2")}>
|
||||
<div className={cn("grid auto-rows-fr grid-cols-2 items-stretch xl:grid-cols-4", designSandbox ? "gap-4" : "gap-1 sm:gap-2")}>
|
||||
<MetricCard
|
||||
appearance={designSandbox ? "card" : "plain"}
|
||||
icon={Bot}
|
||||
@@ -470,7 +470,7 @@ export function Dashboard() {
|
||||
|
||||
<SmokeLabDashboardCard companyId={selectedCompanyId!} />
|
||||
|
||||
<div className={cn("grid grid-cols-2 gap-4", SHOW_TASK_PRIORITY_UI ? "lg:grid-cols-4" : "lg:grid-cols-3")}>
|
||||
<div className={cn("grid grid-cols-1 gap-4 sm:grid-cols-2", SHOW_TASK_PRIORITY_UI ? "lg:grid-cols-4" : "lg:grid-cols-3")}>
|
||||
<ChartCard title="Run Activity" subtitle="Last 14 days">
|
||||
<RunActivityChart activity={data.runActivity} />
|
||||
</ChartCard>
|
||||
|
||||
@@ -2789,6 +2789,8 @@ function StreamlinedInbox({
|
||||
context={toolbarContext ?? (
|
||||
<Tabs value={tab} onValueChange={(value) => navigate(`/inbox/${value}`)}>
|
||||
<PageTabBar
|
||||
value={tab}
|
||||
onValueChange={(value) => navigate(`/inbox/${value}`)}
|
||||
items={[
|
||||
{ value: "mine", label: "Mine" },
|
||||
{ value: "recent", label: "Recent" },
|
||||
@@ -2932,7 +2934,7 @@ function StreamlinedInbox({
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className={cn("hidden h-8 w-8 shrink-0 sm:inline-flex", nestingEnabled && "bg-accent")}
|
||||
className={cn("inline-flex h-8 w-8 shrink-0", nestingEnabled && "bg-accent")}
|
||||
onClick={toggleNesting}
|
||||
title={nestingEnabled ? "Disable parent-child nesting" : "Enable parent-child nesting"}
|
||||
>
|
||||
@@ -3232,7 +3234,8 @@ function StreamlinedInbox({
|
||||
<button
|
||||
type="button"
|
||||
data-slot="icon-button"
|
||||
className="hidden w-4 shrink-0 items-center justify-center sm:inline-flex"
|
||||
className="inline-flex w-4 shrink-0 items-center justify-center"
|
||||
aria-label={isExpanded ? "Collapse sub-tasks" : "Expand sub-tasks"}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -3242,7 +3245,7 @@ function StreamlinedInbox({
|
||||
<ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
|
||||
</button>
|
||||
) : (
|
||||
<span className="hidden w-4 shrink-0 sm:block" />
|
||||
<span className="block w-4 shrink-0" />
|
||||
)
|
||||
) : null}
|
||||
<InboxIssueMetaLeading
|
||||
|
||||
@@ -2318,6 +2318,8 @@ export function Inbox() {
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<Tabs value={tab} onValueChange={(value) => navigate(`/inbox/${value}`)}>
|
||||
<PageTabBar
|
||||
value={tab}
|
||||
onValueChange={(value) => navigate(`/inbox/${value}`)}
|
||||
items={[
|
||||
{
|
||||
value: "mine",
|
||||
@@ -2457,7 +2459,7 @@ export function Inbox() {
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className={cn("hidden h-8 w-8 shrink-0 sm:inline-flex", nestingEnabled && "bg-accent")}
|
||||
className={cn("inline-flex h-8 w-8 shrink-0", nestingEnabled && "bg-accent")}
|
||||
onClick={toggleNesting}
|
||||
title={nestingEnabled ? "Disable parent-child nesting" : "Enable parent-child nesting"}
|
||||
>
|
||||
@@ -2726,7 +2728,8 @@ export function Inbox() {
|
||||
<button
|
||||
type="button"
|
||||
data-slot="icon-button"
|
||||
className="hidden w-4 shrink-0 items-center justify-center sm:inline-flex"
|
||||
className="inline-flex w-4 shrink-0 items-center justify-center"
|
||||
aria-label={isExpanded ? "Collapse sub-tasks" : "Expand sub-tasks"}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -2741,7 +2744,7 @@ export function Inbox() {
|
||||
// collapse chevron. (The unread mark-read dot has
|
||||
// its own reserved leading slot in IssueRow, to the
|
||||
// left of this spacer.)
|
||||
<span className="hidden w-4 shrink-0 sm:block" />
|
||||
<span className="block w-4 shrink-0" />
|
||||
)
|
||||
) : null}
|
||||
<InboxIssueMetaLeading
|
||||
|
||||
@@ -159,7 +159,7 @@ export function ProfileSettings() {
|
||||
: "Select an organization to upload an avatar into Paperclip storage.";
|
||||
|
||||
return (
|
||||
<div className="max-w-6xl space-y-6">
|
||||
<div className="min-w-0 max-w-6xl space-y-6">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<UserRoundPen className="h-5 w-5 text-muted-foreground" />
|
||||
@@ -176,16 +176,16 @@ export function ProfileSettings() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<section className="space-y-8">
|
||||
<Card className="block relative overflow-hidden rounded-(--rad-28) border-border/70">
|
||||
<section className="min-w-0 max-w-full space-y-8">
|
||||
<Card className="block relative min-w-0 max-w-full overflow-hidden rounded-(--rad-28) border-border/70">
|
||||
<div className="absolute inset-x-0 top-0 h-32 bg-(image:--gradient-extract-26)" />
|
||||
<div className="absolute inset-0 bg-(image:--gradient-extract-7)" />
|
||||
<div className="relative p-6 pt-10">
|
||||
<div className="flex flex-wrap items-end gap-5 rounded-(--rad-24) border border-border/70 bg-background/92 p-5 shadow-(--shadow-extract-18) backdrop-blur-sm">
|
||||
<div className="space-y-3">
|
||||
<div className="relative min-w-0 p-4 pt-8 sm:p-6 sm:pt-10">
|
||||
<div className="flex min-w-0 flex-wrap items-end gap-5 rounded-(--rad-24) border border-border/70 bg-background/92 p-4 shadow-(--shadow-extract-18) backdrop-blur-sm sm:p-5">
|
||||
<div className="min-w-0 max-w-full space-y-3">
|
||||
<label
|
||||
htmlFor={avatarInputId}
|
||||
className="group relative block cursor-pointer rounded-full focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
|
||||
className="group relative inline-block w-fit cursor-pointer rounded-full focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
|
||||
>
|
||||
<input
|
||||
ref={avatarInputRef}
|
||||
@@ -248,13 +248,13 @@ export function ProfileSettings() {
|
||||
</Card>
|
||||
|
||||
<form
|
||||
className="grid gap-6 md:grid-cols-2"
|
||||
className="grid min-w-0 gap-6 md:grid-cols-2"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
updateMutation.mutate({ name: resolveProfileName(), image: image.trim() || null });
|
||||
}}
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<div className="min-w-0 space-y-2">
|
||||
<Label htmlFor="profile-name">Display name</Label>
|
||||
<Input
|
||||
id="profile-name"
|
||||
@@ -268,7 +268,7 @@ export function ProfileSettings() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="min-w-0 space-y-2">
|
||||
<Label htmlFor="profile-email">Email</Label>
|
||||
<Input
|
||||
id="profile-email"
|
||||
|
||||
@@ -248,6 +248,7 @@ function ProjectIssuesList({ projectId, companyId }: { projectId: string; compan
|
||||
liveIssueIds={liveIssueIds}
|
||||
projectId={projectId}
|
||||
enableAgentCreatedVisibilityFilter
|
||||
toolbarPresentation="collection"
|
||||
viewStateKey="paperclip:project-issues-view"
|
||||
onUpdateIssue={(id, data) => updateIssue.mutate({ id, data })}
|
||||
/>
|
||||
@@ -320,6 +321,7 @@ function ProjectPluginOperationsList({
|
||||
projects={projects}
|
||||
liveIssueIds={liveIssueIds}
|
||||
projectId={projectId}
|
||||
toolbarPresentation="collection"
|
||||
viewStateKey={`paperclip:project-plugin-operations-view:${pluginKey}`}
|
||||
onUpdateIssue={(id, data) => updateIssue.mutate({ id, data })}
|
||||
/>
|
||||
@@ -751,7 +753,7 @@ export function ProjectDetail() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{showLeftProjectNotice ? (
|
||||
<div className="flex items-center gap-3 border border-yellow-300/35 bg-yellow-300/10 px-3 py-2 text-sm text-yellow-900 dark:text-yellow-100">
|
||||
<div className="flex flex-wrap items-center gap-3 border border-yellow-300/35 bg-yellow-300/10 px-3 py-2 text-sm text-yellow-900 dark:text-yellow-100">
|
||||
<p className="min-w-0 flex-1">
|
||||
You left this project. It no longer appears in your sidebar.
|
||||
</p>
|
||||
|
||||
@@ -544,7 +544,7 @@ export function Routines() {
|
||||
|
||||
if (!streamlinedUiEnabled && activeTab === "runs") {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="min-w-0 max-w-full space-y-6">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div className="space-y-1">
|
||||
<h1 className="text-2xl font-semibold tracking-tight">Routines</h1>
|
||||
@@ -587,7 +587,7 @@ export function Routines() {
|
||||
|
||||
const emptyList = sortedRoutines.length === 0;
|
||||
return (
|
||||
<div className={cn("space-y-6", emptyList && "empty-state-page")}>
|
||||
<div className={cn("min-w-0 max-w-full space-y-6", emptyList && "empty-state-page")}>
|
||||
<h1 className="sr-only">Routines</h1>
|
||||
<RoutinesToolbar
|
||||
query={query} onQueryChange={query => updateRoutineView({ query })}
|
||||
@@ -654,7 +654,7 @@ export function Routines() {
|
||||
onRetry={foldersView.retry} retrying={foldersView.isFetching} />
|
||||
) : null}
|
||||
|
||||
<div className={cn(showFolderRail && "flex gap-4", emptyList && "flex flex-1")}>
|
||||
<div className={cn("min-w-0 max-w-full", showFolderRail && "flex gap-4", emptyList && "flex flex-1")}>
|
||||
{showFolderRail ? (
|
||||
<FolderRail
|
||||
result={railFolderResult}
|
||||
@@ -672,7 +672,7 @@ export function Routines() {
|
||||
onDelete={setDeleteFolderTarget}
|
||||
/>
|
||||
) : null}
|
||||
<div className={cn("min-w-0 flex-1", emptyList && "flex flex-col")}>
|
||||
<div className={cn("min-w-0 max-w-full flex-1", emptyList && "flex flex-col")}>
|
||||
{routineViewState.groupBy === "folder" && routineFolders && !hasRoutineFolders && !foldersLoading && visibleRoutines.length > 0 ? (
|
||||
<AllUnfiledBanner
|
||||
storageKey={`paperclip:routines-folder-nudge:${selectedCompanyId ?? "none"}`}
|
||||
@@ -689,12 +689,13 @@ export function Routines() {
|
||||
onAction={openCreateRoutine}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex min-w-0 max-w-full flex-col gap-3">
|
||||
{routineSections.map((group) => {
|
||||
const isOpen = !routineViewState.collapsedGroups.includes(group.key);
|
||||
return (
|
||||
<Collapsible
|
||||
key={group.key}
|
||||
className="min-w-0 max-w-full"
|
||||
open={isOpen}
|
||||
onOpenChange={(open) => {
|
||||
updateRoutineView({
|
||||
@@ -711,7 +712,7 @@ export function Routines() {
|
||||
isOpen={isOpen}
|
||||
/>
|
||||
) : null}
|
||||
<CollapsibleContent>
|
||||
<CollapsibleContent className="min-w-0 max-w-full">
|
||||
<RoutineTable columns={routineViewState.columns} label={group.label ?? "Routines"}>
|
||||
{group.items.map((routine) => (
|
||||
<RoutineTableRow
|
||||
|
||||
@@ -2276,7 +2276,7 @@ export function Secrets() {
|
||||
|
||||
<TabsContent value="secrets" className="flex flex-col gap-3">
|
||||
<div data-canonical-toolbar="secrets" role="toolbar" aria-label="Secrets controls" className="flex flex-wrap items-center gap-2">
|
||||
<div className="relative w-48 sm:w-64 md:w-80">
|
||||
<div className="relative w-full sm:w-64 md:w-80">
|
||||
<Search className="pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input
|
||||
value={search}
|
||||
|
||||
@@ -1254,8 +1254,8 @@ function SkillSwitcher({
|
||||
onValueChange={(value) => {
|
||||
if (value !== skill?.id) onSelectSkill(value);
|
||||
}}
|
||||
triggerClassName="h-8 w-64 border-0 bg-transparent px-0 text-base font-semibold shadow-none hover:bg-accent md:w-80"
|
||||
contentClassName="w-80"
|
||||
triggerClassName="h-8 w-64 max-w-full border-0 bg-transparent px-0 text-base font-semibold shadow-none hover:bg-accent md:w-80"
|
||||
contentClassName="w-80 max-w-(--sz-calc-4)"
|
||||
contentWidth="auto"
|
||||
renderValue={(option) => option?.label ?? skill?.name ?? emptyLabel}
|
||||
renderOption={(option, { selected }) => (
|
||||
|
||||
@@ -405,7 +405,7 @@ export function Connections() {
|
||||
</button>
|
||||
)}
|
||||
|
||||
<div className={cn("overflow-hidden rounded-lg border border-border", ANALYTICS_MASK_CLASS)}>
|
||||
<div className={cn("max-w-full overflow-x-auto rounded-lg border border-border", ANALYTICS_MASK_CLASS)}>
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border bg-muted/40 text-left text-(length:--text-micro) font-semibold uppercase tracking-wide text-muted-foreground">
|
||||
|
||||
@@ -957,9 +957,9 @@ function PrettyPreview({ value }: { value: unknown }) {
|
||||
return (
|
||||
<dl className="max-h-64 overflow-auto divide-y divide-border rounded-md border border-border bg-background text-xs">
|
||||
{Object.entries(value as Record<string, unknown>).map(([key, field]) => (
|
||||
<div key={key} className="grid grid-cols-3 gap-3 px-3 py-2">
|
||||
<div key={key} className="grid grid-cols-1 gap-1 px-3 py-2 sm:grid-cols-3 sm:gap-3">
|
||||
<dt className="min-w-0 break-words text-muted-foreground">{key}</dt>
|
||||
<dd className="col-span-2 min-w-0 break-words whitespace-pre-wrap text-foreground">{typeof field === "object" && field !== null ? safeStringify(collapseDeep(field, 2)) : cellText(field)}</dd>
|
||||
<dd className="min-w-0 break-words whitespace-pre-wrap text-foreground sm:col-span-2">{typeof field === "object" && field !== null ? safeStringify(collapseDeep(field, 2)) : cellText(field)}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
@@ -996,9 +996,9 @@ function PreviewRowCard({ row, index }: { row: Record<string, unknown>; index: n
|
||||
{details.length > 0 && (
|
||||
<dl className="mt-2 space-y-1">
|
||||
{details.slice(0, 3).map(([key, field]) => (
|
||||
<div key={key} className="grid grid-cols-3 gap-2">
|
||||
<div key={key} className="grid grid-cols-1 gap-0.5 sm:grid-cols-3 sm:gap-2">
|
||||
<dt className="min-w-0 break-words text-muted-foreground">{key}</dt>
|
||||
<dd className="col-span-2 min-w-0 break-all text-foreground">{cellText(field)}</dd>
|
||||
<dd className="min-w-0 break-all text-foreground sm:col-span-2">{cellText(field)}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
|
||||
@@ -108,24 +108,29 @@ export function AuditHub({ section }: { section: AuditSection }) {
|
||||
}, { replace: true });
|
||||
}, [setSearchParams]);
|
||||
|
||||
const handleSectionChange = useCallback(
|
||||
(value: string) => {
|
||||
const next = value as AuditSection;
|
||||
navigate(auditSectionHref(next, scope));
|
||||
},
|
||||
[navigate, scope],
|
||||
);
|
||||
|
||||
if (!selectedCompanyId) {
|
||||
return <EmptyState icon={History} message="Select an organization to view Audit." />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="min-w-0 max-w-full space-y-6">
|
||||
<div>
|
||||
<h1 className="text-3xl font-semibold tracking-tight text-foreground">Audit</h1>
|
||||
</div>
|
||||
|
||||
<Tabs
|
||||
value={section}
|
||||
onValueChange={(value) => {
|
||||
const next = value as AuditSection;
|
||||
navigate(auditSectionHref(next, scope));
|
||||
}}
|
||||
onValueChange={handleSectionChange}
|
||||
>
|
||||
<PageTabBar items={AUDIT_SECTIONS} value={section} align="start" />
|
||||
<PageTabBar items={AUDIT_SECTIONS} value={section} onValueChange={handleSectionChange} align="start" />
|
||||
</Tabs>
|
||||
|
||||
{section === "commentary" ? (
|
||||
|
||||
@@ -0,0 +1,521 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { act, type ReactNode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { CostByUserTable } from "@/components/CostByUserTable";
|
||||
import { GrokBotSetupContent } from "@/components/new-agent/GrokBotSetupContent";
|
||||
import { RoutineTable } from "@/components/RoutineTable";
|
||||
import { Dialog, DialogContent } from "@/components/ui/dialog";
|
||||
import { WorkspaceServiceControlBar } from "@/components/WorkspaceServiceControlBar";
|
||||
import { Agents } from "./Agents";
|
||||
import { Approvals } from "./Approvals";
|
||||
import { AuditHub } from "./audit/AuditHub";
|
||||
import { CompanyAccess } from "./CompanyAccess";
|
||||
import { Dashboard } from "./Dashboard";
|
||||
import { ProfileSettings } from "./ProfileSettings";
|
||||
|
||||
const mockState = vi.hoisted(() => ({
|
||||
isMobile: true,
|
||||
pathname: "/approvals/pending",
|
||||
searchParams: new URLSearchParams(),
|
||||
}));
|
||||
|
||||
const mockNavigate = vi.hoisted(() => vi.fn());
|
||||
const mockApprovalsList = vi.hoisted(() => vi.fn());
|
||||
const mockAgentsList = vi.hoisted(() => vi.fn());
|
||||
const mockMembersList = vi.hoisted(() => vi.fn());
|
||||
const mockDashboardSummary = vi.hoisted(() => vi.fn());
|
||||
const mockActivityList = vi.hoisted(() => vi.fn());
|
||||
const mockIssuesListCompact = vi.hoisted(() => vi.fn());
|
||||
const mockAuthSession = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock("@/context/SidebarContext", () => ({
|
||||
useSidebar: () => ({ isMobile: mockState.isMobile }),
|
||||
}));
|
||||
|
||||
vi.mock("@/context/CompanyContext", () => ({
|
||||
useCompany: () => ({
|
||||
selectedCompanyId: "company-1",
|
||||
selectedCompany: { id: "company-1", name: "Paperclip", issuePrefix: "PAP" },
|
||||
companies: [{ id: "company-1", name: "Paperclip", issuePrefix: "PAP" }],
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/context/BreadcrumbContext", () => ({
|
||||
useBreadcrumbs: () => ({ setBreadcrumbs: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("@/context/ToastContext", () => ({
|
||||
useToast: () => ({ pushToast: vi.fn() }),
|
||||
useToastActions: () => ({ pushToast: vi.fn() }),
|
||||
useOptionalToastActions: () => ({ pushToast: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("@/context/DialogContext", () => ({
|
||||
useDialogActions: () => ({ openNewAgent: vi.fn(), openOnboarding: vi.fn(), openNewIssue: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("@/context/DesignSandboxContext", () => ({
|
||||
useDesignSandbox: () => false,
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/router", () => ({
|
||||
Link: ({ to, children, className }: { to: string; children: ReactNode; className?: string }) => (
|
||||
<a href={to} className={className}>{children}</a>
|
||||
),
|
||||
Navigate: ({ to }: { to: string }) => <div data-testid="navigate">{to}</div>,
|
||||
useNavigate: () => mockNavigate,
|
||||
useLocation: () => ({ pathname: mockState.pathname, search: "" }),
|
||||
useSearchParams: () => [
|
||||
mockState.searchParams,
|
||||
(updater: URLSearchParams | ((prev: URLSearchParams) => URLSearchParams)) => {
|
||||
mockState.searchParams = typeof updater === "function" ? updater(mockState.searchParams) : new URLSearchParams(updater);
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
vi.mock("@/api/approvals", () => ({
|
||||
approvalsApi: { list: (...args: unknown[]) => mockApprovalsList(...args), approve: vi.fn(), reject: vi.fn() },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/agents", () => ({
|
||||
agentsApi: {
|
||||
list: (...args: unknown[]) => mockAgentsList(...args),
|
||||
org: vi.fn().mockResolvedValue([]),
|
||||
resume: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/api/access", () => ({
|
||||
accessApi: {
|
||||
listMembers: (...args: unknown[]) => mockMembersList(...args),
|
||||
listJoinRequests: vi.fn().mockResolvedValue([]),
|
||||
listUserDirectory: vi.fn().mockResolvedValue({ users: [] }),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/api/cloud", () => ({
|
||||
cloudApi: { listStacks: vi.fn().mockResolvedValue({ stacks: [] }) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/dashboard", () => ({
|
||||
dashboardApi: { summary: (...args: unknown[]) => mockDashboardSummary(...args) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/activity", () => ({
|
||||
activityApi: { list: (...args: unknown[]) => mockActivityList(...args) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/issues", () => ({
|
||||
issuesApi: {
|
||||
listCompact: (...args: unknown[]) => mockIssuesListCompact(...args),
|
||||
summaries: vi.fn().mockResolvedValue([]),
|
||||
list: vi.fn().mockResolvedValue([]),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/api/companies-query", () => ({
|
||||
useAccountIdentity: () => ({ userId: "user-1", settled: true }),
|
||||
}));
|
||||
|
||||
vi.mock("@/api/auth", () => ({
|
||||
authApi: { getSession: (...args: unknown[]) => mockAuthSession(...args), updateProfile: vi.fn() },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/assets", () => ({
|
||||
assetsApi: { uploadImage: vi.fn() },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/heartbeats", () => ({
|
||||
heartbeatsApi: { liveRunsForCompany: vi.fn().mockResolvedValue([]) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/instanceSettings", () => ({
|
||||
instanceSettingsApi: { get: vi.fn().mockResolvedValue({ experimental: {} }) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/builtInAgents", () => ({
|
||||
builtInAgentsApi: { list: vi.fn().mockResolvedValue([]) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/environments", () => ({
|
||||
environmentsApi: { list: vi.fn().mockResolvedValue([]), capabilities: vi.fn().mockResolvedValue({}) },
|
||||
}));
|
||||
|
||||
vi.mock("@/api/ai-connections", () => ({
|
||||
aiConnectionsApi: { list: vi.fn().mockResolvedValue({ connections: [], pools: [] }) },
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useCloudHarnessPolicy", () => ({
|
||||
useCloudHarnessPolicy: () => ({}),
|
||||
}));
|
||||
|
||||
vi.mock("@/api/inbox-agent-policy", () => ({
|
||||
inboxAgentPolicyApi: {
|
||||
getMine: vi.fn().mockResolvedValue({ mode: "disabled", allowedAgentIds: [] }),
|
||||
updateMine: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/company-projects-query", () => ({
|
||||
companyProjectsQuery: () => ({ queryKey: ["projects", "company-1"], queryFn: async () => [] }),
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useHiddenSettings", () => ({
|
||||
useHiddenSettings: () => ({ hidden: new Set<string>() }),
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useCloudInstance", () => ({
|
||||
useCloudInstance: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useAgentChatEnabled", () => ({
|
||||
useAgentChatEnabled: () => ({ enabled: true }),
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useStreamlinedUiEnabled", () => ({
|
||||
useStreamlinedUiEnabled: () => ({ enabled: true }),
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useAgentlessOnboardingAutoOpen", () => ({
|
||||
useAgentlessOnboardingAutoOpen: () => {},
|
||||
}));
|
||||
|
||||
vi.mock("@/hooks/useSharedPolling", () => ({
|
||||
useSharedPollingQuery: () => ({ enabled: false, refetchInterval: false }),
|
||||
usePublishSharedQueryData: () => {},
|
||||
}));
|
||||
|
||||
vi.mock("@/plugins/slots", () => ({
|
||||
usePluginSlots: () => ({ slots: [], isLoading: false }),
|
||||
PluginSlotOutlet: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/ActiveAgentsPanel", () => ({
|
||||
ActiveAgentsPanel: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/SmokeLabDashboardCard", () => ({
|
||||
SmokeLabDashboardCard: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/ProductAnalyticsSetting", () => ({
|
||||
ProductAnalyticsSetting: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/primary-agent/PrimaryAgentPresentation", () => ({
|
||||
PrimaryAgentIndicator: () => null,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/AgentChatPin", () => ({
|
||||
AgentChatPin: () => null,
|
||||
useAgentChatPins: () => ({ isPinned: () => false, toggle: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("./audit/AuditFeed", () => ({
|
||||
AuditFeed: () => <div data-testid="audit-feed" />,
|
||||
}));
|
||||
|
||||
vi.mock("./audit/AuditRuns", () => ({
|
||||
AuditRuns: () => <div data-testid="audit-runs" />,
|
||||
}));
|
||||
|
||||
vi.mock("./audit/AgentCommentary", () => ({
|
||||
AgentCommentary: () => <div data-testid="agent-commentary" />,
|
||||
}));
|
||||
|
||||
vi.mock("./audit/RoutineAuditActivity", () => ({
|
||||
RoutineAuditActivity: () => <div data-testid="routine-audit" />,
|
||||
}));
|
||||
|
||||
vi.mock("./Costs", () => ({
|
||||
Costs: () => <div data-testid="costs-page" />,
|
||||
}));
|
||||
|
||||
vi.mock("./Timeline", () => ({
|
||||
Timeline: () => <div data-testid="timeline-page" />,
|
||||
}));
|
||||
|
||||
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
|
||||
|
||||
async function flush() {
|
||||
await act(async () => {
|
||||
await Promise.resolve();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
}
|
||||
|
||||
describe("mobile collections, tables, popovers, and settings polish", () => {
|
||||
let container: HTMLDivElement;
|
||||
let root: ReturnType<typeof createRoot> | null = null;
|
||||
let queryClient: QueryClient;
|
||||
|
||||
beforeEach(() => {
|
||||
container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
mockState.isMobile = true;
|
||||
mockState.pathname = "/approvals/pending";
|
||||
mockState.searchParams = new URLSearchParams();
|
||||
mockNavigate.mockReset();
|
||||
mockApprovalsList.mockResolvedValue([]);
|
||||
mockAgentsList.mockResolvedValue([]);
|
||||
mockMembersList.mockResolvedValue({
|
||||
members: [
|
||||
{
|
||||
id: "m1",
|
||||
companyId: "company-1",
|
||||
principalType: "user",
|
||||
principalId: "u1",
|
||||
status: "active",
|
||||
membershipRole: "owner",
|
||||
user: { id: "u1", name: "Ada Lovelace", email: "ada@example.com", image: null },
|
||||
},
|
||||
],
|
||||
access: { currentUserRole: "owner", canManageMembers: true, canApproveJoinRequests: false },
|
||||
});
|
||||
mockDashboardSummary.mockResolvedValue({
|
||||
agents: { active: 2, running: 1, paused: 0, error: 0 },
|
||||
tasks: { open: 5, inProgress: 2, blocked: 1, done: 10 },
|
||||
costs: { monthSpendCents: 1250, monthBudgetCents: 5000, monthUtilizationPercent: 25 },
|
||||
pendingApprovals: 1,
|
||||
budgets: { activeIncidents: 0, pausedAgents: 0, pausedProjects: 0, pendingApprovals: 0 },
|
||||
runActivity: [],
|
||||
});
|
||||
mockActivityList.mockResolvedValue([]);
|
||||
mockIssuesListCompact.mockResolvedValue([]);
|
||||
mockAuthSession.mockResolvedValue({
|
||||
session: { userId: "u1" },
|
||||
user: { id: "u1", name: "Ada Lovelace", email: "ada@example.com", image: null },
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (root) {
|
||||
await act(async () => {
|
||||
root?.unmount();
|
||||
});
|
||||
root = null;
|
||||
}
|
||||
container.remove();
|
||||
queryClient.clear();
|
||||
});
|
||||
|
||||
function renderWithClient(node: ReactNode) {
|
||||
root = createRoot(container);
|
||||
act(() => {
|
||||
root!.render(<QueryClientProvider client={queryClient}>{node}</QueryClientProvider>);
|
||||
});
|
||||
}
|
||||
|
||||
it("wires mobile PageTabBar section selection in AuditHub", async () => {
|
||||
renderWithClient(<AuditHub section="activity" />);
|
||||
await vi.waitFor(() => {
|
||||
expect(container.querySelector('select[aria-label="Page section"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
const select = container.querySelector<HTMLSelectElement>('select[aria-label="Page section"]')!;
|
||||
expect(select.value).toBe("activity");
|
||||
|
||||
act(() => {
|
||||
const setter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")?.set;
|
||||
setter?.call(select, "costs");
|
||||
select.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
});
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith("/activity/costs");
|
||||
});
|
||||
|
||||
it("wires mobile PageTabBar status filter in Approvals", async () => {
|
||||
renderWithClient(<Approvals />);
|
||||
await vi.waitFor(() => {
|
||||
expect(container.querySelector('select[aria-label="Page section"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
const select = container.querySelector<HTMLSelectElement>('select[aria-label="Page section"]')!;
|
||||
expect(select.value).toBe("pending");
|
||||
|
||||
act(() => {
|
||||
const setter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")?.set;
|
||||
setter?.call(select, "all");
|
||||
select.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
});
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith("/approvals/all");
|
||||
});
|
||||
|
||||
it("wraps RoutineTable, CostByUserTable, and CompanyAccess members table in constrained horizontal scrollers", async () => {
|
||||
renderWithClient(
|
||||
<>
|
||||
<RoutineTable columns={["project", "assignee"]} label="Routines">
|
||||
<div role="row">Row</div>
|
||||
</RoutineTable>
|
||||
<CostByUserTable
|
||||
report={{
|
||||
activeUserCount: 1,
|
||||
rows: [
|
||||
{
|
||||
userId: "u1",
|
||||
userName: "Ada",
|
||||
userImage: null,
|
||||
runCount: 4,
|
||||
inputTokens: 1000,
|
||||
cachedInputTokens: 200,
|
||||
outputTokens: 300,
|
||||
costCents: 150,
|
||||
costCentsExact: "150",
|
||||
eventCount: 4,
|
||||
estimatedEventCount: 0,
|
||||
unpricedEventCount: 0,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
<CompanyAccess />
|
||||
</>,
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
const membersTable = Array.from(container.querySelectorAll("table")).find((el) =>
|
||||
el.className.includes("min-w-(--sz-44rem)"),
|
||||
);
|
||||
expect(membersTable).toBeDefined();
|
||||
});
|
||||
|
||||
const routineTable = container.querySelector(".routine-table");
|
||||
expect(routineTable?.parentElement?.className).toContain("overflow-x-auto");
|
||||
expect(routineTable?.parentElement?.className).toContain("max-w-full");
|
||||
|
||||
const userCostTable = container.querySelector('table[aria-label="Costs by user"]');
|
||||
expect(userCostTable?.parentElement?.className).toContain("overflow-x-auto");
|
||||
expect(userCostTable?.parentElement?.className).toContain("max-w-full");
|
||||
expect(userCostTable?.closest('[data-slot="card"]')?.className).toContain("min-w-0");
|
||||
|
||||
const membersTable = Array.from(container.querySelectorAll("table")).find((el) =>
|
||||
el.className.includes("min-w-(--sz-44rem)"),
|
||||
);
|
||||
expect(membersTable?.parentElement?.className).toContain("overflow-x-auto");
|
||||
expect(membersTable?.parentElement?.className).toContain("max-w-full");
|
||||
expect(membersTable?.closest('[data-slot="tabs-content"]')?.className).toContain("min-w-0");
|
||||
});
|
||||
|
||||
it("stacks Dashboard charts into 1 column on mobile and aligns summary cards to uniform height", async () => {
|
||||
renderWithClient(<Dashboard />);
|
||||
await vi.waitFor(() => {
|
||||
const metricLabel = Array.from(container.querySelectorAll("p")).find((el) => el.textContent === "Agents Enabled");
|
||||
expect(metricLabel).toBeDefined();
|
||||
});
|
||||
|
||||
const metricLabel = Array.from(container.querySelectorAll("p")).find((el) => el.textContent === "Agents Enabled");
|
||||
const metricGrid = metricLabel?.closest(".grid");
|
||||
expect(metricGrid?.className).toContain("auto-rows-fr");
|
||||
expect(metricGrid?.className).toContain("items-stretch");
|
||||
|
||||
const chartHeading = Array.from(container.querySelectorAll("*")).find((el) => el.textContent === "Run Activity");
|
||||
const chartGrid = chartHeading?.closest(".grid");
|
||||
expect(chartGrid?.className).toContain("grid-cols-1");
|
||||
expect(chartGrid?.className).toContain("sm:grid-cols-2");
|
||||
});
|
||||
|
||||
it("exposes the inline Chat button on touch devices in Agents list view", async () => {
|
||||
mockState.pathname = "/agents/all";
|
||||
mockAgentsList.mockResolvedValue([
|
||||
{
|
||||
id: "agent-1",
|
||||
companyId: "company-1",
|
||||
name: "Codie",
|
||||
urlKey: "codie",
|
||||
role: "engineer",
|
||||
title: "Staff Engineer",
|
||||
status: "idle",
|
||||
adapterType: "codex_local",
|
||||
adapterConfig: {},
|
||||
runtimeConfig: {},
|
||||
},
|
||||
]);
|
||||
|
||||
renderWithClient(<Agents />);
|
||||
await vi.waitFor(() => {
|
||||
expect(container.querySelector('button[aria-label="Chat with Codie"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
const chatButton = container.querySelector<HTMLButtonElement>('button[aria-label="Chat with Codie"]');
|
||||
expect(chatButton).not.toBeNull();
|
||||
expect(chatButton!.className).toContain("pointer-coarse:opacity-100");
|
||||
});
|
||||
|
||||
it("uses responsive 2-column step grid in GrokBotSetupContent and constrains ProfileSettings", async () => {
|
||||
renderWithClient(
|
||||
<>
|
||||
<Dialog open>
|
||||
<DialogContent>
|
||||
<GrokBotSetupContent
|
||||
step={0}
|
||||
companyName="Paperclip"
|
||||
details={{ name: "Grok", botName: "Grok", role: "general" }}
|
||||
created={false}
|
||||
managers={[]}
|
||||
pairing={null}
|
||||
webhookUrl=""
|
||||
webhookKey=""
|
||||
onDetails={vi.fn()}
|
||||
onCredentials={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
onExit={vi.fn()}
|
||||
onNext={vi.fn()}
|
||||
onRetry={vi.fn()}
|
||||
/>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<ProfileSettings />
|
||||
</>,
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
expect(container.querySelector('input[type="file"][accept="image/*"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
const stepsList = document.body.querySelector('ol[aria-label="Grok Bot setup"]');
|
||||
expect(stepsList?.className).toContain("grid-cols-2");
|
||||
expect(stepsList?.className).toContain("sm:grid-cols-4");
|
||||
|
||||
const avatarInput = container.querySelector<HTMLInputElement>('input[type="file"][accept="image/*"]');
|
||||
expect(avatarInput?.closest("label")?.className).toContain("inline-block");
|
||||
expect(avatarInput?.closest("label")?.className).toContain("w-fit");
|
||||
});
|
||||
|
||||
it("caps WorkspaceServiceControlBar popover width to the viewport token", async () => {
|
||||
renderWithClient(
|
||||
<WorkspaceServiceControlBar
|
||||
defaultServicesOpen
|
||||
services={[
|
||||
{
|
||||
key: "web",
|
||||
name: "web",
|
||||
state: "running",
|
||||
healthStatus: "healthy",
|
||||
url: "http://localhost:3100",
|
||||
command: "pnpm dev",
|
||||
managedServiceId: "svc-1",
|
||||
errorMessage: null,
|
||||
} as never,
|
||||
{
|
||||
key: "api",
|
||||
name: "api",
|
||||
state: "running",
|
||||
healthStatus: "healthy",
|
||||
url: "http://localhost:3101",
|
||||
command: "pnpm dev:server",
|
||||
managedServiceId: "svc-2",
|
||||
errorMessage: null,
|
||||
} as never,
|
||||
]}
|
||||
onAction={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
await flush();
|
||||
|
||||
const popover = document.body.querySelector('[data-slot="popover-content"]');
|
||||
expect(popover?.className).toContain("max-w-(--sz-calc-4)");
|
||||
});
|
||||
});
|
||||
@@ -585,9 +585,10 @@ function AllowList({ rows, catalogLoading }: { rows: AllowListRow[]; catalogLoad
|
||||
: "No tools resolved for this profile. Add an include selector or refresh the tool catalog."}
|
||||
</div>
|
||||
) : (
|
||||
<Card>
|
||||
<CardContent className="px-0 py-0">
|
||||
<table className="w-full text-sm">
|
||||
<Card className="min-w-0 max-w-full">
|
||||
<CardContent className="min-w-0 px-0 py-0">
|
||||
<div className="max-w-full overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border text-left text-xs text-muted-foreground">
|
||||
<th className="px-3 py-2.5 font-medium">Tool</th>
|
||||
@@ -627,6 +628,7 @@ function AllowList({ rows, catalogLoading }: { rows: AllowListRow[]; catalogLoad
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -328,17 +328,17 @@ export function SmokeLabTab({ companyId }: { companyId: string }) {
|
||||
</section>
|
||||
|
||||
{/* Results matrix */}
|
||||
<section className="flex flex-col gap-3">
|
||||
<section className="flex min-w-0 flex-col gap-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="text-sm font-semibold text-foreground">Integration matrix</h2>
|
||||
<div className="flex items-center gap-3 text-xs text-muted-foreground">
|
||||
<div className="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
|
||||
<span className="inline-flex items-center gap-1"><Check className="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" /> pass</span>
|
||||
<span className="inline-flex items-center gap-1"><X className="h-3.5 w-3.5 text-destructive" /> fail</span>
|
||||
<span className="inline-flex items-center gap-1"><Minus className="h-3.5 w-3.5 text-amber-500" /> skipped</span>
|
||||
<span className="inline-flex items-center gap-1"><span className="h-1.5 w-1.5 rounded-full bg-muted-foreground/30" /> not run</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="overflow-x-auto rounded-lg border border-border">
|
||||
<div className="max-w-full overflow-x-auto rounded-lg border border-border">
|
||||
<table className="w-full border-collapse text-xs">
|
||||
<thead>
|
||||
<tr className="border-b border-border bg-muted/40">
|
||||
|
||||
@@ -472,7 +472,8 @@ function AllowList({ rows, total }: { rows: AllowRow[]; total: number }) {
|
||||
}
|
||||
return (
|
||||
<div className="overflow-hidden rounded-lg border border-border">
|
||||
<table className="w-full text-sm">
|
||||
<div className="max-w-full overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border bg-muted/40 text-left text-xs font-medium text-muted-foreground">
|
||||
<th className="px-3 py-2 font-medium">Tool</th>
|
||||
@@ -516,6 +517,7 @@ function AllowList({ rows, total }: { rows: AllowRow[]; total: number }) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{rows.length > 80 ? (
|
||||
<p className="border-t border-border px-3 py-2 text-xs text-muted-foreground">
|
||||
Showing 80 of {rows.length} allowed tools.
|
||||
|
||||
@@ -210,8 +210,8 @@ export function ProfilesIndex({
|
||||
<EmptyTemplatePicker onPick={(key) => navigate(newProfileHref(key))} />
|
||||
)
|
||||
) : (
|
||||
<div className="overflow-hidden rounded-lg border border-border">
|
||||
<table className="w-full table-fixed text-sm">
|
||||
<div className="max-w-full overflow-x-auto rounded-lg border border-border">
|
||||
<table className="w-full min-w-(--sz-44rem) table-fixed text-sm">
|
||||
<colgroup>
|
||||
<col className="w-(--sz-30pct)" />
|
||||
<col className="w-(--sz-18pct)" />
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { Layout } from "@/components/Layout";
|
||||
import { ToastViewport } from "@/components/ToastViewport";
|
||||
import { Route, Routes } from "@/lib/router";
|
||||
import { CompanyAccess } from "@/pages/CompanyAccess";
|
||||
import { PluginLauncherProvider } from "@/plugins/launchers";
|
||||
import { expect, userEvent, within, waitFor } from "storybook/test";
|
||||
import {
|
||||
prepareFixtureApi,
|
||||
@@ -121,3 +124,43 @@ export const SaveFailed: Story = {
|
||||
await c.findByText("The request failed. Please try again.");
|
||||
},
|
||||
};
|
||||
export const MembersMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: ["/PAP/company/settings/members"],
|
||||
},
|
||||
render: () => (
|
||||
<PluginLauncherProvider>
|
||||
<Routes>
|
||||
<Route path="/:companyPrefix" element={<Layout />}>
|
||||
<Route path="company/settings/members" element={<CompanyAccess />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
<ToastViewport />
|
||||
</PluginLauncherProvider>
|
||||
),
|
||||
play: async () => {
|
||||
const page = within(document.body);
|
||||
await expect(await page.findByRole("heading", { name: "Organization Members" })).toBeVisible();
|
||||
const table = await page.findByRole("table");
|
||||
const scroller = table.parentElement as HTMLElement;
|
||||
await waitFor(() => {
|
||||
const rect = scroller.getBoundingClientRect();
|
||||
expect(rect.width).toBeGreaterThan(0);
|
||||
expect(rect.right).toBeLessThanOrEqual(window.innerWidth + 1);
|
||||
expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth);
|
||||
});
|
||||
if (scroller.scrollWidth > scroller.clientWidth) {
|
||||
scroller.scrollLeft = scroller.scrollWidth;
|
||||
const headers = within(table).getAllByRole("columnheader");
|
||||
const lastHeader = headers[headers.length - 1]!;
|
||||
await waitFor(() => {
|
||||
expect(lastHeader.getBoundingClientRect().right).toBeLessThanOrEqual(
|
||||
scroller.getBoundingClientRect().right + 1,
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -17,24 +17,26 @@ export function PrivacyPage({
|
||||
projects = false,
|
||||
tasks = false,
|
||||
projectSettings = false,
|
||||
projectIssues = false,
|
||||
}: {
|
||||
child?: boolean;
|
||||
guide?: boolean;
|
||||
projects?: boolean;
|
||||
tasks?: boolean;
|
||||
projectSettings?: boolean;
|
||||
projectIssues?: boolean;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const [ready, setReady] = useState(false);
|
||||
useEffect(() => {
|
||||
navigate(
|
||||
projectSettings ? "/PAP/projects/project-private/configuration" : tasks ? "/PAP/issues" : projects ? "/PAP/projects" : guide
|
||||
projectIssues ? "/PAP/projects/project-private/issues" : projectSettings ? "/PAP/projects/project-private/configuration" : tasks ? "/PAP/issues" : projects ? "/PAP/projects" : guide
|
||||
? "/PAP/design-guide"
|
||||
: `/PAP/issues/${child ? "PAP-411" : "PAP-410"}`,
|
||||
{ replace: true },
|
||||
);
|
||||
setReady(true);
|
||||
}, [navigate, child, guide, projects, tasks, projectSettings]);
|
||||
}, [navigate, child, guide, projects, tasks, projectSettings, projectIssues]);
|
||||
if (!ready) return null;
|
||||
return (
|
||||
<PluginLauncherProvider>
|
||||
@@ -226,6 +228,24 @@ export const ProjectVisibilityAutosaveCompletes: Story = {
|
||||
},
|
||||
};
|
||||
export const MobileProjectVisibilityThroughAutosave: Story = { ...ProjectVisibilityThroughAutosave, globals: mobile };
|
||||
export const ProjectDetailMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
docs: {
|
||||
description: {
|
||||
story: "Project detail Tasks tab at 390×844 mobile viewport verifying the wrapping collection toolbar and search input width.",
|
||||
},
|
||||
},
|
||||
},
|
||||
render: () => <PrivacyPage projectIssues />,
|
||||
play: async () => {
|
||||
const page = within(document.body);
|
||||
await expect(await page.findByRole("textbox", { name: "Search tasks" }, { timeout: 15000 })).toBeVisible();
|
||||
await waitFor(() => expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth));
|
||||
},
|
||||
};
|
||||
|
||||
export const OwnerMovesOutOfPrivateParent: Story = {
|
||||
render: () => <PrivacyPage child />,
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, waitFor, within } from "storybook/test";
|
||||
import { Layout } from "@/components/Layout";
|
||||
import { Route, Routes } from "@/lib/router";
|
||||
import { Dashboard } from "@/pages/Dashboard";
|
||||
import { PluginLauncherProvider } from "@/plugins/launchers";
|
||||
|
||||
function RoutedDashboardPage() {
|
||||
return (
|
||||
<PluginLauncherProvider>
|
||||
<Routes>
|
||||
<Route path="/:companyPrefix" element={<Layout />}>
|
||||
<Route path="dashboard" element={<Dashboard />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
</PluginLauncherProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const meta = {
|
||||
id: "activity-dashboard-mobile",
|
||||
title: "Oversight and operation/Dashboards and audit trails/Dashboard (Mobile)",
|
||||
component: RoutedDashboardPage,
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
initialEntries: ["/PAP/dashboard"],
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
"Production Dashboard page inside the app shell at mobile (390×844) and desktop viewports. Verifies single-column chart stacking on narrow screens and uniform-height summary metric cards.",
|
||||
},
|
||||
},
|
||||
paperclip: {
|
||||
capabilities: ["activity/overview"],
|
||||
status: "current",
|
||||
implementation: "production",
|
||||
boundary: "fixtures",
|
||||
notes:
|
||||
"Mounts Layout with the shipped Dashboard route over Storybook API fixtures. Verifies mobile metric card alignment, single-column chart stacking, and zero horizontal overflow; live WebSocket updates and server aggregation are not verified.",
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof RoutedDashboardPage>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const DashboardMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: ["/PAP/dashboard"],
|
||||
},
|
||||
play: async () => {
|
||||
const page = within(document.body);
|
||||
await expect(await page.findByText("Agents Enabled")).toBeVisible();
|
||||
await expect(await page.findByText("Run Activity")).toBeVisible();
|
||||
await waitFor(() => expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth));
|
||||
},
|
||||
};
|
||||
|
||||
export const DashboardDesktop: Story = {
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
initialEntries: ["/PAP/dashboard"],
|
||||
},
|
||||
play: async () => {
|
||||
const page = within(document.body);
|
||||
await expect(await page.findByText("Agents Enabled")).toBeVisible();
|
||||
},
|
||||
};
|
||||
@@ -1,10 +1,13 @@
|
||||
import { useLayoutEffect, useState } from "react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, within } from "storybook/test";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { monthlySubscriptionCents, type SubscriptionCostReport, type CostDataQualityReport } from "@paperclipai/shared";
|
||||
import { Layout } from "@/components/Layout";
|
||||
import { Route, Routes } from "@/lib/router";
|
||||
import { Costs } from "@/pages/Costs";
|
||||
import { ToastViewport } from "@/components/ToastViewport";
|
||||
import { PluginLauncherProvider } from "@/plugins/launchers";
|
||||
|
||||
function fixture(): SubscriptionCostReport {
|
||||
const zero = { inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, costCents: "0", eventCount: 0, estimatedEventCount: 0, unpricedEventCount: 0 };
|
||||
@@ -27,7 +30,7 @@ function fixture(): SubscriptionCostReport {
|
||||
}
|
||||
|
||||
/** Production Costs page; only API responses are fixtures. Edits persist in the story. */
|
||||
function SubscriptionCostsStory({ unknownPrice = false, stale = false, costGaps = false }: { unknownPrice?: boolean; stale?: boolean; costGaps?: boolean }) {
|
||||
function SubscriptionCostsStory({ unknownPrice = false, stale = false, costGaps = false, inShell = false }: { unknownPrice?: boolean; stale?: boolean; costGaps?: boolean; inShell?: boolean }) {
|
||||
const [ready, setReady] = useState(false);
|
||||
const client = useQueryClient();
|
||||
useLayoutEffect(() => {
|
||||
@@ -97,7 +100,20 @@ function SubscriptionCostsStory({ unknownPrice = false, stale = false, costGaps
|
||||
client.removeQueries({ queryKey: ["cost-subscriptions"] }); client.removeQueries({ queryKey: ["costs"] }); setReady(true);
|
||||
return () => { window.fetch = original; client.removeQueries({ queryKey: ["cost-subscriptions"] }); client.removeQueries({ queryKey: ["costs"] }); };
|
||||
}, [client, unknownPrice, stale, costGaps]);
|
||||
return ready ? <><Costs embedded hideBudgetsTab /><ToastViewport /></> : null;
|
||||
if (!ready) return null;
|
||||
if (inShell) {
|
||||
return (
|
||||
<PluginLauncherProvider>
|
||||
<Routes>
|
||||
<Route path="/:companyPrefix" element={<Layout />}>
|
||||
<Route path="activity/costs" element={<Costs embedded hideBudgetsTab />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
<ToastViewport />
|
||||
</PluginLauncherProvider>
|
||||
);
|
||||
}
|
||||
return <><Costs embedded hideBudgetsTab /><ToastViewport /></>;
|
||||
}
|
||||
|
||||
const meta = { id: "costs-subscriptions",
|
||||
@@ -132,6 +148,37 @@ export const AccountDetails: Story = { play: async ({ canvasElement }) => {
|
||||
export const UnknownPrice: Story = { args: { unknownPrice: true } };
|
||||
export const ProviderUnavailable: Story = { args: { stale: true } };
|
||||
export const Mobile: Story = { globals: { viewport: { value: "mobile1", isRotated: false } } };
|
||||
export const CostsMobile: Story = {
|
||||
args: { inShell: true },
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: ["/PAP/activity/costs"],
|
||||
},
|
||||
play: async () => {
|
||||
const page = within(document.body);
|
||||
await expect(await page.findByText("API spend")).toBeVisible();
|
||||
const table = await page.findByRole("table", { name: "Costs by user" });
|
||||
const scroller = table.parentElement as HTMLElement;
|
||||
await waitFor(() => {
|
||||
const rect = scroller.getBoundingClientRect();
|
||||
expect(rect.width).toBeGreaterThan(0);
|
||||
expect(rect.right).toBeLessThanOrEqual(window.innerWidth + 1);
|
||||
expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth);
|
||||
});
|
||||
if (scroller.scrollWidth > scroller.clientWidth) {
|
||||
scroller.scrollLeft = scroller.scrollWidth;
|
||||
const headers = within(table).getAllByRole("columnheader");
|
||||
const lastHeader = headers[headers.length - 1]!;
|
||||
await waitFor(() => {
|
||||
expect(lastHeader.getBoundingClientRect().right).toBeLessThanOrEqual(
|
||||
scroller.getBoundingClientRect().right + 1,
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
export const CostDataQuality: Story = { args: { costGaps: true }, play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await expect(await canvas.findByRole("button", { name: "5 run costs unavailable" })).toHaveAttribute("aria-expanded", "false");
|
||||
|
||||
@@ -70,3 +70,17 @@ export const ConfigureTestDisable: Story = { play: async ({ canvasElement }) =>
|
||||
await userEvent.click(section.getByRole("button", { name: "Remove configuration" }));
|
||||
await waitFor(() => expect(section.queryByText("API key configured")).not.toBeInTheDocument());
|
||||
} };
|
||||
|
||||
export const CompanySettingsMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: ["/PAP/company/settings"],
|
||||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await waitFor(() => expect(canvas.getByRole("heading", { name: "General" })).toBeVisible());
|
||||
await waitFor(() => expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth));
|
||||
},
|
||||
};
|
||||
@@ -30,7 +30,13 @@ const meta = {
|
||||
},
|
||||
beforeEach: ({ parameters }) =>
|
||||
prepareFixtureApi(
|
||||
routedRoutineFixtureRoutes(parameters.routineScenario as RoutineScenarioKey),
|
||||
[
|
||||
...routedRoutineFixtureRoutes(parameters.routineScenario as RoutineScenarioKey),
|
||||
{
|
||||
path: "/api/companies/company-storybook/folders",
|
||||
read: () => ({ folders: [], allCount: 1, unfiledCount: 1 }),
|
||||
},
|
||||
],
|
||||
parameters.fixtureState as FixtureState,
|
||||
).cleanup,
|
||||
} satisfies Meta<typeof RoutedRoutinePage>;
|
||||
@@ -122,3 +128,46 @@ export const Failed: Story = { parameters: { fixtureState: "failure" } };
|
||||
export const Phone: Story = {
|
||||
globals: { viewport: { value: "mobile1", isRotated: false } },
|
||||
};
|
||||
|
||||
export const RoutinesListMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: ["/PAP/routines"],
|
||||
},
|
||||
play: async () => {
|
||||
await expect(await page().findByText("Send the weekly product digest")).toBeVisible();
|
||||
const table = await page().findByRole("table", { name: "Routines" });
|
||||
const scroller = table.parentElement as HTMLElement;
|
||||
await waitFor(() => {
|
||||
const rect = scroller.getBoundingClientRect();
|
||||
expect(rect.width).toBeGreaterThan(0);
|
||||
expect(rect.right).toBeLessThanOrEqual(window.innerWidth + 1);
|
||||
expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth);
|
||||
});
|
||||
if (scroller.scrollWidth > scroller.clientWidth) {
|
||||
scroller.scrollLeft = scroller.scrollWidth;
|
||||
const headers = within(table).getAllByRole("columnheader");
|
||||
const lastHeader = headers[headers.length - 1]!;
|
||||
await waitFor(() => {
|
||||
expect(lastHeader.getBoundingClientRect().right).toBeLessThanOrEqual(
|
||||
scroller.getBoundingClientRect().right + 1,
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const RoutineDetailMobile: Story = {
|
||||
globals: { viewport: { value: "mobile", isRotated: false } },
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
initialEntries: [routinePath()],
|
||||
},
|
||||
play: async () => {
|
||||
await expect(await page().findByRole("heading", { name: "Send the weekly product digest" })).toBeVisible();
|
||||
await waitFor(() => expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(window.innerWidth));
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user