parametrics: add display: 'segmented' enum hint + drop fence color

User pointed out two regressions in the auto-derived fence inspector:

- A `color` field rendered for fence — but the legacy `FencePanel`
  hid it (fence's color is a leftover schema field that isn't part of
  the inspector UX). Dropped from `fenceParametrics`.

- Style + base-style enums rendered as a dropdown, but the legacy
  used the inline segmented switcher (Slat/Rail/Privacy +
  Grounded/Floating). Added a `display?: 'select' | 'segmented'` hint
  to the enum field kind. ParametricInspector renders SegmentedControl
  when set; defaults to dropdown otherwise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-05-18 10:21:56 -04:00
co-authored by Claude Opus 4.7
parent e7cb976b9b
commit 80199dc890
3 changed files with 31 additions and 4 deletions
@@ -14,6 +14,7 @@ import { sfxEmitter } from '../../../lib/sfx-bus'
import useEditor from '../../../store/use-editor'
import { ActionButton, ActionGroup } from '../controls/action-button'
import { PanelSection } from '../controls/panel-section'
import { SegmentedControl } from '../controls/segmented-control'
import { SliderControl } from '../controls/slider-control'
import { ToggleControl } from '../controls/toggle-control'
import { PanelWrapper } from './panel-wrapper'
@@ -204,6 +205,15 @@ function FieldRenderer({ field, nodeId, onUpdate }: FieldRendererProps) {
case 'enum': {
const str = typeof value === 'string' ? value : (field.options[0] ?? '')
if (field.display === 'segmented') {
return (
<SegmentedControl
onChange={(next) => onUpdate({ [key]: next } as Partial<AnyNode>)}
options={field.options.map((opt) => ({ label: prettifyEnumValue(opt), value: opt }))}
value={str}
/>
)
}
return (
<div className="flex items-center justify-between px-3 py-2">
<span className="text-foreground/80 text-xs">{prettifyKey(key)}</span>