import { DesignSliderField, type SliderTick, } from "@/components/design-slider-field"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { cn } from "@/lib/utils"; import { useDesignStore } from "@/store/design-store"; import { DESIGN_BOUNDS, type DesignVector, type MobilityArchitecture } from "@/types/api"; /** * Per-field tick data for the registry-rover overlay. Keys are the * design-vector field names; each entry is the list of selected * rovers that have a numeric value to plot at that field. */ export type DesignFormTicks = Partial>; export interface DesignFormProps { disabled?: boolean; ticks?: DesignFormTicks; } /** * Design vector form with an explicit mobility-architecture selector. */ export function DesignForm({ disabled, ticks = {} }: DesignFormProps) { const design = useDesignStore((s) => s.design); const setDesignField = useDesignStore((s) => s.setDesignField); const resetDesign = useDesignStore((s) => s.resetDesign); const continuousFields = ( Object.keys(DESIGN_BOUNDS) as (keyof typeof DESIGN_BOUNDS)[] ).filter((k) => k !== "n_wheels"); return (
setDesignField("mobility_architecture", v)} />
{continuousFields.map((key) => { const bounds = DESIGN_BOUNDS[key]; const value = design[key] as number; const isInteger = key === "grouser_count"; return ( `${Math.round(v)}` : undefined} sanitize={isInteger ? (v) => Math.round(v) : undefined} onChange={(v) => { if (isInteger) { setDesignField("grouser_count", Math.round(v)); } else { (setDesignField as (k: typeof key, v: number) => void)( key, v, ); } }} /> ); })}
); } interface MobilityArchitectureFieldProps { value: MobilityArchitecture; ticks: SliderTick[]; disabled?: boolean; onChange: (v: MobilityArchitecture) => void; } function MobilityArchitectureField({ value, ticks, disabled, onChange, }: MobilityArchitectureFieldProps) { const options: Array<{ value: MobilityArchitecture; label: string }> = [ { value: "rigid_4wheel", label: "Rigid 4-wheel" }, { value: "rocker_bogie_6wheel", label: "Rocker-bogie 6-wheel" }, ]; return (

Sets wheel count, obstacle capability, and suspension mass proxy.

{options.map((opt) => ( ))}
{ticks.length > 0 ? (
{ticks.map((tick) => ( {tick.rover_name} ))}
) : null}
); }