Skip to content

overhaul variant UI: editable card, picker dialog, name editing#12

Merged
rafavalls merged 3 commits into
mainfrom
rafavalls/fix-variants-ui
May 8, 2026
Merged

overhaul variant UI: editable card, picker dialog, name editing#12
rafavalls merged 3 commits into
mainfrom
rafavalls/fix-variants-ui

Conversation

@rafavalls
Copy link
Copy Markdown
Contributor

@rafavalls rafavalls commented May 8, 2026

Summary

Reworks the variants UX end-to-end so page-level and section-level flows share the same components, sizing, and behaviour. Adds a name field on multivariate variants (plumbed through CmsVariant / PageVariantEntry) editable inline from the breadcrumb via a pencil affordance, swaps the custom matcher-picker modal for a CommandDialog list, and rebuilds the rule area as a collapsible bordered card whose open state persists in localStorage. The DateField is now a styled overlay over a real datetime-local input so users can both type and pick — and the overlay finally inherits the same border the input has, fixing the apparent "borderless" look. Both variant lists were unified on a single SortableVariantItem (flag icon only, no colored chip) with drag-reordering on page variants too, and you can now add the first page variant from a flat-sections page or delete a page variant from inside its detail view.

Test plan

  • Open a page with no page variants → "Add page variant" creates the multivariate wrapper
  • Section + page variant lists look identical (flag icon, drag-reorder, hover dropdown)
  • Click pencil on the variant breadcrumb → rename inline; Enter saves, Escape cancels
  • Date inputs: click to type, calendar icon to pick, × to clear; border is visible in both focused and unfocused states
  • Variant card chevron toggles open/closed; state persists across reloads
  • Delete button appears in the page-variant breadcrumb when 2+ variants exist

🤖 Generated with Claude Code


Summary by cubic

Overhauled the variants UI so page-level and section-level share the same components and flows, with inline variant naming, a new rule picker, and a cleaner date input. Adds drag-reordering for page variants and lets you add the first page variant from a flat page.

  • New Features

    • Inline rename for variants from the breadcrumb; stored as a name on multivariate variants and exposed via CmsVariant/PageVariantEntry.
    • Replaced the matcher picker with a searchable CommandDialog.
    • Variant rule area is now a collapsible card whose open state persists in localStorage.
    • Unified lists on SortableVariantItem with drag-reorder for page variants; you can add the first page variant and delete a page variant from its detail view.
    • DateField now overlays a real datetime-local input so users can type or pick, with a clear button and visible border.
  • Refactors

    • Consolidated page-level and section-level variant UIs to shared components and sizing; section titles use text-sm, font-semibold.
    • Tools and schemas updated to pass through optional name (getPageSectionsTool, Zod schemas).
    • New handlers: onChangeVariantName, onChangePageVariantName, and onReorderPageVariants; wiring for auto-save and preview refresh included.
    • Simplified rename handlers and removed defensive try/catch around localStorage/showPicker; cleaned up casts now that name is on the types; minor UI tidy-ups.
    • Formatted files and sorted imports to satisfy ci checks.

Written for commit 21b1f55. Summary will update on new commits.

rafavalls and others added 3 commits May 8, 2026 12:43
Reworks the variants experience end-to-end so the page-level and
section-level variant flows share the same components, sizing, and
behaviour.

- Replace the custom matcher-picker modal with a CommandDialog list
- Convert the variant rule area into a collapsible bordered card
  (state persisted in localStorage) with the Rule picker and schema
  fields aligned at the same px-5 inset
- Make the variant title in the breadcrumb inline-editable via a
  pencil affordance; persist as a top-level "name" on the raw
  multivariate variant (exposed through CmsVariant / PageVariantEntry)
- Rebuild DateField as a styled overlay over a real datetime-local
  input so users can both type and pick; restore the input border
  beneath the overlay
- Unify both variant lists on a single SortableVariantItem (flag icon
  only, no colored chip) with drag-reorder for page variants too
- Allow adding the first page variant from a flat-sections page
- Add a delete button inside the page-variant detail breadcrumb
- Drop all-caps title styling; bring section labels to text-sm
  font-semibold to match the FieldLabel scale

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Apply biome auto-fixes to satisfy ci:check:
- Format api/tools/files.ts and web/tools/file-explorer/cms-form.tsx
- Sort imports in web/tools/file-explorer/index.tsx

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Remove try/catch around localStorage and showPicker; let the rare
  failure modes throw naturally
- Drop ad-hoc { name?: string } casts on variant types now that name
  lives on CmsVariant and PageVariantEntry
- Collapse repeated newName.trim() and intermediate Record<string,
  unknown> shuffling in the rename handlers
- Use cn() instead of an inline ternary on the date overlay span
- Strip a few what-comments left over from refactors

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafavalls rafavalls merged commit 9f6f841 into main May 8, 2026
3 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.

2 participants