mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
fix(onboarding): preserve model source logo and text proportions during selection (#22999)
## Thinking Path > - Paperclip helps people manage AI agents. > - During onboarding, a user selects a model provider. > - The selected tile moves to the center of the row. > - Its width can change during this movement when only one provider is available. > - The tile's horizontal scale also applies to the logo and text. > - This change keeps the logo and both labels at their natural size while the tile moves. ## Linked Issues or Issue Description **What happened?** With Codex disabled, selecting Claude stretched the brand mark, provider name and credential label during the collapse. At 80 ms on desktop, the provider name grew from 43.69 px to 84.18 px wide. **Expected behavior** The logo and both lines of text should stay centered and keep their resting dimensions throughout the transition. **Steps to reproduce** 1. Disable the Codex adapter on a disposable instance. 2. Open onboarding, create an organization, and name its first agent. 3. On **Connect a model**, select Claude and inspect an intermediate animation frame. 4. Repeat with **Use API key instead** and at a narrow viewport. Related implementation history: #12613 and #18309. ## What Changed - Give the brand mark and provider name position-only Motion layout projection. - Apply the same projection to the credential text inside its existing fade and slide animation. - Use the tile's existing transition for all three elements. ## Verification - Ran the real onboarding wizard in Chrome at 1280 × 800 and 375 × 812. All eight cases passed, including Claude-only and default configurations, OpenAI selection, both credential labels, keyboard input, and reduced motion. - Measured the image and rendered text ranges every 16 ms through 512 ms. Size and centering stayed within 0.15 CSS px of the expected values. The tile rectangles matched the baseline on every sampled frame in all four paired cases. - Ran `pnpm exec vitest run --project @paperclipai/ui --maxWorkers=4`: 575 files passed, 7,159 tests passed and one skipped. - An earlier broader local run hit the Mac's PostgreSQL shared-memory limit in three CLI worktree tests. ## Risks Low risk. The shared source picker also displays connection choices when creating an agent. The change is limited to the mark and label spans inside its existing radio buttons. ## Model Used OpenAI GPT-6 via Codex with local code editing and browser automation. ## Checklist - [x] Included the project and subsystem context. - [x] Specified the model and capabilities used. - [x] Checked the roadmap for duplicate work. - [x] I have searched GitHub for duplicate or related PRs and linked them above. - [x] Described the bug and reproduction in the issue-template format. - [x] Used public references. - [x] Used a descriptive branch name. - [x] Ran the UI tests and browser checks. - [x] Added an onboarding Playwright regression that checks both label bounds and the brand mark during tile movement. - [x] Documented the risk above. - [ ] All Paperclip CI gates are green. - [ ] Greptile is 5/5 with all review findings addressed. - [x] Will address review findings before merge. --------- Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local>
This commit is contained in:
1 parent
079fb1fe63
commit
854f77efe4
2 files changed
+63
-5
No files matched your search
@@ -155,6 +155,54 @@ test.describe("Onboarding wizard", () => {
|
||||
expect(pageErrors, pageErrors.join("\n")).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("the mark and labels keep their size as a single model source collapses", async ({ page }) => {
|
||||
await page.route("**/api/adapters", async (route) => {
|
||||
const response = await route.fetch();
|
||||
const adapters = await response.json();
|
||||
await route.fulfill({ response, json: adapters.map((adapter: { type: string }) =>
|
||||
adapter.type === "codex_local" ? { ...adapter, disabled: true } : adapter,
|
||||
) });
|
||||
});
|
||||
await page.emulateMedia({ reducedMotion: "no-preference" });
|
||||
await page.clock.install();
|
||||
await page.goto("/onboarding");
|
||||
await page.getByPlaceholder("e.g. Northwind Labs").fill(`E2E-Picker-${Date.now()}`);
|
||||
await page.getByRole("button", { name: /^Continue/ }).click();
|
||||
await page.locator("#onboarding-agent-name").fill("Ada");
|
||||
await page.locator("#onboarding-agent-name").press("Enter");
|
||||
await page.getByRole("button", { name: "Use API key instead" }).click();
|
||||
const group = page.getByRole("radiogroup", { name: "Model source" });
|
||||
await expect(group.getByRole("radio")).toHaveCount(1);
|
||||
const source = group.getByRole("radio", { name: /Claude/ });
|
||||
await source.focus();
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
await page.clock.pauseAt(new Date(await page.evaluate(() => Date.now() + 1000)));
|
||||
|
||||
const content = [source.locator("img"), source.getByText("Claude", { exact: true }), source.getByText("API key", { exact: true })];
|
||||
const measureContent = () => Promise.all(content.map((locator) => locator.evaluate((element) => {
|
||||
const range = document.createRange();
|
||||
if (element instanceof HTMLImageElement) range.selectNode(element);
|
||||
else range.selectNodeContents(element);
|
||||
const { width, height } = range.getBoundingClientRect();
|
||||
return { width, height };
|
||||
})));
|
||||
const tileWidth = () => source.evaluate((element) => element.getBoundingClientRect().width);
|
||||
const resting = await measureContent();
|
||||
const fullWidth = await tileWidth();
|
||||
|
||||
await source.press("Enter");
|
||||
await page.clock.runFor(80);
|
||||
const movingWidth = await tileWidth();
|
||||
const moving = await measureContent();
|
||||
await page.clock.runFor(512);
|
||||
expect(movingWidth).toBeLessThan(fullWidth);
|
||||
expect(movingWidth).toBeGreaterThan(await tileWidth());
|
||||
for (const [index, bounds] of moving.entries()) {
|
||||
expect(bounds.width).toBeCloseTo(resting[index]!.width, 1);
|
||||
expect(bounds.height).toBeCloseTo(resting[index]!.height, 1);
|
||||
}
|
||||
});
|
||||
|
||||
test("connect step starts the sign-in when the source is chosen, rather than hiring, when the signal reports no credential", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -58,7 +58,9 @@ export function CredentialTag({ mode }: { mode: ModelConnectionMode }) {
|
||||
animate={{ opacity: 1, y: 0, transition: TAG_SWAP_ENTER }}
|
||||
exit={{ opacity: 0, y: TAG_SWAP_TRAVEL, transition: TAG_SWAP_EXIT }}
|
||||
>
|
||||
{CREDENTIAL_TAG_LABEL[mode]}
|
||||
<motion.span layout="position" transition={SOURCE_COLLAPSE_MOVE}>
|
||||
{CREDENTIAL_TAG_LABEL[mode]}
|
||||
</motion.span>
|
||||
</motion.span>
|
||||
</AnimatePresence>
|
||||
</span>
|
||||
@@ -114,9 +116,13 @@ function ModelSourceTile({
|
||||
: "border-border bg-card hover:bg-accent/40",
|
||||
)}
|
||||
>
|
||||
<span className="flex size-(--sz-30px) shrink-0 items-center justify-center">
|
||||
<motion.span
|
||||
layout="position"
|
||||
transition={SOURCE_COLLAPSE_MOVE}
|
||||
className="flex size-(--sz-30px) shrink-0 items-center justify-center"
|
||||
>
|
||||
{source.icon}
|
||||
</span>
|
||||
</motion.span>
|
||||
{/*
|
||||
One step up the named ladder each — the source name from text-xs (12px)
|
||||
to --text-compact (13px), the tag under it from --text-nano (10px) to
|
||||
@@ -124,9 +130,13 @@ function ModelSourceTile({
|
||||
font-size-only token form, so the line box comes from the tile's own
|
||||
rhythm rather than the Tailwind scale's paired line-height.
|
||||
*/}
|
||||
<span className="text-(length:--text-compact) font-medium text-foreground">
|
||||
<motion.span
|
||||
layout="position"
|
||||
transition={SOURCE_COLLAPSE_MOVE}
|
||||
className="text-(length:--text-compact) font-medium text-foreground"
|
||||
>
|
||||
{source.label}
|
||||
</span>
|
||||
</motion.span>
|
||||
{mode ? <CredentialTag mode={mode} /> : <span aria-hidden className="h-4" />}
|
||||
</button>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user