From c226a2ec02ced407838af2d0723f4d161505a9ce Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 4 Dec 2026 20:25:25 -0800 Subject: [PATCH] Space the toolbar title and replace middle-dot separators Separate the questionnaire title from host content at the start of the toolbar, such as the Anvil brand, with a column gap that does not indent a wrapped title. Remove the unused brand style. Replace the middle-dot separators in the issue count, the outline and history hints, the JSON panel size, the issue locations, and the Bundle choices with plain wording or layout. --- packages/anvil-react/src/styles.css | 16 ++++++++-------- packages/anvil-react/src/ui/AnvilEditor.tsx | 8 ++++---- packages/anvil-react/src/ui/Outline.tsx | 4 ++-- packages/anvil-react/src/ui/SidePanel.tsx | 5 +++-- packages/anvil-react/test/editorPanels.test.tsx | 7 +++++++ packages/anvil-react/test/editorShell.test.tsx | 8 ++++---- packages/anvil-react/test/host.test.tsx | 8 +++++++- packages/anvil/src/FileActions.tsx | 8 ++++++-- packages/anvil/test/fileActions.test.tsx | 12 +++++++++--- 9 files changed, 50 insertions(+), 26 deletions(-) diff --git a/packages/anvil-react/src/styles.css b/packages/anvil-react/src/styles.css index 92767e4..0880c4d 100644 --- a/packages/anvil-react/src/styles.css +++ b/packages/anvil-react/src/styles.css @@ -205,6 +205,11 @@ min-width: 0; } +/* Separates host content at the start of the toolbar, such as a brand, from the title. */ +.anvil-toolbar-start { + column-gap: 12px; +} + .anvil-toolbar-end { margin-left: auto; } @@ -216,14 +221,6 @@ background: var(--anvil-border); } -.anvil-brand { - display: flex; - align-items: center; - gap: 8px; - margin-right: 12px; - font-weight: 650; -} - .anvil-doc-title { max-width: 260px; overflow: hidden; @@ -1248,6 +1245,9 @@ textarea.anvil-input { } .anvil-issue-where { + display: flex; + flex-wrap: wrap; + gap: 2px 8px; font-size: 12px; color: var(--anvil-muted); overflow-wrap: anywhere; diff --git a/packages/anvil-react/src/ui/AnvilEditor.tsx b/packages/anvil-react/src/ui/AnvilEditor.tsx index d1859b9..eab80e6 100644 --- a/packages/anvil-react/src/ui/AnvilEditor.tsx +++ b/packages/anvil-react/src/ui/AnvilEditor.tsx @@ -360,7 +360,7 @@ const Toolbar = ({ return (
-
+
{start} {title === undefined || title === "" ? "Untitled" : title} @@ -421,7 +421,7 @@ const Toolbar = ({ `${counts.warning} warning${counts.warning === 1 ? "" : "s"}`, ] .filter(Boolean) - .join(" · ") + .join(", ") }
@@ -598,10 +598,10 @@ const HistoryButton = ({
{steps.length > HISTORY_SHOWN ? - `${steps.length - HISTORY_SHOWN} older not shown · ` + `${steps.length - HISTORY_SHOWN} older steps not shown. ` : ""} Click a step to {undo ? "undo" : "redo"} it and everything above - it + it.
diff --git a/packages/anvil-react/src/ui/Outline.tsx b/packages/anvil-react/src/ui/Outline.tsx index e6f690d..3fe02b5 100644 --- a/packages/anvil-react/src/ui/Outline.tsx +++ b/packages/anvil-react/src/ui/Outline.tsx @@ -781,8 +781,8 @@ export const Outline = () => { )}
- ↑↓ select · ⌥↑↓ move · ⌥←→ nest · ⌫ delete · drag to reorder · - right-click for more + Use ↑↓ to select, ⌥↑↓ to move, ⌥←→ to nest, and ⌫ to delete. Drag to + reorder and right-click for more.
{menu && ( { : <> - {(json.length / 1024).toFixed(1)} KB · edit to change + {(json.length / 1024).toFixed(1)} KB. Edit the JSON to change the + questionnaire. diff --git a/packages/anvil-react/test/editorPanels.test.tsx b/packages/anvil-react/test/editorPanels.test.tsx index ec3df53..bea7dc3 100644 --- a/packages/anvil-react/test/editorPanels.test.tsx +++ b/packages/anvil-react/test/editorPanels.test.tsx @@ -436,6 +436,13 @@ describe("issues panel", () => { ).toContain("Questionnaire.item[1].text"); fireEvent.click(panel.getByRole("button", { name: /Check Mood/ })); expect(store.getState().selection).toBe(uid(0)); + // The location and the code stay separate words in the text. + expect( + query( + panel.getByRole("button", { name: /Check Mood/ }), + ".anvil-issue-where", + ).textContent, + ).toBe("mood test.item"); act(() => store.updateRoot((d) => { diff --git a/packages/anvil-react/test/editorShell.test.tsx b/packages/anvil-react/test/editorShell.test.tsx index 1373da2..d7a13e1 100644 --- a/packages/anvil-react/test/editorShell.test.tsx +++ b/packages/anvil-react/test/editorShell.test.tsx @@ -244,7 +244,7 @@ describe("toolbar", () => { }, ); const status = () => getByRole("button", { name: /Valid|error|warning/ }); - expect(status().textContent).toBe("1 error · 1 warning"); + expect(status().textContent).toBe("1 error, 1 warning"); expect(status().classList).toContain("anvil-sev-error"); const setName = (name: string) => act(() => @@ -253,7 +253,7 @@ describe("toolbar", () => { }), ); setName("e2w1"); - expect(status().textContent).toBe("2 errors · 2 warnings"); + expect(status().textContent).toBe("2 errors, 2 warnings"); setName("e0w0"); expect(status().textContent).toBe("1 warning"); expect(status().classList).toContain("anvil-sev-warning"); @@ -287,7 +287,7 @@ describe("history menus", () => { const menu = utils.getByRole("menu", { name: "Undo history" }); const steps = within(menu).getAllByRole("menuitem"); expect(steps).toHaveLength(15); - expect(menu.textContent).toContain("2 older not shown"); + expect(menu.textContent).toContain("2 older steps not shown"); expect(menu.textContent).toContain( "Click a step to undo it and everything above", ); @@ -326,7 +326,7 @@ describe("history menus", () => { expect(redoMenu.textContent).toContain( "Click a step to redo it and everything above", ); - expect(redoMenu.textContent).not.toContain("older not shown"); + expect(redoMenu.textContent).not.toContain("not shown"); fireEvent.click(at(within(redoMenu).getAllByRole("menuitem"), 0)); expect(utils.doc().title).toBe("T16"); fireEvent.mouseLeave(redo); diff --git a/packages/anvil-react/test/host.test.tsx b/packages/anvil-react/test/host.test.tsx index 77ae434..01a458f 100644 --- a/packages/anvil-react/test/host.test.tsx +++ b/packages/anvil-react/test/host.test.tsx @@ -803,7 +803,13 @@ describe("toolbar", () => { }} />, ); - expect(screen.getByText("Brand")).toBeTruthy(); + // The brand and the title share the start group, which spaces them apart. + expect(screen.getByText("Brand").parentElement).toBe( + document.querySelector(".anvil-doc-title")?.parentElement, + ); + expect(screen.getByText("Brand").parentElement?.classList).toContain( + "anvil-toolbar-start", + ); expect(screen.getByRole("button", { name: "Save" })).toBeTruthy(); }); }); diff --git a/packages/anvil/src/FileActions.tsx b/packages/anvil/src/FileActions.tsx index 88f2ab5..d7fd284 100644 --- a/packages/anvil/src/FileActions.tsx +++ b/packages/anvil/src/FileActions.tsx @@ -331,9 +331,13 @@ const ChooseDialog = ({ > {q.title ?? q.name ?? `Questionnaire ${i + 1}`} - {[q.url, q.version, `${q.item?.length ?? 0} items`] + {[ + q.url, + q.version && `version ${q.version}`, + `${q.item?.length ?? 0} item${q.item?.length === 1 ? "" : "s"}`, + ] .filter(Boolean) - .join(" · ")} + .join(", ")} diff --git a/packages/anvil/test/fileActions.test.tsx b/packages/anvil/test/fileActions.test.tsx index 055a632..600d498 100644 --- a/packages/anvil/test/fileActions.test.tsx +++ b/packages/anvil/test/fileActions.test.tsx @@ -231,7 +231,13 @@ describe("importing", () => { id: "ided", }, }, - { resource: { resourceType: "Questionnaire", status: "draft" } }, + { + resource: { + resourceType: "Questionnaire", + status: "draft", + item: [{ linkId: "only", type: "string" }], + }, + }, ], }; @@ -341,9 +347,9 @@ describe("importing", () => { }; expect(await choices()).toEqual([ "Titled2 items", - "namedhttp://example.org/q · 2 · 0 items", + "namedhttp://example.org/q, version 2, 0 items", "Questionnaire 30 items", - "Questionnaire 40 items", + "Questionnaire 41 item", ]); expect(document.querySelector("dialog")).toBeNull(); // Closing the choice keeps the current questionnaire.