mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 01:41:42 +02: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>
172 lines
11 KiB
TypeScript
172 lines
11 KiB
TypeScript
import { expect, test, type Page } from "@playwright/test";
|
|
|
|
test.use({ viewport: { width: 1440, height: 1100 } });
|
|
async function openToolbars(page: Page, story = "playground") {
|
|
await page.goto(`/iframe.html?id=design-toolbars--${story}&viewMode=story&globals=theme:dark`);
|
|
await expect(page.getByTestId("toolbars-preview")).toBeVisible();
|
|
return page.getByTestId("toolbars-preview");
|
|
}
|
|
|
|
test("canonical toolbar stories mount the shared components under the proposal theme", async ({ page }) => {
|
|
const errors: string[] = [];
|
|
page.on("pageerror", error => errors.push(error.message));
|
|
for (const [story, count] of [["playground", 6], ["tasks", 1], ["decisions", 1], ["skills", 1], ["artifacts", 1], ["projects", 1], ["routines", 1], ["narrow", 6]] as const) {
|
|
const preview = await openToolbars(page, story);
|
|
await expect(page.locator(".design-proposal-theme")).toBeVisible();
|
|
await expect(preview.getByRole("toolbar")).toHaveCount(count);
|
|
}
|
|
expect(errors).toEqual([]);
|
|
});
|
|
|
|
test("task toolbar retains real view, search, layout, expansion and filter controls", async ({ page }) => {
|
|
const preview = await openToolbars(page, "tasks");
|
|
const toolbar = preview.getByRole("toolbar", { name: "Task list controls" });
|
|
|
|
await toolbar.getByRole("button", { name: "Task view: All tasks", exact: true }).click();
|
|
await page.getByRole("menuitemradio", { name: "Unread", exact: true }).click();
|
|
await expect(toolbar.getByRole("button", { name: "Task view: Unread", exact: true })).toBeVisible();
|
|
await toolbar.getByRole("textbox", { name: "Search tasks", exact: true }).fill("connector");
|
|
await toolbar.getByRole("button", { name: "Clear search", exact: true }).click();
|
|
await expect(toolbar.getByRole("textbox", { name: "Search tasks", exact: true })).toHaveValue("");
|
|
await toolbar.getByRole("button", { name: "Board view", exact: true }).click();
|
|
await expect(toolbar.getByRole("button", { name: "Board view", exact: true })).toHaveAttribute("aria-pressed", "true");
|
|
await expect(toolbar.getByRole("button", { name: /all tasks/ })).toBeDisabled();
|
|
await toolbar.getByRole("button", { name: "List view", exact: true }).click();
|
|
await toolbar.getByRole("button", { name: "Collapse all tasks", exact: true }).click();
|
|
await expect(toolbar.getByRole("button", { name: "Expand all tasks", exact: true })).toBeEnabled();
|
|
await toolbar.getByRole("button", { name: "Filter", exact: true }).click();
|
|
await expect(page.getByRole("dialog", { name: "Filters", exact: true })).toBeVisible();
|
|
await page.keyboard.press("Escape");
|
|
await toolbar.getByRole("button", { name: "New Task", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("New Task requested · local preview only");
|
|
});
|
|
|
|
test("decision menus update local state", async ({ page }) => {
|
|
const writes: string[] = [];
|
|
page.on("request", request => { if (["POST", "PATCH", "PUT", "DELETE"].includes(request.method()) && request.url().includes("/api/")) writes.push(request.url()); });
|
|
const preview = await openToolbars(page);
|
|
const decisions = preview.getByRole("region", { name: "Decisions toolbar", exact: true });
|
|
await decisions.getByRole("button", { name: "Group", exact: true }).click();
|
|
await page.getByRole("button", { name: "Severity", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await expect(decisions.getByRole("status")).toContainText("Group: severity");
|
|
await decisions.getByRole("button", { name: "Sort", exact: true }).click();
|
|
await page.getByRole("button", { name: "Oldest first", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await expect(decisions.getByRole("status")).toContainText("Sort: oldest");
|
|
await decisions.getByRole("button", { name: "Filter", exact: true }).click();
|
|
await page.getByRole("button", { name: "Critical", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await expect(decisions.getByRole("status")).toContainText("1 active filters");
|
|
expect(writes).toEqual([]);
|
|
});
|
|
|
|
test("width controls expose narrow wrapping and keyboard focus", async ({ page }) => {
|
|
const preview = await openToolbars(page);
|
|
await preview.getByRole("combobox", { name: "Toolbar container width", exact: true }).selectOption("narrow");
|
|
const specimens = preview.getByTestId("toolbar-specimens");
|
|
await expect(specimens).toHaveAttribute("data-container-width", "narrow");
|
|
expect(await specimens.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true);
|
|
const search = preview.getByRole("textbox", { name: "Search tasks", exact: true });
|
|
await search.focus();
|
|
await page.keyboard.press("Tab");
|
|
const list = preview.getByRole("button", { name: "List view", exact: true });
|
|
await expect(list).toBeFocused();
|
|
await expect(list).not.toHaveCSS("box-shadow", "none");
|
|
});
|
|
|
|
test("Skills and Artifacts use their shared production controls with local preview state", async ({ page }) => {
|
|
let preview = await openToolbars(page, "skills");
|
|
await preview.getByRole("textbox", { name: "Search installed skills", exact: true }).fill("review");
|
|
await preview.getByRole("button", { name: "Sort Most agents", exact: true }).click();
|
|
await page.getByRole("menuitemradio", { name: "Alphabetical", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("Search: review · Sort: alphabetical");
|
|
await preview.getByRole("button", { name: "Source All", exact: true }).click();
|
|
await page.getByRole("menuitemradio", { name: "GitHub", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("Source: github");
|
|
const scan = preview.getByRole("button", { name: "Scan project workspaces for skills", exact: true });
|
|
await scan.click();
|
|
await expect(scan).toBeDisabled();
|
|
await preview.getByRole("button", { name: "Complete simulated scan", exact: true }).click();
|
|
await expect(scan).toBeEnabled();
|
|
await preview.getByRole("button", { name: "New", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "Create new skill", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("Create skill requested");
|
|
await preview.getByRole("button", { name: "New folder", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("New folder requested");
|
|
preview = await openToolbars(page, "artifacts");
|
|
await preview.getByRole("textbox", { name: "Search artifacts", exact: true }).fill("mockup");
|
|
await preview.getByRole("radio", { name: "Images", exact: true }).click();
|
|
await expect(preview.getByRole("radio", { name: "Images", exact: true })).toHaveCSS("font-size", "14px");
|
|
await expect(preview.getByRole("radio", { name: "Images", exact: true })).toHaveCSS("height", "32px");
|
|
await preview.getByTestId("artifact-group-control").click();
|
|
await page.getByTestId("artifact-group-option-parent_task").click();
|
|
await expect(preview.getByRole("status")).toHaveText("Search: mockup · Group: parent_task · Type: image");
|
|
await preview.getByRole("button", { name: "Clear artifact search", exact: true }).click();
|
|
await expect(preview.getByRole("textbox", { name: "Search artifacts", exact: true })).toHaveValue("");
|
|
});
|
|
|
|
test("canonical toolbars share control geometry and keep the requested keyboard order", async ({ page }) => {
|
|
const preview = await openToolbars(page);
|
|
const geometry = await preview.locator("[data-canonical-toolbar]").evaluateAll(toolbars => toolbars.map(toolbar => {
|
|
const search = toolbar.querySelector<HTMLElement>("[data-toolbar-search]")!;
|
|
const first = toolbar.querySelector("input, button")!;
|
|
const controls = [...toolbar.querySelectorAll<HTMLElement>("button:not([data-toolbar-clear], .canonical-tab), [data-toolbar-control]")].filter(button => !button.closest(".design-view-toggle"));
|
|
const style = getComputedStyle(search);
|
|
return { name: toolbar.getAttribute("data-canonical-toolbar"), searchHeight: search.getBoundingClientRect().height, gap: getComputedStyle(toolbar).columnGap,
|
|
border: style.borderColor, radius: style.borderRadius, first: first.getAttribute("aria-label"),
|
|
controls: controls.map(button => ({ height: button.getBoundingClientRect().height, border: getComputedStyle(button).borderColor, radius: getComputedStyle(button).borderRadius })) };
|
|
}));
|
|
expect(geometry).toHaveLength(6);
|
|
for (const toolbar of geometry) {
|
|
expect(toolbar.searchHeight).toBe(44);
|
|
expect(toolbar.gap).toBe("8px");
|
|
expect(toolbar.first).toBe(toolbar.name === "tasks" ? "Task view: All tasks" : toolbar.name === "skills" ? "Search installed skills" : `Search ${toolbar.name}`);
|
|
for (const control of toolbar.controls) {
|
|
expect(control.height).toBe(toolbar.searchHeight);
|
|
expect(control.border).toBe(toolbar.border);
|
|
expect(control.radius).toBe(toolbar.radius);
|
|
}
|
|
}
|
|
const skills = preview.getByRole("toolbar", { name: "Skills controls", exact: true });
|
|
const skillViews = skills.getByRole("navigation", { name: "Skills views" });
|
|
await expect(skillViews.getByRole("link")).toHaveText(["Installed", "Discover", "My Skills"]);
|
|
await expect(skillViews.getByRole("link", { name: "Installed", exact: true })).toHaveAttribute("aria-current", "page");
|
|
await expect(skillViews.getByRole("link", { name: "My Skills", exact: true })).toHaveAttribute("href", /\/skills\/studio$/);
|
|
await expect(skillViews.getByRole("link", { name: "Sources", exact: true })).toHaveCount(0);
|
|
|
|
await expect(skills.getByRole("button").last()).toHaveAccessibleName("New");
|
|
const decisions = preview.getByRole("region", { name: "Decisions toolbar", exact: true });
|
|
await decisions.getByRole("textbox", { name: "Search decisions", exact: true }).fill("des-3");
|
|
await expect(decisions.locator("[data-toolbar-count]")).toHaveText("1 decision");
|
|
await decisions.getByRole("button", { name: "Clear search", exact: true }).click();
|
|
await expect(decisions.locator("[data-toolbar-count]")).toHaveText("2 decisions");
|
|
});
|
|
|
|
test("Projects toolbar searches, sorts and reports creation locally", async ({ page }) => {
|
|
const preview = await openToolbars(page, "projects");
|
|
await preview.getByRole("textbox", { name: "Search projects", exact: true }).fill("design");
|
|
await preview.getByRole("button", { name: "Sort: Name", exact: true }).click();
|
|
await page.getByRole("button", { name: "Updated", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await expect(preview.getByRole("status")).toContainText("Search: design · Sort: updated · Direction: desc");
|
|
await preview.getByRole("button", { name: "Add Project", exact: true }).click();
|
|
await expect(preview.getByRole("status")).toContainText("Add Project requested · local preview only");
|
|
});
|
|
|
|
|
|
test("routines toolbar updates search, sort, group and creation intent", async ({ page }) => {
|
|
const preview = await openToolbars(page, "routines");
|
|
await preview.getByRole("textbox", { name: "Search routines", exact: true }).fill("review");
|
|
await expect(preview.locator("output")).toContainText("Search: review");
|
|
await preview.getByRole("button", { name: "Sort", exact: true }).click();
|
|
await page.getByRole("button", { name: "Title", exact: true }).click();
|
|
await expect(preview.locator("output")).toContainText("Sort: title · Direction: asc");
|
|
await preview.getByRole("button", { name: "Group", exact: true }).click();
|
|
await page.getByRole("button", { name: "Agent", exact: true }).click();
|
|
await expect(preview.locator("output")).toContainText("Group: assignee");
|
|
await expect(preview.getByRole("button", { name: "New folder" })).toHaveCount(0);
|
|
await preview.getByRole("button", { name: "Create routine" }).click();
|
|
await expect(preview.locator("output")).toContainText("Create routine requested");
|
|
});
|