mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-03 01:27:09 +01:00
## Thinking Path > - Paperclip helps people manage AI agents and their work. > - People need consistent UI patterns to review and control that work. > - The current board uses related layouts and controls with different spacing, type, and behavior. > - That drift makes it hard for a designer or an agent to build a new page from a reliable reference. > - Storybook can show the shared patterns and the states they need to support. > - This pull request adds design proposals, a local sandbox, and reusable UI controls so people can compare the patterns in context. > - The benefit is a clearer design system that agents can use to build consistent UI. ## Linked Issues or Issue Description **Subsystem affected** `ui/` — React board UI and Storybook. **Problem or motivation** Board pages repeat visual and interaction decisions. Storybook did not provide a complete reference for task views, conversation states, typography, toolbars, tabs, and light/dark colors. People could not compare a proposed pattern with the running board in one place. **Proposed solution** Add a staged Design Proposals catalog with foundations, components, layouts, and page specimens. Add an opt-in sandbox. Reuse production components where possible. Include synthetic conversation states and shared controls so reviewers can compare and refine them. **Alternatives considered** Separate static mockups would not show keyboard behavior, responsive layout, or real component states. Rebuilding each page only in Storybook would allow the reference to drift from the board. **Roadmap alignment** This improves existing board UI and Skills Manager surfaces. It does not add a new control-plane capability. ## What Changed - Added dark and light color references, typography and conversation specimens, and component stories for buttons, tabs, toolbars, sidebar, popovers, activity, and task lists. - Added a local design sandbox with synthetic task conversation playback and representative states. - Shared collection toolbars and navigation patterns across task, agent, project, routine, skill, connector, and artifact pages. - Added the streamlined Skills tabs and a My Skills collection that uses the shared skill cards. - Restored saved-thread access during synthetic playback, kept connector searchbox semantics, and updated reproduction checks after moving trial stories. - Documented the proposed patterns and added focused UI, catalog, and browser checks. ## Verification - `pnpm check:token-gates`, `node scripts/check-maps.mjs`, and `node scripts/storybook-catalog.mjs --check` passed. - Full workspace `pnpm -r typecheck` and `pnpm build` passed after merging master. After the review fixes, focused UI typecheck, `pnpm build-storybook`, 23 Skills Sources tests, and all 15 Storybook typography browser tests passed. - Focused task-thread and system-notice suites passed: 251 tests. Connector Browse passed 84 tests; the connector, attachment, recovery, and Storybook flyout browser journeys passed locally. - A local full Vitest run hit one intermittent chat-channels integration failure; that test passed in isolation. GitHub CI [39347996059](https://github.com/paperclipai/paperclip/actions/runs/39347996059) passed on the exact latest commit: 55 successful checks and two skipped draft-only Storybook jobs. - Greptile reviewed the exact latest commit at 5/5 with no new comments or open review threads. GitHub reports the branch as cleanly mergeable. ## Risks - This PR changes 206 files and exceeds the repository's 100-file review target. Review by commit and consider a scoped split before merge. - Design Proposals are staged references. Fixture interactions do not prove API behavior, permissions, or provider execution. - UI changes to shared controls may affect pages outside the proposal sandbox. Focused browser checks and the full CI matrix passed. ## Model Used - OpenAI Codex, GPT-6 family. The exact runtime model ID and context window are not exposed in this session. The model used reasoning, code execution, browser inspection, and local tests. Earlier branch commits were also AI-assisted in this Codex conversation. ## 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 available in this session) - [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 where applicable - [x] I have either linked existing issues or described the issue in-PR following the relevant issue template - [x] I have not referenced internal or instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal ticket id - [x] I have run focused 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 risks above - [x] All Paperclip CI gates are green - [x] 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: Scott Tong <scott@scotts-mbp-m5-max.local> Co-authored-by: Paperclip <noreply@paperclip.ing>
218 lines
16 KiB
TypeScript
218 lines
16 KiB
TypeScript
import { useState, type ComponentProps, type ReactNode } from "react";
|
|
import type { FeedbackVoteValue } from "@paperclipai/shared";
|
|
import { Button } from "@/components/ui/button";
|
|
import { ClearErrorButton, PauseResumeButton, RunButton } from "@/components/AgentActionButtons";
|
|
import { DesignSidebar } from "@/components/DesignSidebar";
|
|
import { ArtifactUploadButton, ArtifactUploadContent } from "@/components/artifacts/ArtifactUploadControls";
|
|
import { ExpandRelationListButton } from "@/components/issue-properties/relation-controls";
|
|
import { FilePreviewModeToggle, type FilePreviewMode } from "@/components/FilePreviewModeToggle";
|
|
import { OutputFeedbackButtons } from "@/components/OutputFeedbackButtons";
|
|
import { StarToggle } from "@/components/StarToggle";
|
|
import { StatusIcon } from "@/components/StatusIcon";
|
|
import { TaskList } from "@/components/TaskList";
|
|
import { TaskListToolbar } from "@/components/TaskListToolbar";
|
|
import { ToggleSwitch } from "@/components/ui/toggle-switch";
|
|
import { FlyoutAppearanceProvider } from "@/components/ui/flyout";
|
|
import { TaskChatBubbleActions } from "@/components/task-chat/TaskChatBubbleActions";
|
|
import { SidePanelToggleButton, SidePanelWindowControls } from "@/components/side-panel/SidePanelFrame";
|
|
import { SidePanelTabs } from "@/components/side-panel/SidePanelTabs";
|
|
import { defaultIssueFilterState } from "@/lib/issue-filters";
|
|
import type { TaskListView } from "@/lib/task-list-views";
|
|
import { storybookAgents, storybookIssueLabels, storybookProjects } from "../../fixtures/paperclipData";
|
|
import { DesignProposalAccess } from "./DesignProposalAccess";
|
|
import { reviewTaskItems } from "./task-list-data";
|
|
import { ButtonSpecimen as SampleButton } from "./ButtonSpecimen";
|
|
import { useButtonPreviewStates } from "./useButtonPreviewStates";
|
|
|
|
type ButtonProps = ComponentProps<typeof Button>;
|
|
export type ButtonVariant = NonNullable<ButtonProps["variant"]>;
|
|
export type ButtonSize = NonNullable<ButtonProps["size"]>;
|
|
// Exhaustive against the shipped Button API: adding a variant/size requires a
|
|
// label here, so the sandbox inventory includes new shared primitive options.
|
|
export const buttonVariants = {
|
|
default: "Default", cta: "CTA", destructive: "Destructive", outline: "Outline",
|
|
secondary: "Secondary", ghost: "Ghost", link: "Link",
|
|
} satisfies Record<ButtonVariant, string>;
|
|
export const buttonSizes = {
|
|
default: "Default", xs: "Extra small", sm: "Small", lg: "Large",
|
|
icon: "Icon", "icon-xs": "Icon extra small", "icon-sm": "Icon small", "icon-lg": "Icon large",
|
|
} satisfies Record<ButtonSize, string>;
|
|
export const buttonStates = { default: "Default", hover: "Hover", "focus-visible": "Keyboard focus", active: "Pressed", disabled: "Disabled", loading: "Loading" } as const;
|
|
export const buttonSurfaces = { background: "Main pane / menu", muted: "Left sidebar / raised card", "muted-alt": "Middle card", "background-alt": "Input surface" } as const;
|
|
const surfaceClasses = { background: "bg-background", muted: "bg-muted", "muted-alt": "bg-(--muted-alt)", "background-alt": "bg-(--background-alt)" };
|
|
export type ButtonPlaygroundSettings = {
|
|
label: string;
|
|
variant: ButtonVariant;
|
|
size: ButtonSize;
|
|
icon: "none" | "leading" | "trailing";
|
|
state: keyof typeof buttonStates;
|
|
surface: keyof typeof buttonSurfaces;
|
|
};
|
|
export const defaultButtonSettings: ButtonPlaygroundSettings = {
|
|
label: "Create task", variant: "outline", size: "default", icon: "leading", state: "default", surface: "background",
|
|
};
|
|
|
|
function SampleGroup({ title, source, children }: { title: string; source: string; children: ReactNode }) {
|
|
return <section className="min-w-0 space-y-4 border-t border-border pt-6" aria-label={title}>
|
|
<div className="space-y-1">
|
|
<h3 className="text-base font-normal text-foreground">{title}</h3>
|
|
<p className="text-xs text-muted-foreground">{source}</p>
|
|
</div>
|
|
{children}
|
|
</section>;
|
|
}
|
|
|
|
export function ButtonSamples({ settings = defaultButtonSettings }: { settings?: ButtonPlaygroundSettings }) {
|
|
const [action, setAction] = useState("No action yet");
|
|
useButtonPreviewStates();
|
|
const act = (name: string) => setAction(`${name} clicked · preview only`);
|
|
return <div data-testid="proposal-button-samples" className="space-y-8 text-foreground">
|
|
<SampleGroup title="Live specimen" source="Shared Button · current label, variant, size, icon and state controls">
|
|
<div className={`flex flex-wrap items-center gap-4 rounded-lg border border-border p-6 ${surfaceClasses[settings.surface]}`}>
|
|
<SampleButton settings={settings} onClick={() => act(settings.variant)} measure />
|
|
<output className="text-xs text-muted-foreground" aria-live="polite">{action}</output>
|
|
</div>
|
|
<p className="text-xs text-muted-foreground">Surface: <code>--{settings.surface}</code>. Hover, keyboard focus and pressed previews reuse the compiled component state rules. Real pointer and keyboard interactions remain available; states without dedicated styling can look identical.</p>
|
|
{settings.size.startsWith("icon") && <p className="text-xs text-muted-foreground">Icon-only sizes always retain an icon and use the label as their accessible name.</p>}
|
|
<details className="text-xs text-muted-foreground"><summary className="cursor-pointer">Implementation reference</summary>
|
|
<pre className="mt-2 overflow-x-auto rounded-md bg-muted p-3"><code>{`import { Button } from "@/components/ui/button";\n\n<Button variant="${settings.variant}" size="${settings.size}"${settings.state === "disabled" || settings.state === "loading" ? " disabled" : ""}${settings.state === "loading" ? ' aria-busy="true"' : ""}${settings.size.startsWith("icon") ? ` aria-label=${JSON.stringify(settings.label)}` : ""}>\n ${settings.state === "loading" ? "<Loader2 aria-hidden className=\"animate-spin\" />" : settings.size.startsWith("icon") || settings.icon === "leading" ? "<CirclePlus aria-hidden />" : ""}${!settings.size.startsWith("icon") ? ` ${settings.label}` : ""}${settings.icon === "trailing" && !settings.size.startsWith("icon") && settings.state !== "loading" ? " <CirclePlus aria-hidden />" : ""}\n</Button>`}</code></pre>
|
|
<p className="mt-2">Forced interaction states belong to this preview. Use pointer interaction and keyboard focus in the app.</p>
|
|
</details>
|
|
</SampleGroup>
|
|
<SampleGroup title="All button variants" source="ui/src/components/ui/button.tsx · every variant, in default, disabled and loading states">
|
|
<div className="overflow-x-auto">
|
|
<table className="w-full text-left text-sm" data-testid="button-variant-matrix">
|
|
<thead><tr className="border-b border-border text-xs text-muted-foreground">
|
|
{["Variant", "Default", "Disabled", "Loading"].map(label => <th key={label} className="px-3 pb-3 font-normal">{label}</th>)}
|
|
</tr></thead>
|
|
<tbody>{Object.entries(buttonVariants).map(([variant, label]) => <tr key={variant} data-button-variant={variant} className="border-b border-border">
|
|
<th className="px-3 py-4 text-xs font-normal text-muted-foreground">{label}<code className="mt-1 block">{variant}</code></th>
|
|
{(["default", "disabled", "loading"] as const).map(state => <td key={state} className="px-3 py-4">
|
|
<SampleButton settings={settings} variant={variant as ButtonVariant} state={state} onClick={() => act(variant)} />
|
|
</td>)}
|
|
</tr>)}</tbody>
|
|
</table>
|
|
</div>
|
|
</SampleGroup>
|
|
<SampleGroup title="All button sizes" source="All eight shared sizes · current variant, state and icon controls">
|
|
<div className="flex flex-wrap items-end gap-6" data-testid="button-size-matrix">
|
|
{Object.entries(buttonSizes).map(([size, label]) => <div key={size} data-button-size={size} className="space-y-2">
|
|
<SampleButton settings={settings} size={size as ButtonSize} onClick={() => act(size)} measure />
|
|
<p className="text-xs text-muted-foreground">{label}<code className="block">{size}</code></p>
|
|
</div>)}
|
|
</div>
|
|
</SampleGroup>
|
|
<SandboxContexts onAction={act} />
|
|
</div>;
|
|
}
|
|
|
|
function SandboxContexts({ onAction }: { onAction: (label: string) => void }) {
|
|
const [view, setView] = useState<TaskListView>("all");
|
|
const [query, setQuery] = useState("preview");
|
|
const [layout, setLayout] = useState<"list" | "board">("list");
|
|
const [expanded, setExpanded] = useState(true);
|
|
const [filters, setFilters] = useState(defaultIssueFilterState);
|
|
return <FlyoutAppearanceProvider><DesignProposalAccess>
|
|
<div className="space-y-8">
|
|
<SampleGroup title="Task toolbar" source="TaskListToolbar · view menu, clear search, layout toggles, expand/collapse, filters and New Task">
|
|
<TaskListToolbar view={view} onViewChange={setView} query={query} onQueryChange={setQuery}
|
|
layout={layout} onLayoutChange={setLayout} allExpanded={expanded} onToggleExpanded={() => setExpanded(value => !value)}
|
|
onNewTask={() => onAction("New Task")} filters={{ state: filters, onChange: patch => setFilters(current => ({ ...current, ...patch })), activeFilterCount: filters.statuses.length,
|
|
agents: storybookAgents, projects: storybookProjects, labels: storybookIssueLabels }} />
|
|
</SampleGroup>
|
|
<SampleGroup title="Task-list header and popover actions" source="TaskList · sort controls, Columns trigger and Reset defaults inside its menu">
|
|
<TaskList items={reviewTaskItems.slice(0, 3)} />
|
|
</SampleGroup>
|
|
<SampleGroup title="Sidebar controls in context" source="DesignSidebar · organization, global search, New Task, account menu and feedback">
|
|
<div className="flex h-96 w-(--sz-240px) overflow-hidden rounded-lg border border-border bg-muted">
|
|
<DesignSidebar onNewTask={() => onAction("Sidebar New Task")} />
|
|
</div>
|
|
</SampleGroup>
|
|
<SampleGroup title="App-shell controls" source="Shared SidePanel controls · proposal toggle stays quiet until hover/focus">
|
|
<PanelButtons onAction={onAction} />
|
|
</SampleGroup>
|
|
<SampleGroup title="Agent, conversation and attachment controls" source="Shared controls used by sandbox agents, task conversations, property panes and attachments">
|
|
<SharedContexts onAction={onAction} />
|
|
</SampleGroup>
|
|
</div>
|
|
</DesignProposalAccess></FlyoutAppearanceProvider>;
|
|
}
|
|
|
|
function PanelButtons({ onAction }: { onAction: (label: string) => void }) {
|
|
const [open, setOpen] = useState(true);
|
|
const [maximized, setMaximized] = useState(false);
|
|
const [tabs, setTabs] = useState([{ id: "properties", type: "properties", label: "Properties", closable: true }, { id: "tasks", type: "tasks", label: "Tasks", closable: true }]);
|
|
const [active, setActive] = useState("properties");
|
|
return <div className="space-y-4">
|
|
<div className="flex items-center gap-2">
|
|
<SidePanelToggleButton open={open} onToggle={() => setOpen(value => !value)} highlightWhenOpen={false} />
|
|
<SidePanelWindowControls maximized={maximized} onMaximizedChange={setMaximized} closeControl="close" onToggle={() => { setOpen(false); onAction("Close side panel"); }} />
|
|
</div>
|
|
<div className="flex min-w-0 rounded-md border border-border">
|
|
<SidePanelTabs tabs={tabs} activeTabId={active} onActiveTabChange={setActive}
|
|
onCloseTab={id => setTabs(current => current.filter(tab => tab.id !== id))}
|
|
onAddTab={() => { const id = `preview-${tabs.length}`; setTabs(current => [...current, { id, type: "preview", label: `Preview ${current.length + 1}`, closable: true }]); setActive(id); }}
|
|
appearance="streamlined-task" />
|
|
</div>
|
|
</div>;
|
|
}
|
|
|
|
function SharedContexts({ onAction }: { onAction: (label: string) => void }) {
|
|
const [paused, setPaused] = useState(false);
|
|
const [vote, setVote] = useState<FeedbackVoteValue | null>(null);
|
|
const [starred, setStarred] = useState(false);
|
|
const [mode, setMode] = useState<FilePreviewMode>("rendered");
|
|
const [enabled, setEnabled] = useState(false);
|
|
const [status, setStatus] = useState("todo");
|
|
const [relationsExpanded, setRelationsExpanded] = useState(false);
|
|
const [uploadVisible, setUploadVisible] = useState(true);
|
|
return <div className="space-y-6">
|
|
<ContextRow label="Agent actions" source="AgentActionButtons.tsx">
|
|
<RunButton onClick={() => onAction("Run now")} />
|
|
<PauseResumeButton isPaused={paused} onPause={() => setPaused(true)} onResume={() => setPaused(false)} />
|
|
<PauseResumeButton isPaused={!paused} onPause={() => setPaused(true)} onResume={() => setPaused(false)} />
|
|
<ClearErrorButton onClick={() => onAction("Clear error")} />
|
|
<RunButton disabled onClick={() => {}} />
|
|
</ContextRow>
|
|
<ContextRow label="Response and output feedback" source="TaskChatBubbleActions.tsx · OutputFeedbackButtons.tsx">
|
|
<TaskChatBubbleActions copyText="Synthetic agent response for button review." feedback={{ activeVote: vote, sharingPreference: "allowed", termsUrl: null, onVote: async value => setVote(value) }} />
|
|
<OutputFeedbackButtons inline activeVote={vote} sharingPreference="allowed" onVote={async value => setVote(value)} />
|
|
</ContextRow>
|
|
<ContextRow label="Favorite · off / on / pending / error / row" source="StarToggle.tsx">
|
|
<StarToggle size="button" resourceName="preview" starred={starred} onToggle={setStarred} />
|
|
<StarToggle size="button" resourceName="selected preview" starred onToggle={value => onAction(`Star ${value}`)} />
|
|
<StarToggle size="button" resourceName="pending preview" starred pending onToggle={() => {}} />
|
|
<StarToggle size="button" resourceName="error preview" starred error onToggle={() => onAction("Retry star")} />
|
|
<StarToggle size="row" resourceName="row preview" starred={starred} revealClassName="opacity-100" onToggle={setStarred} />
|
|
</ContextRow>
|
|
<ContextRow label="File display and switches" source="FilePreviewModeToggle.tsx · ui/toggle-switch.tsx">
|
|
<FilePreviewModeToggle mode={mode} onChange={setMode} label="File display" />
|
|
<ToggleSwitch checked={enabled} onCheckedChange={setEnabled} aria-label="Enable preview" />
|
|
<ToggleSwitch size="lg" checked={enabled} onCheckedChange={setEnabled} aria-label="Enable large preview" />
|
|
<ToggleSwitch checked disabled onCheckedChange={() => {}} aria-label="Disabled preview" />
|
|
</ContextRow>
|
|
<ContextRow label="Task status picker" source="StatusIcon.tsx · task detail and properties">
|
|
<StatusIcon status={status} onChange={setStatus} /><StatusIcon status={status} showLabel onChange={setStatus} />
|
|
</ContextRow>
|
|
<ContextRow label="Upload, retry and dismiss" source="artifacts/ArtifactUploadControls.tsx">
|
|
<ArtifactUploadButton onUpload={files => onAction(`Selected ${files.length} files`)} />
|
|
<ArtifactUploadContent entries={uploadVisible ? [{ id: "preview-upload", filename: "preview.txt", status: "error", error: "Synthetic upload failure" }] : []}
|
|
onRetry={() => onAction("Retry upload")} onDismiss={() => setUploadVisible(false)} />
|
|
</ContextRow>
|
|
<ContextRow label="Expand related tasks" source="issue-properties/relation-controls.tsx">
|
|
<ExpandRelationListButton hiddenCount={4} expanded={relationsExpanded} onClick={() => setRelationsExpanded(value => !value)} />
|
|
</ContextRow>
|
|
<ContextRow label="Link rendered through Button" source="ui/button.tsx · asChild">
|
|
<Button variant="link" asChild><a href="#button-playground-top">Back to playground</a></Button>
|
|
</ContextRow>
|
|
</div>;
|
|
}
|
|
|
|
function ContextRow({ label, source, children }: { label: string; source: string; children: ReactNode }) {
|
|
return <div className="space-y-3">
|
|
<p className="text-sm text-foreground">{label}</p>
|
|
<div className="flex flex-wrap items-center gap-3">{children}</div>
|
|
<p className="text-xs text-muted-foreground">{source}</p>
|
|
</div>;
|
|
}
|