Skip to content

feat(bots): shapes by rule editor section - #353

Merged
notFrost merged 1 commit into
feat/bot-icon-timelinefrom
feat/bot-icon-editor-shapes
Dec 1, 2026
Merged

notFrost merged 1 commit into
feat/bot-icon-timelinefrom
feat/bot-icon-editor-shapes

Conversation

@notFrost

@notFrost notFrost commented Dec 1, 2026

Copy link
Copy Markdown

Part of notFrost/sophie#692, phase 4 stage B2 (spec §9).

Problem

While the Default Icon is a built-in shape, Bot settings showed only the "Shapes by rule" label and hint. The editor had no way to pick a shape for a rule.

What changed

Only BotRuleShapesSection.tsx, its new browser test, and additions to the web translation catalogs.

  • Rows. Three rows in BotIconRuleOrderList (mode="shapes"), using the Bot's shared rule order.
  • Shape trigger. Built from SelectButton. It shows a picked rule's shape and name. An unset rule shows the Default Icon's shape plus its name and a muted (Default).
    • aria-label: Shape for {rule}: {shape} or Shape for {rule}: {shape} (Default).
  • Popover (side="bottom" align="end" sideOffset={6}, width="md"):
    • First comes the {Shape} (Default) off option, with a check when it is selected and the note Off. Follows the Default Icon, even if it changes.
    • Then a separator and the 14-shape grid, 7 columns, h-10 tiles. Tiles are silhouettes, except the selected tile and the hovered or focused one, which show the colored shape.
    • The Default Icon's own shape is aria-disabled at opacity-30, with the tooltip This is the Default Icon and the note {Shape} is the Default Icon, so it can't be picked here. (D32).
    • Picking a shape or the off option closes the popover and returns focus to the trigger. Escape closes it with no change.
  • lastCalled "after" field. Uses BotIconTimeField with min={1} and placeholder 2h.
    • It is disabled while the rule is unset.
    • On the first pick, the time is set to 120 if it was unusable (invalid text or under 1m). Otherwise the last value is kept.
    • Invalid text goes into lastCalledInvalidText (R1). The field gets aria-invalid, plus the message Use at least 1m, in minutes, hours or days, like 15m, 16h or 2d. linked through aria-describedby.
  • Now badge. BotIconNowBadge without an elapsed time, in renderHeaderAdornment, on the rule that holds the slot.
  • Status line. BotIconSlotStatus in the label row. It shows Muted: only the Default Icon shows while muted, with no rule badge.
  • No local state. The section keeps no copy of times or ids. Everything is read from and written to the rules draft.

New i18n keys (additions only, inserted by hand after the shapes hint, in all 11 web catalogs)

