mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 06:50:43 +01:00
fix(ui): clear mobile bottom nav on overlays and wrap mobile toolbars (#23045)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The board UI renders a fixed mobile bottom navigation bar (`MobileBottomNav`, height `4rem` plus safe-area inset) and shared collection toolbars on narrow viewports below `48rem`. > - On mobile viewports (375px–390px), multi-control toolbars clip actions off-screen, hidden org-chart controls reserve invisible width in agent list view, and fixed or sticky footers and floating overlays either hide behind `MobileBottomNav`, overlap it, or overflow the right edge. > - Operators on mobile cannot reach save, discard, retry, wizard navigation, or toolbar filter controls when those surfaces collide with the bottom navigation bar or clip off-screen. > - This pull request adds shared mobile bottom-nav clearance tokens and responsive rules in `ui/src/index.css`, lifts fixed/sticky footers and floating overlays above `MobileBottomNav` on `< md` while constraining horizontal fit at 375px+, wraps `.design-toolbar-actions` and collapses hidden org-chart controls below `48rem`, and adds unit tests and mobile Storybook stories. > - The benefit is that every mobile toolbar, save bar, wizard footer, bulk selection bar, toast, retry alert, and voice call panel stays fully visible, reachable, and within the viewport width without changing desktop layouts. ## Linked Issues or Issue Description **What happened?** On viewports narrower than `48rem` (such as 375px–390px mobile screens): - `.design-toolbar-actions` did not wrap on mobile, pushing trailing controls (such as Group by and View dropdowns in Coordinator Inbox) off-screen into `overflow-x-clip`. - `.agents-org-controls-reveal` reserved invisible `width: max-content` space next to `New Agent` in mobile list view. - `AgentAdvancedTab` (`sticky bottom-0 z-10`) and `ProfileWizard` (`fixed inset-x-0 bottom-0 z-10`) footers sat behind `MobileBottomNav` (`z-30`, `h-16`). - `.agent-config-save-bar` (`bottom: 0; z-index: 40`) covered `MobileBottomNav`, and `.agent-selection-bar` (`--selection-bar-bottom: 48px`) overlapped its top 16px. - `ToastViewport` (`bottom-3 left-3 w-full max-w-sm`) overlapped `MobileBottomNav` and overflowed the right edge by 12px at 375px. - `IssueRowDetailsNotice` and `VoiceCallProvider` sat at `bottom-4` on top of `MobileBottomNav` and lacked mobile horizontal containment / viewport-safe max-height. **Expected behavior** - Multi-control toolbars wrap cleanly inside the mobile viewport, and hidden org-chart controls occupy zero space in mobile list view. - Fixed and sticky footers (`AgentConfigSaveBar`, `AgentAdvancedTab`, `ProfileWizard`) and floating overlays (`.agent-selection-bar`, `ToastViewport`, `IssueRowDetailsNotice`, `VoiceCallProvider`) clear `MobileBottomNav` on `< md` viewports and stay within 375px–390px horizontal bounds. - Desktop (`>= 48rem`) layout and positioning remain unchanged. **Steps to reproduce** 1. Open the Paperclip board UI at a `390x844` or `375x812` mobile viewport. 2. Open Coordinator Inbox or Agents list view and inspect `.design-toolbar-actions` and `.agents-org-controls-reveal`. 3. Open Agent settings (Identity/Runtime/Advanced), Tool Profile Wizard, Agent bulk selection, or trigger a toast, row-details retry alert, or active voice call panel while `MobileBottomNav` is visible. **Paperclip version or commit** `85ad16b47e` (`master`) ## What Changed - **`ui/src/index.css`**: - Added `--mobile-nav-overlay-bottom` (`calc(4rem + var(--spacing) * 3 + var(--sz-safe-bottom))`) and `--mobile-nav-overlay-max-h` tokens for floating overlays mounted outside `<main>`. - Added `@media (width < 48rem)` rules to wrap `.design-toolbar-actions` (`flex-wrap: wrap; min-width: 0; max-width: 100%`), expand `[data-canonical-toolbar="inbox"] [data-toolbar-search]` to `width: 100%`, and collapse hidden `.agents-org-controls-reveal:not([data-visible="true"])` (`display: none`). - Lifted `.agent-selection-bar` (`--selection-bar-bottom: calc(4rem + var(--spacing) * 3)`) and `.agent-config-save-bar` (`bottom: var(--tc-composer-bottom)`, `z-index: var(--z-20)`, mobile padding, full slide-out transform when hidden, and matching `.agent-settings-with-save-bar` bottom clearance) below `48rem` while preserving cascade and `prefers-reduced-motion: reduce` ordering. - **`ui/src/pages/AgentAdvancedTab.tsx`**: Updated the sticky save footer to use `mobile-nav-composer`, `bottom-(--tc-composer-bottom)`, `z-20`, `flex-wrap`, and `md:bottom-0`. - **`ui/src/pages/tools/profiles/ProfileWizard.tsx`**: Updated the fixed wizard footer to use `mobile-nav-composer`, `bottom-(--tc-composer-bottom)`, `z-20`, `md:bottom-0`, and `flex-wrap`, and increased mobile container bottom padding (`pb-36 md:pb-24`). - **`ui/src/components/ToastViewport.tsx`**: Lifted toasts with `bottom-(--mobile-nav-overlay-bottom) md:bottom-3` and replaced `left-3 w-full` with `inset-x-3 sm:inset-x-auto sm:left-3 sm:w-full` to eliminate 375px right-edge overflow. - **`ui/src/components/IssueRowDetailsNotice.tsx`**: Lifted above `MobileBottomNav` with `bottom-(--mobile-nav-overlay-bottom) md:bottom-4` and bounded mobile width with `inset-x-4 flex-wrap sm:left-auto sm:right-4 sm:max-w-sm sm:flex-nowrap`. - **`ui/src/components/voice/VoiceCallProvider.tsx`**: Lifted the active voice panel with `bottom-(--mobile-nav-overlay-bottom) max-h-(--mobile-nav-overlay-max-h) md:bottom-4 md:max-h-(--sz-calc-18)`. - **Tests & Storybook**: Added `ui/src/index.mobile-overlays.test.ts`, `ui/src/components/IssueRowDetailsNotice.test.tsx`, `ui/src/components/voice/VoiceCallProvider.test.tsx`, `ui/src/pages/AgentAdvancedTab.test.tsx`, `ui/src/pages/tools/profiles/ProfileWizard.test.tsx`, expanded `ui/src/components/ToastViewport.test.tsx`, and added catalog-compliant mobile stories in `ui/storybook/stories/navigation-preferences/mobile-overlays-clearance.stories.tsx`. ## Verification - `pnpm --filter @paperclipai/ui exec vitest run src/components/ToastViewport.test.tsx src/components/IssueRowDetailsNotice.test.tsx src/components/voice/VoiceCallProvider.test.tsx src/pages/AgentAdvancedTab.test.tsx src/pages/tools/profiles/ProfileWizard.test.tsx src/index.mobile-overlays.test.ts` — 6 test files passed, 14/14 tests passed. - `pnpm --filter @paperclipai/ui exec vitest run src/lib/analytics/replay-masking.test.tsx` — 220/220 tests passed. - `pnpm --filter @paperclipai/ui typecheck` — passed with 0 errors. - `pnpm check:token-gates` — all 4 token gates clean and `cliplab character in sync`. - `node scripts/storybook-catalog.mjs --check` — passed (373 files, 3491 stories). - `node --test scripts/check-maps.test.mjs scripts/storybook-catalog.test.mjs scripts/storybook-feature-index.test.mjs` — 30/30 tests passed. - Full-repo Vitest and browser E2E suites were not run locally; CI will run the required repository checks on this PR. ## Risks - Low risk. All positioning changes are scoped to `< md` / `< 48rem` viewports using existing CSS custom property conventions (`--tc-composer-bottom`, `--tc-composer-visible-nav-offset`, `--sz-safe-bottom`), leaving desktop (`>= 48rem`) layouts unchanged. - Floating overlays outside `<main>` (`ToastViewport`, `IssueRowDetailsNotice`, `VoiceCallProvider`, `.agent-selection-bar`) use the fixed `--mobile-nav-overlay-bottom` offset so they always clear `MobileBottomNav` even when rendered in `document.body` portals; when `MobileBottomNav` auto-hides on scroll, those overlays remain at the safe clearance height rather than tracking `<main>`'s scroll state. ## Model Used - Provider and model: Google Antigravity — Gemini 4 Neon (High) - Capabilities: tool use, code editing, local terminal/test execution ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
1 parent
3fd66c0e12
commit
ffd8dcb4af
13 files changed
+682
-13
No files matched your search
@@ -0,0 +1,52 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { IssueRowDetailsNotice } from "./IssueRowDetailsNotice";
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
|
||||
describe("IssueRowDetailsNotice", () => {
|
||||
it("returns null when there is no error", () => {
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() => root.render(<IssueRowDetailsNotice error={null} onRetry={vi.fn()} />));
|
||||
expect(document.body.querySelector('[role="alert"]')).toBeNull();
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
}
|
||||
});
|
||||
|
||||
it("clears MobileBottomNav on mobile, constrains horizontal fit, and triggers retry", () => {
|
||||
const onRetry = vi.fn();
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() =>
|
||||
root.render(
|
||||
<IssueRowDetailsNotice
|
||||
error={new Error("network failed")}
|
||||
onRetry={onRetry}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
const alert = document.body.querySelector('[role="alert"]') as HTMLElement | null;
|
||||
expect(alert).not.toBeNull();
|
||||
const classes = alert!.className.split(/\s+/);
|
||||
expect(classes).toContain("inset-x-4");
|
||||
expect(classes).toContain("bottom-(--mobile-nav-overlay-bottom)");
|
||||
expect(classes).toContain("md:bottom-4");
|
||||
expect(classes).toContain("sm:left-auto");
|
||||
expect(classes).toContain("sm:right-4");
|
||||
expect(classes).toContain("flex-wrap");
|
||||
|
||||
const retryButton = alert!.querySelector("button");
|
||||
expect(retryButton?.textContent).toBe("Retry details");
|
||||
act(() => retryButton?.click());
|
||||
expect(onRetry).toHaveBeenCalledTimes(1);
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -10,9 +10,12 @@ export function IssueRowDetailsNotice({ error, onRetry, message = "Some task det
|
||||
}) {
|
||||
if (!error) return null;
|
||||
return createPortal(
|
||||
<div role="alert" className="fixed bottom-4 right-4 z-50 flex max-w-sm items-center gap-3 rounded-lg border bg-card p-3 text-sm shadow-lg">
|
||||
<p>{message}</p>
|
||||
<Button variant="outline" size="sm" onClick={onRetry}>{retryLabel}</Button>
|
||||
<div
|
||||
role="alert"
|
||||
className="fixed inset-x-4 bottom-(--mobile-nav-overlay-bottom) z-50 flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card p-3 text-sm shadow-lg sm:left-auto sm:right-4 sm:max-w-sm sm:flex-nowrap md:bottom-4"
|
||||
>
|
||||
<p className="min-w-0 flex-1">{message}</p>
|
||||
<Button variant="outline" size="sm" className="shrink-0" onClick={onRetry}>{retryLabel}</Button>
|
||||
</div>, document.body,
|
||||
);
|
||||
}
|
||||
@@ -37,3 +37,23 @@ describe("toast session replay", () => {
|
||||
} finally { act(() => root.unmount()); }
|
||||
});
|
||||
});
|
||||
|
||||
describe("mobile bottom nav clearance and viewport fit", () => {
|
||||
it("lifts toasts above MobileBottomNav on mobile and constrains width inside narrow viewports", () => {
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() => root.render(<ToastProvider><Notify toast={{ title: "Saved", body: "Ready" }} /></ToastProvider>));
|
||||
const aside = container.querySelector("aside");
|
||||
expect(aside).not.toBeNull();
|
||||
const classes = aside!.className.split(/\s+/);
|
||||
expect(classes).toContain("inset-x-3");
|
||||
expect(classes).toContain("sm:inset-x-auto");
|
||||
expect(classes).toContain("sm:left-3");
|
||||
expect(classes).toContain("sm:w-full");
|
||||
expect(classes).toContain("bottom-(--mobile-nav-overlay-bottom)");
|
||||
expect(classes).toContain("md:bottom-3");
|
||||
expect(classes).not.toContain("w-full");
|
||||
} finally { act(() => root.unmount()); }
|
||||
});
|
||||
});
|
||||
@@ -114,7 +114,7 @@ export function ToastViewport() {
|
||||
<aside
|
||||
aria-live="polite"
|
||||
aria-atomic="false"
|
||||
className="pointer-events-none fixed bottom-3 left-3 z-(--z-120) w-full max-w-sm px-1"
|
||||
className="pointer-events-none fixed inset-x-3 bottom-(--mobile-nav-overlay-bottom) z-(--z-120) max-w-sm px-1 sm:inset-x-auto sm:left-3 sm:w-full md:bottom-3"
|
||||
>
|
||||
<ol className="flex w-full flex-col-reverse gap-2">
|
||||
{toasts.map((toast) => (
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act, useContext } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { VoiceCallContext } from "./VoiceCallContext";
|
||||
import { VoiceCallProvider } from "./VoiceCallProvider";
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
|
||||
vi.mock("./NativeVoiceConversation", () => ({
|
||||
NativeVoiceConversation: ({ onEndedChange }: { onEndedChange?: (ended: boolean) => void }) => (
|
||||
<div data-testid="mock-voice-conversation">
|
||||
<button type="button" onClick={() => onEndedChange?.(true)}>End call</button>
|
||||
</div>
|
||||
),
|
||||
}));
|
||||
|
||||
function TriggerCall() {
|
||||
const host = useContext(VoiceCallContext);
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
host?.open({
|
||||
companyId: "company-1",
|
||||
endpointId: "endpoint-1",
|
||||
agentName: "Chief",
|
||||
client: {} as never,
|
||||
})
|
||||
}
|
||||
>
|
||||
Open voice
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
describe("VoiceCallProvider", () => {
|
||||
it("lifts the active voice call panel above MobileBottomNav with mobile max-height and horizontal fit", () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() =>
|
||||
root.render(
|
||||
<VoiceCallProvider companyId="company-1" userId="user-1">
|
||||
<TriggerCall />
|
||||
</VoiceCallProvider>,
|
||||
),
|
||||
);
|
||||
const openButton = container.querySelector("button")!;
|
||||
act(() => openButton.click());
|
||||
|
||||
const panel = container.querySelector('aside[aria-label="Current voice call"]');
|
||||
expect(panel).not.toBeNull();
|
||||
const classes = panel!.className.split(/\s+/);
|
||||
expect(classes).toContain("inset-x-4");
|
||||
expect(classes).toContain("bottom-(--mobile-nav-overlay-bottom)");
|
||||
expect(classes).toContain("max-h-(--mobile-nav-overlay-max-h)");
|
||||
expect(classes).toContain("md:bottom-4");
|
||||
expect(classes).toContain("md:max-h-(--sz-calc-18)");
|
||||
expect(classes).toContain("sm:left-auto");
|
||||
expect(classes).toContain("sm:w-96");
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
container.remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -21,7 +21,7 @@ export function VoiceCallProvider({ children, companyId, userId }: {
|
||||
const value = useMemo(() => ({ active: Boolean(current), open }), [current, open]);
|
||||
return <VoiceCallContext.Provider value={value}>
|
||||
{children}
|
||||
{current && <aside aria-label="Current voice call" className="fixed inset-x-4 bottom-4 z-50 max-h-(--sz-calc-18) overflow-y-auto rounded-lg border border-border bg-background p-4 shadow-lg sm:left-auto sm:w-96">
|
||||
{current && <aside aria-label="Current voice call" className="fixed inset-x-4 bottom-(--mobile-nav-overlay-bottom) z-50 max-h-(--mobile-nav-overlay-max-h) overflow-y-auto rounded-lg border border-border bg-background p-4 shadow-lg sm:left-auto sm:w-96 md:bottom-4 md:max-h-(--sz-calc-18)">
|
||||
<NativeVoiceConversation {...current.props} key={current.id} managed autoStart onEndedChange={setEnded} />
|
||||
{ended && <Button variant="ghost" size="sm" onClick={() => { setCall(null); requestAnimationFrame(() => { if (returnFocus.current?.isConnected) returnFocus.current.focus(); }); }}>Close voice panel</Button>}
|
||||
</aside>}
|
||||
|
||||
+31
-3
@@ -612,9 +612,12 @@
|
||||
--tc-composer-bottom: var(--sz-calc-8);
|
||||
--mobile-chat-viewport-height: 100dvh;
|
||||
--tc-composer-editor-max-height: min(var(--sz-28dvh), calc(var(--mobile-chat-viewport-height) * 0.4));
|
||||
--tc-composer-visible-nav-offset: calc(4rem + var(--spacing) * 1.5 + var(--sz-safe-bottom));
|
||||
--mobile-nav-height: 4rem;
|
||||
--tc-composer-visible-nav-offset: calc(var(--mobile-nav-height) + var(--spacing) * 1.5 + var(--sz-safe-bottom));
|
||||
/* With the dock's pb-1, leave 12px below the card when the nav hides. */
|
||||
--tc-composer-hidden-nav-offset: calc(var(--sz-safe-bottom) + var(--spacing) * 2);
|
||||
--mobile-nav-overlay-bottom: calc(var(--mobile-nav-height) + var(--spacing) * 3 + var(--sz-safe-bottom));
|
||||
--mobile-nav-overlay-max-h: calc(100dvh - var(--mobile-nav-overlay-bottom) - var(--spacing) * 4);
|
||||
|
||||
/* Dashboard Board (experimental Responsibilities). Every card is this one
|
||||
height whatever it says, sized to a full card: padding 1.5rem, title
|
||||
@@ -4922,6 +4925,9 @@ html:has(.design-proposal-theme) .design-navigation-group-label {
|
||||
.design-view-toggle .design-toolbar-button:last-child { border-start-end-radius: var(--design-page-control-radius); border-end-end-radius: var(--design-page-control-radius); }
|
||||
.design-view-toggle .design-toolbar-button:focus-visible { position: relative; z-index: var(--z-1); }
|
||||
.design-toolbar-actions { display: flex; align-items: center; gap: var(--design-page-action-gap); margin-inline-start: auto; }
|
||||
@media (width < 48rem) {
|
||||
.design-toolbar-actions { flex-wrap: wrap; min-width: 0; max-width: 100%; }
|
||||
}
|
||||
.design-page-toolbar .design-new-task { margin-inline-start: var(--design-page-toolbar-gap); background: var(--foreground); color: var(--background); font-weight: var(--font-weight-semibold); }
|
||||
.design-page-toolbar .design-new-task:hover { background: color-mix(in oklab, var(--foreground) 90%, var(--task-list-surface)); color: var(--background); }
|
||||
.design-task-results { margin-block-end: calc(-1 * var(--design-page-toolbar-gap)); font-size: var(--design-page-type-size); line-height: var(--design-page-type-leading); color: var(--muted-foreground); }
|
||||
@@ -5295,6 +5301,9 @@ html:not(.dark) .coordinator-sidebar {
|
||||
/* The Needs You toolbar fits one row: the search takes what the filters leave. */
|
||||
[data-canonical-toolbar="inbox"] { justify-content: space-between; }
|
||||
[data-canonical-toolbar="inbox"] .design-toolbar-actions { margin-inline-start: 0; }
|
||||
@media (width < 48rem) {
|
||||
[data-canonical-toolbar="inbox"] [data-toolbar-search] { width: 100%; }
|
||||
}
|
||||
.coordinator-needs-you:not([data-coordinator-decision-history]) > :not([role="toolbar"], [data-inbox-folders]) { max-width: var(--container-4xl); margin-inline: auto; }
|
||||
[data-coordinator-decision-history] > :not([data-decision-history]),
|
||||
[data-coordinator-decision-history] > [data-decision-history] > :not([role="toolbar"], [data-inbox-folders]) { max-width: var(--container-4xl); }
|
||||
@@ -5556,6 +5565,11 @@ html:not(.dark) .coordinator-sidebar {
|
||||
transform: translate(-50%, 0);
|
||||
transition: opacity var(--selection-bar-enter) var(--selection-bar-ease-out), transform var(--selection-bar-enter) var(--selection-bar-ease-out), visibility 0s;
|
||||
}
|
||||
@media (width < 48rem) {
|
||||
.agent-selection-bar {
|
||||
--selection-bar-bottom: calc(var(--mobile-nav-height) + var(--spacing) * 3);
|
||||
}
|
||||
}
|
||||
.agent-identity-chip { background: var(--agent-identity-chip-bg); color: var(--foreground); }
|
||||
/* Raised modules use the Skills chip surface to keep agent chips distinct from their tile. */
|
||||
[data-agent-tile] .agent-identity-chip { --agent-identity-chip-bg: var(--agent-detail-tile-chip); }
|
||||
@@ -5620,12 +5634,25 @@ span.paperclip-patch-line { display: block; }
|
||||
}
|
||||
.agent-config-save-bar[data-visible="true"] { transform: translateY(0); visibility: visible; transition-timing-function: var(--motion-ease-out-expo); }
|
||||
.agent-file-copy-notice { transition: opacity var(--motion-duration-fast); }
|
||||
.agent-settings-with-save-bar { padding-bottom: calc(var(--agent-save-bar-clearance) + var(--spacing) * 4); }
|
||||
@media (width < 48rem) {
|
||||
.agent-config-save-bar {
|
||||
bottom: var(--tc-composer-bottom);
|
||||
z-index: var(--z-20);
|
||||
padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
|
||||
transition: transform var(--agent-save-bar-motion) var(--motion-ease-standard), visibility var(--agent-save-bar-motion), bottom var(--mobile-nav-motion-duration, var(--motion-mobile-nav-enter)) var(--mobile-nav-motion-ease, var(--motion-ease-out-expo));
|
||||
}
|
||||
.agent-config-save-bar:not([data-visible="true"]) {
|
||||
transform: translateY(calc(100% + var(--tc-composer-bottom)));
|
||||
}
|
||||
.agent-settings-with-save-bar {
|
||||
padding-bottom: calc(var(--agent-save-bar-clearance) + var(--tc-composer-visible-nav-offset));
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.agent-config-save-bar, .agent-file-copy-notice { transition: none; }
|
||||
}
|
||||
|
||||
.agent-settings-with-save-bar { padding-bottom: calc(var(--agent-save-bar-clearance) + var(--spacing) * 4); }
|
||||
|
||||
/* Identity file chrome uses the same input surface and keeps filenames on one line. */
|
||||
:root {
|
||||
--agent-identity-preview-title-size: 18px;
|
||||
@@ -5876,6 +5903,7 @@ html:has(.design-proposal-theme) .agent-markdown-name-field [data-slot="input"],
|
||||
.org-task-mask-card { fill: var(--org-mask-card); }
|
||||
@media (width < 48rem) {
|
||||
.agents-org-toolbar { padding: calc(var(--spacing) * 4); }
|
||||
.agents-org-controls-reveal:not([data-visible="true"]) { display: none; }
|
||||
.paperclip-app-shell:has(.agents-org-surface) { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
|
||||
.paperclip-app-shell:has(.agents-org-surface) :is(.app-main-row, .app-content-row) { display: flex; flex: 1; min-height: 0; overflow: hidden; }
|
||||
.paperclip-app-shell:has(.agents-org-surface) .app-content-column { flex: 1; min-height: 0; }
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const css = readFileSync(resolve(import.meta.dirname, "index.css"), "utf8");
|
||||
|
||||
function readCustomProperty(source: string, name: string): string | null {
|
||||
const match = source.match(new RegExp(`${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*([^;]+);`));
|
||||
return match ? match[1].trim() : null;
|
||||
}
|
||||
|
||||
function readMediaBlocks(source: string, condition: string): Array<{ start: number; body: string }> {
|
||||
const blocks: Array<{ start: number; body: string }> = [];
|
||||
const pattern = new RegExp(`@media\\s*\\(\\s*${condition}\\s*\\)\\s*\\{`, "g");
|
||||
for (const match of source.matchAll(pattern)) {
|
||||
const openIndex = match.index + match[0].length;
|
||||
let depth = 1;
|
||||
let cursor = openIndex;
|
||||
while (cursor < source.length && depth > 0) {
|
||||
if (source[cursor] === "{") depth += 1;
|
||||
else if (source[cursor] === "}") depth -= 1;
|
||||
cursor += 1;
|
||||
}
|
||||
blocks.push({ start: match.index, body: source.slice(openIndex, cursor - 1) });
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
describe("index.css mobile toolbar wrapping and bottom-nav clearance", () => {
|
||||
it("composes mobile nav offsets from a single --mobile-nav-height token", () => {
|
||||
expect(readCustomProperty(css, "--mobile-nav-height")).toBe("4rem");
|
||||
expect(readCustomProperty(css, "--tc-composer-visible-nav-offset")).toBe(
|
||||
"calc(var(--mobile-nav-height) + var(--spacing) * 1.5 + var(--sz-safe-bottom))",
|
||||
);
|
||||
expect(readCustomProperty(css, "--mobile-nav-overlay-bottom")).toBe(
|
||||
"calc(var(--mobile-nav-height) + var(--spacing) * 3 + var(--sz-safe-bottom))",
|
||||
);
|
||||
expect(readCustomProperty(css, "--mobile-nav-overlay-max-h")).toBe(
|
||||
"calc(100dvh - var(--mobile-nav-overlay-bottom) - var(--spacing) * 4)",
|
||||
);
|
||||
});
|
||||
|
||||
it("wraps .design-toolbar-actions and expands inbox search below 48rem", () => {
|
||||
const mobileBlocks = readMediaBlocks(css, "width\\s*<\\s*48rem");
|
||||
const combined = mobileBlocks.map((block) => block.body).join("\n");
|
||||
expect(combined).toMatch(/\.design-toolbar-actions\s*\{[^}]*flex-wrap:\s*wrap;[^}]*min-width:\s*0;[^}]*max-width:\s*100%;/s);
|
||||
expect(combined).toMatch(/\[data-canonical-toolbar="inbox"\]\s*\[data-toolbar-search\]\s*\{[^}]*width:\s*100%;/s);
|
||||
});
|
||||
|
||||
it("collapses hidden .agents-org-controls-reveal on mobile list view", () => {
|
||||
const mobileBlocks = readMediaBlocks(css, "width\\s*<\\s*48rem");
|
||||
const combined = mobileBlocks.map((block) => block.body).join("\n");
|
||||
expect(combined).toMatch(/\.agents-org-controls-reveal:not\(\[data-visible="true"\]\)\s*\{[^}]*display:\s*none;/s);
|
||||
});
|
||||
|
||||
it("lifts .agent-selection-bar cleanly above MobileBottomNav below 48rem", () => {
|
||||
const mobileBlocks = readMediaBlocks(css, "width\\s*<\\s*48rem");
|
||||
const combined = mobileBlocks.map((block) => block.body).join("\n");
|
||||
expect(combined).toMatch(
|
||||
/\.agent-selection-bar\s*\{[^}]*--selection-bar-bottom:\s*calc\(var\(--mobile-nav-height\) \+ var\(--spacing\) \* 3\);/s,
|
||||
);
|
||||
});
|
||||
|
||||
it("lifts .agent-config-save-bar above MobileBottomNav below 48rem while preserving cascade and reduced-motion order", () => {
|
||||
const baseSettingsMatch = css.match(/\.agent-settings-with-save-bar\s*\{[^}]*padding-bottom:\s*calc\(var\(--agent-save-bar-clearance\) \+ var\(--spacing\) \* 4\);[^}]*\}/);
|
||||
const mobileSaveBlock = readMediaBlocks(css, "width\\s*<\\s*48rem").find((block) =>
|
||||
block.body.includes(".agent-config-save-bar"),
|
||||
);
|
||||
const reducedMotionBlock = readMediaBlocks(css, "prefers-reduced-motion:\\s*reduce").find((block) =>
|
||||
block.body.includes(".agent-config-save-bar"),
|
||||
);
|
||||
|
||||
expect(baseSettingsMatch).not.toBeNull();
|
||||
expect(mobileSaveBlock).toBeDefined();
|
||||
expect(reducedMotionBlock).toBeDefined();
|
||||
expect(mobileSaveBlock!.start).toBeGreaterThan(baseSettingsMatch!.index!);
|
||||
expect(reducedMotionBlock!.start).toBeGreaterThan(mobileSaveBlock!.start);
|
||||
expect(mobileSaveBlock!.body).toMatch(/\.agent-config-save-bar\s*\{[^}]*bottom:\s*var\(--tc-composer-bottom\);[^}]*z-index:\s*var\(--z-20\);/s);
|
||||
expect(mobileSaveBlock!.body).toMatch(/\.agent-config-save-bar:not\(\[data-visible="true"\]\)\s*\{[^}]*transform:\s*translateY\(calc\(100% \+ var\(--tc-composer-bottom\)\)\);/s);
|
||||
expect(mobileSaveBlock!.body).toMatch(/\.agent-settings-with-save-bar\s*\{[^}]*padding-bottom:\s*calc\(var\(--agent-save-bar-clearance\) \+ var\(--tc-composer-visible-nav-offset\)\);/s);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { Agent } from "@paperclipai/shared";
|
||||
import { ToastProvider } from "../context/ToastContext";
|
||||
import { AgentAdvancedTab } from "./AgentAdvancedTab";
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
|
||||
vi.mock("@codemirror/view", () => {
|
||||
class MockEditorView {
|
||||
state = { doc: { toString: () => "name: Agent\n", length: 12 } };
|
||||
static contentAttributes = { of: () => [] };
|
||||
static editable = { of: () => [] };
|
||||
static updateListener = { of: () => [] };
|
||||
dispatch() {}
|
||||
destroy() {}
|
||||
}
|
||||
return { EditorView: MockEditorView };
|
||||
});
|
||||
|
||||
vi.mock("../lib/agent-configuration/load", () => ({
|
||||
loadAgentConfiguration: vi.fn(async () => ({
|
||||
agent: { id: "agent-1", companyId: "company-1", urlKey: "agent-1", name: "Agent" },
|
||||
document: { apiVersion: "paperclip/v1", kind: "Agent", metadata: { name: "Agent" } },
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock("../lib/agent-configuration/compact", () => ({
|
||||
compactAgentConfiguration: (doc: unknown) => doc,
|
||||
}));
|
||||
|
||||
vi.mock("../lib/agent-configuration-yaml", () => ({
|
||||
serializeAgentConfigurationDocument: () => "name: Agent\n",
|
||||
parseAgentConfigurationYaml: () => ({ metadata: { name: "Agent" } }),
|
||||
}));
|
||||
|
||||
vi.mock("../lib/agent-configuration/save", () => ({
|
||||
ConfigurationSaveInterrupted: class extends Error {},
|
||||
planAgentConfiguration: () => [],
|
||||
saveAgentConfiguration: vi.fn(),
|
||||
}));
|
||||
|
||||
describe("AgentAdvancedTab", () => {
|
||||
it("positions the sticky save footer above MobileBottomNav on mobile", async () => {
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false, staleTime: Infinity } },
|
||||
});
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
const agent = { id: "agent-1", companyId: "company-1", urlKey: "agent-1", name: "Agent" } as Agent;
|
||||
queryClient.setQueryData(["agent-configuration-yaml", agent.companyId, agent.id], {
|
||||
agent,
|
||||
document: { apiVersion: "paperclip/v1", kind: "Agent", metadata: { name: "Agent" } },
|
||||
});
|
||||
try {
|
||||
await act(async () => {
|
||||
root.render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ToastProvider>
|
||||
<AgentAdvancedTab
|
||||
agent={agent}
|
||||
onDirtyChange={vi.fn()}
|
||||
onSaved={vi.fn()}
|
||||
/>
|
||||
</ToastProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
});
|
||||
|
||||
const footer = container.querySelector("footer");
|
||||
expect(footer).not.toBeNull();
|
||||
const classes = footer!.className.split(/\s+/);
|
||||
expect(classes).toContain("sticky");
|
||||
expect(classes).toContain("mobile-nav-composer");
|
||||
expect(classes).toContain("bottom-(--tc-composer-bottom)");
|
||||
expect(classes).toContain("md:bottom-0");
|
||||
expect(classes).toContain("z-20");
|
||||
expect(classes).toContain("flex-wrap");
|
||||
expect(footer!.textContent).toContain("Reload saved");
|
||||
expect(footer!.textContent).toContain("Save changes");
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
queryClient.clear();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -142,9 +142,9 @@ function ConfigurationEditor({ agent, initial, onDirtyChange, onSaved, onSavingC
|
||||
<p className="mt-2 text-muted-foreground">Changes save in this order. If one fails, earlier changes remain saved.</p>
|
||||
</details>}
|
||||
{(validation.error || error) && <p role="alert" className="whitespace-pre-wrap text-sm text-destructive">{validation.error || error}</p>}
|
||||
<footer className="sticky bottom-0 z-10 flex items-center justify-between gap-3 border-t border-border bg-background py-4">
|
||||
<footer className="mobile-nav-composer sticky bottom-(--tc-composer-bottom) z-20 flex flex-wrap items-center justify-between gap-3 border-t border-border bg-background py-4 md:bottom-0">
|
||||
<Button variant="ghost" disabled={busy} onClick={() => { if (!operationPending.current) { operationPending.current = true; reload.mutate(); } }}>Reload saved</Button>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<span role="status" className="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
{!save.isPending && !reload.isPending && dirty ? <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-(--agent-detail-dot-unsaved)" /> : null}
|
||||
{save.isPending ? `Saving: ${progress || "configuration"}…` : reload.isPending ? "Loading configuration…" : dirty ? validation.document && !validation.changes.length ? "No configuration changes" : "Unsaved changes" : "No unsaved changes"}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { ToastProvider } from "@/context/ToastContext";
|
||||
import { ProfileWizard } from "./ProfileWizard";
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
|
||||
vi.mock("@/lib/router", () => ({
|
||||
useNavigate: () => vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./useProfilesData", () => ({
|
||||
useProfilesData: () => ({
|
||||
profiles: { data: { profiles: [] }, isLoading: false },
|
||||
applications: { data: { applications: [] } },
|
||||
connections: { data: { connections: [] }, isLoading: false },
|
||||
agents: { data: [] },
|
||||
projects: { data: [] },
|
||||
routines: { data: [] },
|
||||
catalog: [],
|
||||
catalogLoading: false,
|
||||
appGroups: [],
|
||||
maps: {
|
||||
applicationsById: new Map(),
|
||||
connectionsById: new Map(),
|
||||
agentsById: new Map(),
|
||||
projectsById: new Map(),
|
||||
routinesById: new Map(),
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("ProfileWizard", () => {
|
||||
it("positions the fixed footer above MobileBottomNav on mobile and reserves extra bottom scroll padding", () => {
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
});
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() => {
|
||||
root.render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ToastProvider>
|
||||
<MemoryRouter>
|
||||
<ProfileWizard companyId="company-1" />
|
||||
</MemoryRouter>
|
||||
</ToastProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
});
|
||||
|
||||
const wrapper = container.firstElementChild as HTMLElement | null;
|
||||
expect(wrapper).not.toBeNull();
|
||||
expect(wrapper!.className.split(/\s+/)).toEqual(
|
||||
expect.arrayContaining(["pb-36", "md:pb-24"]),
|
||||
);
|
||||
|
||||
const footer = container.querySelector(".fixed.inset-x-0") as HTMLElement | null;
|
||||
expect(footer).not.toBeNull();
|
||||
const footerClasses = footer!.className.split(/\s+/);
|
||||
expect(footerClasses).toContain("mobile-nav-composer");
|
||||
expect(footerClasses).toContain("bottom-(--tc-composer-bottom)");
|
||||
expect(footerClasses).toContain("md:bottom-0");
|
||||
expect(footerClasses).toContain("z-20");
|
||||
|
||||
const innerRow = footer!.firstElementChild as HTMLElement | null;
|
||||
expect(innerRow?.className.split(/\s+/)).toContain("flex-wrap");
|
||||
expect(footer!.textContent).toContain("Cancel");
|
||||
expect(footer!.textContent).toContain("Continue");
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
queryClient.clear();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -227,7 +227,7 @@ export function ProfileWizard({
|
||||
if (profileId && profiles.isLoading) return <LoadingState label="Loading draft…" />;
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-3xl flex-col gap-6 pb-24">
|
||||
<div className="mx-auto flex w-full max-w-3xl flex-col gap-6 pb-36 md:pb-24">
|
||||
<Stepper current={step} />
|
||||
|
||||
<div className="min-h-(--sz-320px)">
|
||||
@@ -282,8 +282,8 @@ export function ProfileWizard({
|
||||
</div>
|
||||
|
||||
{/* Sticky footer: live count + navigation. */}
|
||||
<div className="fixed inset-x-0 bottom-0 z-10 border-t border-border bg-background/95 backdrop-blur">
|
||||
<div className="mx-auto flex w-full max-w-3xl items-center justify-between gap-3 px-4 py-3">
|
||||
<div className="mobile-nav-composer fixed inset-x-0 bottom-(--tc-composer-bottom) z-20 border-t border-border bg-background/95 backdrop-blur md:bottom-0">
|
||||
<div className="mx-auto flex w-full max-w-3xl flex-wrap items-center justify-between gap-3 px-4 py-3">
|
||||
<div className="flex items-center gap-3 text-sm text-muted-foreground">
|
||||
{step >= 2 ? (
|
||||
<span>
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
import { useEffect, useState, type CSSProperties, type ReactNode } from "react";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { ChevronDown, Pencil, X } from "lucide-react";
|
||||
import { AgentsToolbar } from "@/components/AgentsToolbar";
|
||||
import { IssueRowDetailsNotice } from "@/components/IssueRowDetailsNotice";
|
||||
import { MobileBottomNav } from "@/components/MobileBottomNav";
|
||||
import { ToastViewport } from "@/components/ToastViewport";
|
||||
import { ToolbarSearch } from "@/components/ToolbarSearch";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useToastActions } from "@/context/ToastContext";
|
||||
import { companyProjectsQuery } from "@/lib/company-projects-query";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { AgentConfigSaveBar } from "@/pages/agent-detail/AgentConfigSaveBar";
|
||||
import { ProfileWizard } from "@/pages/tools/profiles/ProfileWizard";
|
||||
import { PluginLauncherProvider } from "@/plugins/launchers";
|
||||
import { storybookAgents, storybookProjects } from "../../fixtures/paperclipData";
|
||||
|
||||
const MOBILE_MAIN_STYLE = {
|
||||
"--tc-composer-bottom": "var(--tc-composer-visible-nav-offset)",
|
||||
} as CSSProperties;
|
||||
|
||||
function MobileShell({ children, padded = true }: { children: ReactNode; padded?: boolean }) {
|
||||
return (
|
||||
<div className="min-h-dvh w-full overflow-x-clip bg-background text-foreground">
|
||||
<main
|
||||
id="main-content"
|
||||
style={MOBILE_MAIN_STYLE}
|
||||
className={padded ? "p-4 pb-(--sz-calc-14)" : "pb-(--sz-calc-14)"}
|
||||
>
|
||||
{children}
|
||||
</main>
|
||||
<MobileBottomNav visible />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CoordinatorToolbarStory() {
|
||||
const [inboxQuery, setInboxQuery] = useState("");
|
||||
const [agentsQuery, setAgentsQuery] = useState("");
|
||||
const [agentView, setAgentView] = useState<"list" | "org">("list");
|
||||
|
||||
return (
|
||||
<MobileShell>
|
||||
<div className="space-y-8">
|
||||
<section className="coordinator-needs-you w-full space-y-3" aria-label="Inbox toolbar">
|
||||
<h1 className="text-lg font-semibold">Coordinator inbox</h1>
|
||||
<div data-canonical-toolbar="inbox" className="design-page-toolbar" role="toolbar" aria-label="Decisions controls">
|
||||
<ToolbarSearch
|
||||
query={inboxQuery}
|
||||
onQueryChange={setInboxQuery}
|
||||
label="Search decisions"
|
||||
placeholder="Search…"
|
||||
/>
|
||||
<div className="design-toolbar-actions">
|
||||
<Button variant="ghost" size="sm">By agents<ChevronDown className="size-4" /></Button>
|
||||
<Button variant="ghost" size="sm">By projects<ChevronDown className="size-4" /></Button>
|
||||
<Button variant="ghost" size="sm">All assignees<ChevronDown className="size-4" /></Button>
|
||||
<Button variant="ghost" size="sm">By type<ChevronDown className="size-4" /></Button>
|
||||
<Button variant="ghost" size="sm" data-attention-view-menu>View<ChevronDown className="size-4" /></Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="space-y-3" aria-label="Agents toolbar">
|
||||
<h2 className="text-lg font-semibold">Agents (list view)</h2>
|
||||
<AgentsToolbar
|
||||
query={agentsQuery}
|
||||
onQueryChange={setAgentsQuery}
|
||||
view={agentView}
|
||||
onViewChange={setAgentView}
|
||||
onNewAgent={() => undefined}
|
||||
orgActions={{
|
||||
zoomIn: () => undefined,
|
||||
zoomOut: () => undefined,
|
||||
fit: () => undefined,
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</MobileShell>
|
||||
);
|
||||
}
|
||||
|
||||
function SeededToastsAndNoticeStory() {
|
||||
const { pushToast } = useToastActions();
|
||||
|
||||
useEffect(() => {
|
||||
pushToast({
|
||||
title: "Agent configuration saved",
|
||||
body: "Changes are live for the next run.",
|
||||
tone: "success",
|
||||
ttlMs: 0,
|
||||
});
|
||||
pushToast({
|
||||
title: "Sync warning",
|
||||
body: "Secondary workspace metadata will refresh shortly.",
|
||||
tone: "warn",
|
||||
ttlMs: 0,
|
||||
});
|
||||
}, [pushToast]);
|
||||
|
||||
return (
|
||||
<MobileShell>
|
||||
<div className="space-y-3">
|
||||
<h1 className="text-lg font-semibold">Toasts and floating notices</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Floating notifications and retry alerts sit cleanly above MobileBottomNav without overflowing the viewport.
|
||||
</p>
|
||||
</div>
|
||||
<ToastViewport />
|
||||
<IssueRowDetailsNotice
|
||||
error={new Error("Failed to load optional task details")}
|
||||
onRetry={() => undefined}
|
||||
/>
|
||||
</MobileShell>
|
||||
);
|
||||
}
|
||||
|
||||
function SaveBarStory() {
|
||||
return (
|
||||
<MobileShell>
|
||||
<div className="agent-settings-with-save-bar space-y-4">
|
||||
<h1 className="text-lg font-semibold">Agent settings</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The fixed save bar tracks the mobile bottom navigation offset so Discard and Save changes stay clear of MobileBottomNav.
|
||||
</p>
|
||||
<div className="rounded-lg border border-border p-4 text-sm text-muted-foreground">
|
||||
Runtime harness, model defaults, and secret bindings appear here.
|
||||
</div>
|
||||
<AgentConfigSaveBar
|
||||
dirty
|
||||
saving={false}
|
||||
onDiscard={() => undefined}
|
||||
onSave={() => undefined}
|
||||
/>
|
||||
</div>
|
||||
</MobileShell>
|
||||
);
|
||||
}
|
||||
|
||||
function ProfileWizardStory() {
|
||||
const queryClient = useQueryClient();
|
||||
const companyId = "company-storybook";
|
||||
const [seeded, setSeeded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
queryClient.setQueryData(queryKeys.tools.profiles(companyId), { profiles: [] });
|
||||
queryClient.setQueryData(queryKeys.tools.applications(companyId), { applications: [] });
|
||||
queryClient.setQueryData(queryKeys.tools.connections(companyId), { connections: [] });
|
||||
queryClient.setQueryData(queryKeys.agents.list(companyId), storybookAgents);
|
||||
queryClient.setQueryData(companyProjectsQuery(companyId).queryKey, storybookProjects);
|
||||
queryClient.setQueryData(queryKeys.routines.list(companyId), []);
|
||||
setSeeded(true);
|
||||
}, [queryClient, companyId]);
|
||||
|
||||
return (
|
||||
<MobileShell>
|
||||
{seeded ? <ProfileWizard companyId={companyId} /> : null}
|
||||
</MobileShell>
|
||||
);
|
||||
}
|
||||
|
||||
function SelectionBarStory() {
|
||||
return (
|
||||
<MobileShell>
|
||||
<div className="space-y-3">
|
||||
<h1 className="text-lg font-semibold">Agent bulk selection</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The bulk selection bar floats cleanly above MobileBottomNav when agents are selected.
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
role="region"
|
||||
aria-label="Bulk actions"
|
||||
data-state="open"
|
||||
className="agent-selection-bar flex flex-wrap items-center gap-3 rounded-lg border bg-background p-3"
|
||||
>
|
||||
<span className="text-sm font-medium">3 selected</span>
|
||||
<div className="flex flex-1 flex-wrap items-center justify-end gap-2">
|
||||
<Button size="sm" variant="outline">
|
||||
<Pencil className="size-3.5" aria-hidden />
|
||||
Edit connection & model
|
||||
</Button>
|
||||
<Button size="icon-sm" variant="ghost" aria-label="Clear selection">
|
||||
<X className="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</MobileShell>
|
||||
);
|
||||
}
|
||||
|
||||
const meta = {
|
||||
id: "mobile-overlays-clearance",
|
||||
title: "Oversight and operation/Navigation, profile, and announcements/Mobile/Overlays & Toolbar Clearance",
|
||||
component: CoordinatorToolbarStory,
|
||||
decorators: [
|
||||
(Story) => (
|
||||
<PluginLauncherProvider>
|
||||
<Story />
|
||||
</PluginLauncherProvider>
|
||||
),
|
||||
],
|
||||
globals: {
|
||||
viewport: { value: "mobile", isRotated: false },
|
||||
},
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
waitForViewport: true,
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
"Mobile viewport verification for wrapped toolbars, collapsed org-chart controls, and bottom-nav clearance on fixed save bars, wizard footers, selection bars, toasts, and floating notices.",
|
||||
},
|
||||
},
|
||||
paperclip: {
|
||||
capabilities: ["navigation-preferences/navigation"],
|
||||
implementation: "production",
|
||||
boundary: "fixtures",
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof CoordinatorToolbarStory>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const CoordinatorToolbarMobile: Story = {
|
||||
render: () => <CoordinatorToolbarStory />,
|
||||
};
|
||||
|
||||
export const ToastAndNoticeAboveBottomNavMobile: Story = {
|
||||
render: () => <SeededToastsAndNoticeStory />,
|
||||
};
|
||||
|
||||
export const SaveBarsAboveBottomNavMobile: Story = {
|
||||
render: () => <SaveBarStory />,
|
||||
};
|
||||
|
||||
export const ProfileWizardFooterMobile: Story = {
|
||||
render: () => <ProfileWizardStory />,
|
||||
};
|
||||
|
||||
export const SelectionBarAboveBottomNavMobile: Story = {
|
||||
render: () => <SelectionBarStory />,
|
||||
};
|
||||
Reference in new issue
Block a user