Skip to content

refactor(editor): the ToolRail renders from a table of tools - #253

Merged
YIWANG3 merged 1 commit into
mainfrom
refactor/tool-rail-table
Nov 2, 2026
Merged

YIWANG3 merged 1 commit into
mainfrom
refactor/tool-rail-table

Conversation

@YIWANG3

@YIWANG3 YIWANG3 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

PR 0c of docs/feature-modules-plan.md §4 (the plan itself is in PR #252). Zero behaviour change: the editor's tool rail stops hard-coding its seven buttons so feature modules can contribute tools later.

What changes

  • New src/components/editor/editorTools.js exporting EDITOR_TOOLS, one row per tool in today's order: { key, icon, labelKey, cap, unavailable }. cap is the capability flag the tool needs ("lut", "stickerExtract", "aiRepaint", or null); unavailable says what the rail does without it — "hidden" (LUT disappears, as today) or "locked" (sticker and AI repaint stay, greyed, with the platform hint in their title, as today). The PhotoFrame and LutGlyph icon components move here with the table (createElement rather than JSX, since the file is .js).
  • ToolRail.jsx maps over the table. Same icons, same overlay.tools.* labels, same title tooltips, same active/hover styling; data-testid is still derived from the translated label (tool-crop, tool-lut, …), and locked buttons still carry no test id.
  • EditorOverlay.jsx, editorStateModel.js and the panels are untouched.

Capability test

src/api/capabilities.test.js scans src/** as text for cap: "…" literals, so it finds the three flags at the new location without changes. (A comment in the new file that spelled cap: "name" tripped the scan on the first run and is reworded.)

Verified

  • npm run check: lint, 430 unit tests, build — green.
  • Editor e2e subset 03-editor, 04-sticker, 07-depth, 33-split, 40-crop-mouse, 41-text-layer-panel, 67-lut, 80-repaint-reference: 52 passed, 1 skipped (67's "no LUT tool off macOS" case, which skips on a Mac by design — CI's Windows job covers the hidden path).

🤖 Generated with Claude Code

PR 0c of docs/feature-modules-plan.md. The rail rendered seven hard-coded
buttons; now it maps over EDITOR_TOOLS in src/components/editor/
editorTools.js, one row per tool in the same order: key, icon, label key,
the capability flag it needs, and what the rail does without it — "hidden"
(LUT) or "locked" (sticker, AI repaint). The icon components move with the
table. No behaviour change: same icons, titles, data-testids (still derived
from the translated label), active styling and locked buttons.

The capability names stay string literals, so src/api/capabilities.test.js
finds them at the new location.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@YIWANG3
YIWANG3 merged commit 94529a5 into main Nov 2, 2026
4 checks passed
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