key en
eebef010adbc973b Shapes by rule (string form, used as the list label)
667102796b9cb153 after ($context: Show a rule's shape after a quiet time)
d9569ad01a3a82c9 Show this shape after the Bot has been quiet for
d4f80bc1416d0b6c Shape for {rule}: {shape} (Default)
59327334954ea9e7 Shape for {rule}: {shape}
f71feb43bdf6da5b This is the Default Icon
5e9ea2f11ff8534b {shape} is the Default Icon, so it can't be picked here.
83dc324158b33dda Use at least 1m, in minutes, hours or days, like 15m, 16h or 2d.
8d9153ba3b589c10 (Default)
11693a115a1c5637 Off. Follows the Default Icon, even if it changes.

How tested

BotRuleShapesSection.browser.test.tsx has 7 tests:

  • trigger faces, (Default) and aria-labels;
  • the off option and the grid of 14, with the Default shape disabled, its tooltip and note, and no change when clicked;
  • picking a shape, closing, and focus returning after a pick, after Escape and after choosing off;
  • after disabled while unset, then enabled with 2h after the first pick;
  • 0m rejected with the message, the text kept in the draft, and recovery;
  • the now badge without elapsed time;
  • muted.
$ env -u NODE_ENV vp test run src/components/bots/BotRuleShapesSection.browser.test.tsx src/components/bots/BotIdentityPicker.browser.test.tsx src/components/bots/BotIconRuleParts.browser.test.tsx
 Test Files  3 passed (3)
      Tests  15 passed (15)

$ vp run typecheck
vp run: 0/44 cache hit (0%), 44/44 successful.

$ vp lint apps/web/src/components/bots/BotRuleShapesSection.tsx apps/web/src/components/bots/BotRuleShapesSection.browser.test.tsx
(exit 0, no findings)

$ vp run knip:check
$ node scripts/knip-check.ts
(exit 0)

$ node scripts/i18n-check.ts
i18n catalogs match the source in apps/web, apps/mobile, apps/desktop.

The pre-commit hook passed fmt, lint and knip. vp run check:changed fails on Windows before it reaches the checks: it switches to run everything, then hits spawn ENAMETOOLONG in scripts/check-changed.ts:555. That is a tooling limit, not this diff.

Screenshots

Taken from an isolated dev server (vp run dev --no-seed, worktree .t3/userdata) with a test Bot, in the light theme. They are not committed; the files are in D:\Projects\Sophie\.sophie\t3\bots\_shared\692-timeline-icons\b2-screens\:

  • F10-shapes-by-rule-now-badge.png: Cloud, Star and Clover after 1m, saved, with the now badge on Since last activity.
  • F11a-popover.png: popover open on Left for you, off option selected, Star hovered with its tooltip, Squircle disabled with its note.
  • F11b-unset-after-disabled.png: all rules unset, with the after field disabled at 2h.
  • F11b-rejected-0m.png: 0m rejected, with the message and the footer Fix the shapes by rule to save.
  • F12-display-quiet-clover.png: sidebar, breadcrumb and details avatars showing Clover while the Bot is quiet.

Left out / divergences

  • Rule face in the trigger and popover (blocked, needs a shared-file change). Spec §9.2 asks for the rule's face: focused, attentive or calm. BotAvatar only sets the face through status, which also draws the status dot, and BotFace isn't exported. For now every avatar in the section uses the calm face. The proposed fix is an optional expression prop on BotAvatar; this is waiting on the lead.
  • Trigger width is 200px (w-50), not the spec's 172px minimum. At 172px, Squircle (Default) is truncated.
  • The rejected-time message sits in renderBody, aligned to the title column, because the shared list owns the row description. Visually it is under the description.
  • F10's now badge is on Since last activity, not Working. A no-provider dev Bot can't be made to work.

🤖 Generated with Claude Code

Fills BotRuleShapesSection: one optional shape per rule in the shared
rule order, a popover with the (Default) off option and the shape grid
(Default Icon's shape disabled), the lastCalled "after" time, the now
badge and the muted status line. Adds the section's copy to every web
catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@notFrost

notFrost commented Dec 1, 2026

Copy link
Copy Markdown
Author

Review (Lukas): approved, merging into feat/bot-icon-timeline.

Verified on a detached local merge of cbc63c9c53 into feat/bot-icon-timeline @ 8b9aac2ba4:

  • vp run typecheck → 44/44
  • vp lint --report-unused-disable-directives on the section and its test → exit 0
  • vp run knip:check → exit 0
  • node scripts/i18n-check.ts → catalogs match the source in web, mobile and desktop
  • browser tests (env -u NODE_ENV) for BotRuleShapesSection, BotIconRuleParts and BotIdentityPicker → 3 files, 15/15

Scope. The PR touches only BotRuleShapesSection.tsx, its browser test and the 11 web catalogs, with 10 keys added to each, additions only. That matches the contract.

Against spec §9: these hold, checked in the diff and in screenshots F10, F11a and F11b:

  • the (Default) labelling and the off option with its note;
  • the Default Icon's shape disabled, with its tooltip and the line under the grid;
  • the popover closes and focus returns to the trigger, which the tests cover;
  • the after field is disabled while unset, gets 2h on the first pick only when the current value is unusable, has a 1m minimum, and shows its error with the footer gate;
  • the now badge has no elapsed time;
  • muted copy.

Accepted divergences:

  • Trigger width: w-50 (200px) instead of the 172px minimum, so Squircle (Default) doesn't truncate.
  • Error position: the error sits under the row because the shared list owns the description line. It reads the same as the mockup.
  • F10 badge: it shows on Since last activity rather than Working, because of the isolated dev app.

Follow-ups:

  1. Rule faces (spec §9.2 and §9.3): not done here. Every trigger and popover shape shows the calm face. Spec: focused for Working, attentive for Left for you, calm for Since last activity. This needs an optional expression prop on BotAvatar.tsx, a file B1 is also editing. It goes in its own small follow-up PR once B1 is merged.
  2. Visual QA: the "Star" tooltip covers the tile above it in F11a. Isabelle will judge it during visual QA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant