mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 20:09:33 +01:00
## 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>
56 lines
3.1 KiB
TypeScript
56 lines
3.1 KiB
TypeScript
import type { CostByUserReport } from "@paperclipai/shared";
|
|
import { CostAmount } from "./CostAmount";
|
|
import { Identity } from "./Identity";
|
|
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
|
|
import { formatTokens } from "../lib/utils";
|
|
|
|
export function CostByUserTable({ report }: { report: CostByUserReport }) {
|
|
return (
|
|
<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="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">
|
|
<th scope="col" className="py-2 pr-4 text-left font-medium">User</th>
|
|
<th scope="col" className="px-4 py-2 text-right font-medium">Runs</th>
|
|
<th scope="col" className="px-4 py-2 text-right font-medium">Input</th>
|
|
<th scope="col" className="px-4 py-2 text-right font-medium">Output</th>
|
|
<th scope="col" className="py-2 pl-4 text-right font-medium">Cost</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{report.rows.length === 0 && (
|
|
<tr><td colSpan={5} className="py-3 text-muted-foreground">No user-attributed costs yet.</td></tr>
|
|
)}
|
|
{report.rows.map(row => (
|
|
<tr key={row.userId ?? "unattributed"} className="border-b border-border last:border-0">
|
|
<th scope="row" className="py-3 pr-4 text-left font-normal">
|
|
{row.userId ? <Identity name={row.userName ?? "Unknown user"} avatarUrl={row.userImage} /> : "Unattributed"}
|
|
</th>
|
|
<td className="px-4 py-3 text-right tabular-nums">{row.runCount.toLocaleString()}</td>
|
|
<td className="px-4 py-3 text-right tabular-nums">
|
|
{formatTokens(row.inputTokens + row.cachedInputTokens)}
|
|
{row.cachedInputTokens > 0 && <div className="whitespace-nowrap text-xs text-muted-foreground">{formatTokens(row.cachedInputTokens)} cached</div>}
|
|
</td>
|
|
<td className="px-4 py-3 text-right tabular-nums">{formatTokens(row.outputTokens)}</td>
|
|
<td className="py-3 pl-4 text-right tabular-nums">
|
|
<CostAmount costCents={row.costCents} eventCount={row.eventCount} estimatedEventCount={row.estimatedEventCount} unpricedEventCount={row.unpricedEventCount} />
|
|
{row.unpricedEventCount > 0 && <div className="whitespace-nowrap text-xs text-muted-foreground">{row.unpricedEventCount} unpriced {row.unpricedEventCount === 1 ? "charge" : "charges"}</div>}
|
|
</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{report.rows.some(row => row.userId === null) && (
|
|
<p className="mt-3 text-xs text-muted-foreground">Unattributed costs have no recorded user in this organization.</p>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|