@@ -12,7 +12,6 @@ import type { FieldPreferences, MotorPreferences, RobotPreferences } from "@/sys
1212import type SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain"
1313import World from "@/systems/World"
1414import type { PanelImplProps } from "@/ui/components/Panel"
15- import { useStateContext } from "@/ui/helpers/StateProviderHelpers"
1615import { CloseType , useUIContext , type UIScreen } from "@/ui/helpers/UIProviderHelpers"
1716import ChooseInputSchemePanel from "../ChooseInputSchemePanel"
1817import AssemblySelection , { type AssemblySelectionOption } from "./configure/AssemblySelection"
@@ -31,12 +30,7 @@ import ConfigureScoringZonesInterface from "./interfaces/scoring/ConfigureScorin
3130import Label from "@/ui/components/Label"
3231import DrivetrainSelectionInterface from "./interfaces/DrivetrainSelectionInterface"
3332import TransformGizmoControl from "@/ui/components/TransformGizmoControl"
34- import { ConfigMode , CONFIG_OPTS } from "./ConfigTypes"
35-
36- export interface ConfigurePanelSettings {
37- configMode ?: ConfigMode
38- selectedAssembly : MirabufSceneObject
39- }
33+ import { ConfigMode , CONFIG_OPTS , ConfigurationType } from "./ConfigTypes"
4034
4135interface ConfigInterfaceProps < T , P > {
4236 panel : UIScreen < T , P >
@@ -123,16 +117,21 @@ const ConfigInterface: React.FC<ConfigInterfaceProps<void, ConfigurePanelCustomP
123117export interface ConfigurePanelCustomProps {
124118 selectedAssembly ?: MirabufSceneObject
125119 configMode ?: ConfigMode
120+ configurationType ?: ConfigurationType
126121}
127122
128123const ConfigurePanel : React . FC < PanelImplProps < void , ConfigurePanelCustomProps > > = ( { panel } ) => {
129124 const { configureScreen } = useUIContext ( )
130- const { configurationType, setConfigurationType } = useStateContext ( )
131125
132- const { configMode : initialConfigMode , selectedAssembly : initialSelectedAssembly } = panel ! . props . custom
126+ const {
127+ configMode : initialConfigMode ,
128+ selectedAssembly : initialSelectedAssembly ,
129+ configurationType : initialConfigurationType ,
130+ } = panel ! . props . custom
133131
134132 const [ selectedAssembly , setSelectedAssembly ] = useState < MirabufSceneObject | undefined > ( initialSelectedAssembly )
135133 const [ configMode , setConfigMode ] = useState < ConfigMode | undefined > ( initialConfigMode )
134+ const [ configurationType , setConfigurationType ] = useState < ConfigurationType > ( initialConfigurationType ?? "ROBOTS" )
136135 const [ pendingDeletes , setPendingDeletes ] = useState < number [ ] > ( [ ] )
137136
138137 const originalRobotPrefs = useRef < RobotPreferences | null > ( null )
@@ -169,7 +168,6 @@ const ConfigurePanel: React.FC<PanelImplProps<void, ConfigurePanelCustomProps>>
169168 originalMotorPrefs . current = null
170169 originalInputSchemes . current = null
171170
172- setConfigurationType ( configurationType )
173171 new ConfigurationSavedEvent ( )
174172 }
175173 const onCancel = ( ) => {
@@ -201,7 +199,7 @@ const ConfigurePanel: React.FC<PanelImplProps<void, ConfigurePanelCustomProps>>
201199 { title : "Configure Assets" , acceptText : "Save" , cancelText : "Cancel" } ,
202200 { onBeforeAccept, onCancel }
203201 )
204- } , [ configurationType , selectedAssembly , pendingDeletes ] )
202+ } , [ selectedAssembly , pendingDeletes ] )
205203
206204 const modes = useMemo ( ( ) => {
207205 switch ( configurationType ) {
0 commit comments