mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
* refactor(skills): one definition of the skill fields across every surface
The Name / Description / Content trio was implemented three times — once in the
canvas modal and once each in the create and detail pages — and had already
drifted: the name hint appeared on create, was missing entirely on detail, and
sat in a different slot in the modal; the content editor was 260px on the pages
and 200px in the modal; only the modal marked the fields required.
Extract SkillFields, the DetailSection form both full-page surfaces render, and
move the shared copy into skill-copy.ts. The modal keeps ChipModalField — that
is required inside a ChipModalBody, so it cannot share the pages' JSX — but now
reads the same placeholder, hint, and max-length constants, so the wording can
no longer diverge.
The detail page's local FieldLockTooltip moves into SkillFields and is now
available to both pages, and the dynamic rich-editor import drops from three
copies to two.
No behavioral change beyond the drift being resolved: the name hint now shows on
the detail page as it already did on create.
* refactor(skills): derive modal saving state, collapse the field message line
From the cleanup passes over this branch:
- SkillModal mirrored `mutation.isPending` into a local `saving` useState, which
.claude/rules/sim-hooks.md forbids. It also carried a latent bug: the
`finally { setSaving(false) }` ran after `onSave()` had closed the modal, so it
set state on an unmounting component, and a throw from `onSave()` would leave
the modal stuck in a saving state. Derived from the two mutations instead.
- The hint/error line under a field was written three times in SkillFields, in
three slightly different shapes. One FieldMessage helper now renders all three.
- The name hint is an authoring instruction, so it no longer shows under a field
that cannot be edited (a built-in skill, or a viewer who is not an editor).