@@ -62,7 +62,7 @@ function App() {
6262 const [ time , setTime ] = useState ( 0 ) ;
6363 const [ isPlaying , setIsPlaying ] = useState ( false ) ;
6464 const [ trajectoryStatus , setTrajectoryStatus ] = useState (
65- TrajectoryStatus . INITIAL
65+ TrajectoryStatus . INITIAL ,
6666 ) ;
6767
6868 /**
@@ -96,11 +96,11 @@ function App() {
9696 ] ,
9797 } ) ;
9898 const [ timeFactor , setTimeFactor ] = useState (
99- LiveSimulationData . INITIAL_TIME_FACTOR
99+ LiveSimulationData . INITIAL_TIME_FACTOR ,
100100 ) ;
101101
102102 const [ completedModules , setCompletedModules ] = useState < Set < Module > > (
103- new Set ( )
103+ new Set ( ) ,
104104 ) ;
105105 const [ viewportSize , setViewportSize ] = useState ( DEFAULT_VIEWPORT_SIZE ) ;
106106 const adjustableAgentName =
@@ -161,6 +161,7 @@ function App() {
161161 const clearAllAnalysisState = useCallback ( ( ) => {
162162 resetCurrentRunAnalysisState ( ) ;
163163 setRecordedInputConcentration ( [ ] ) ;
164+ setProductEquilibriumConcentrations ( [ ] ) ;
164165 setProductOverTimeTraces ( [ ] ) ;
165166 setRecordedReactantConcentration ( [ ] ) ;
166167 setTimeToReachEquilibrium ( [ ] ) ;
@@ -176,7 +177,7 @@ function App() {
176177 ) {
177178 isPassedEquilibrium . current = isSlopeZero (
178179 currentProductConcentrationArray ,
179- timeFactor
180+ timeFactor ,
180181 ) ;
181182 } else if ( arrayLength === 0 && isPassedEquilibrium . current ) {
182183 isPassedEquilibrium . current = false ;
@@ -195,29 +196,32 @@ function App() {
195196 simulationData . getInitialConcentrations (
196197 activeAgents ,
197198 currentModule ,
198- sectionType === Section . Experiment
199- )
199+ sectionType === Section . Experiment ,
200+ ) ,
200201 ) ;
201- resetCurrentRunAnalysisState ( ) ;
202+ clearAllAnalysisState ( ) ;
202203 const trajectory = simulationData . createAgentsFromConcentrations (
203204 activeAgents ,
204205 currentModule ,
205- sectionType === Section . Experiment
206+ sectionType === Section . Experiment ,
206207 ) ;
207208 if ( ! trajectory ) {
208209 return null ;
209210 }
210211 const longestAxis = Math . max ( viewportSize . width , viewportSize . height ) ;
211212 const startMixed = sectionType !== Section . Introduction ;
213+ if ( process . env . NODE_ENV !== "production" ) {
214+ console . log ( "NEW BINDING SIMULATOR" ) ;
215+ }
212216 return new BindingSimulator (
213217 trajectory ,
214218 longestAxis / 3 ,
215- startMixed ? InitialCondition . RANDOM : InitialCondition . SORTED
219+ startMixed ? InitialCondition . RANDOM : InitialCondition . SORTED ,
216220 ) ;
217221 } , [
218222 simulationData ,
219223 currentModule ,
220- resetCurrentRunAnalysisState ,
224+ clearAllAnalysisState ,
221225 viewportSize . width ,
222226 viewportSize . height ,
223227 sectionType ,
@@ -238,7 +242,7 @@ function App() {
238242 {
239243 clientSimulator : clientSimulator ,
240244 } ,
241- LIVE_SIMULATION_NAME
245+ LIVE_SIMULATION_NAME ,
242246 ) ;
243247 } , [ simulariumController , clientSimulator ] ) ;
244248
@@ -287,13 +291,13 @@ function App() {
287291 ( ) =>
288292 uniqMeasuredConcentrations . filter ( ( c ) => c > halfFilled ) . length >=
289293 1 ,
290- [ halfFilled , uniqMeasuredConcentrations ]
294+ [ halfFilled , uniqMeasuredConcentrations ] ,
291295 ) ;
292296 const hasAValueBelowKd = useMemo (
293297 ( ) =>
294298 uniqMeasuredConcentrations . filter ( ( c ) => c < halfFilled ) . length >=
295299 1 ,
296- [ halfFilled , uniqMeasuredConcentrations ]
300+ [ halfFilled , uniqMeasuredConcentrations ] ,
297301 ) ;
298302 const canDetermineKd = useMemo ( ( ) => {
299303 return (
@@ -315,17 +319,17 @@ function App() {
315319 setCurrentProductConcentrationArray ( [ ] ) ;
316320 }
317321 } ,
318- [ currentProductConcentrationArray , productOverTimeTraces ]
322+ [ currentProductConcentrationArray , productOverTimeTraces ] ,
319323 ) ;
320324
321325 const setExperiment = ( ) => {
322326 setIsPlaying ( false ) ;
323-
327+ setCurrentView ( ViewType . Simulation ) ;
324328 const activeAgents = simulationData . getActiveAgents ( currentModule ) ;
325329 const concentrations = simulationData . getInitialConcentrations (
326330 activeAgents ,
327331 currentModule ,
328- true
332+ true ,
329333 ) ;
330334 clientSimulator ?. mixAgents ( ) ;
331335 setTimeFactor ( LiveSimulationData . INITIAL_TIME_FACTOR ) ;
@@ -362,7 +366,7 @@ function App() {
362366 value ,
363367 sectionType === Section . Experiment
364368 ? InitialCondition . RANDOM
365- : InitialCondition . SORTED
369+ : InitialCondition . SORTED ,
366370 ) ;
367371 simulariumController . gotoTime ( 1 ) ; // the number isn't used, but it triggers the update
368372 const previousConcentration = inputConcentration [ agentName ] || 0 ;
@@ -376,15 +380,17 @@ function App() {
376380 addProductionTrace ,
377381 resetCurrentRunAnalysisState ,
378382 sectionType ,
379- ]
383+ ] ,
380384 ) ;
385+
386+ // takes you to the home state
381387 const totalReset = useCallback ( ( ) => {
382388 setCurrentView ( ViewType . Lab ) ;
383389 const activeAgents = [ AgentName . A , AgentName . B ] ;
384390 setCurrentModule ( Module . A_B_AB ) ;
385391 const concentrations = simulationData . getInitialConcentrations (
386392 activeAgents ,
387- Module . A_B_AB
393+ Module . A_B_AB ,
388394 ) ;
389395 setLiveConcentration ( {
390396 [ AgentName . A ] : concentrations [ AgentName . A ] ,
@@ -400,7 +406,7 @@ function App() {
400406 concentrations [ AgentName . B ] ??
401407 LiveSimulationData . INITIAL_CONCENTRATIONS [ Module . A_B_AB ] [
402408 AgentName . B
403- ]
409+ ] ,
404410 ) ;
405411 setIsPlaying ( false ) ;
406412 clearAllAnalysisState ( ) ;
@@ -428,7 +434,7 @@ function App() {
428434 currentProductConcentrationArray . length > 1 ,
429435 ( ) => {
430436 totalReset ( ) ;
431- }
437+ } ,
432438 ) ;
433439 const hasRecordedFirstValue = useRef ( false ) ;
434440 // they have recorded a single value, changed the slider and pressed play
@@ -444,7 +450,7 @@ function App() {
444450 ( ) => {
445451 hasRecordedFirstValue . current = true ;
446452 setPage ( page + 1 ) ;
447- }
453+ } ,
448454 ) ;
449455
450456 const switchToLiveSimulation = useCallback (
@@ -462,7 +468,7 @@ function App() {
462468 setTrajectoryName ( LIVE_SIMULATION_NAME ) ;
463469 }
464470 } ,
465- [ simulariumController , trajectoryStatus ]
471+ [ simulariumController , trajectoryStatus ] ,
466472 ) ;
467473
468474 // handle trajectory changes based on content changes
@@ -488,7 +494,7 @@ function App() {
488494 await fetch3DTrajectory (
489495 url ,
490496 simulariumController ,
491- setPreComputedTrajectoryPlotData
497+ setPreComputedTrajectoryPlotData ,
492498 ) ;
493499 setTrajectoryStatus ( TrajectoryStatus . LOADED ) ;
494500 } ;
@@ -555,7 +561,7 @@ function App() {
555561 simulariumController . setCameraType ( false ) ;
556562 setTimeFactor ( trajectoryInfo . timeStepSize ) ;
557563 setFinalTime (
558- trajectoryInfo . totalSteps * trajectoryInfo . timeStepSize
564+ trajectoryInfo . totalSteps * trajectoryInfo . timeStepSize ,
559565 ) ;
560566 }
561567 } ;
@@ -582,7 +588,7 @@ function App() {
582588 preComputedPlotDataManager . getCurrentConcentrations ( ) ;
583589 } else if ( clientSimulator ) {
584590 concentrations = clientSimulator . getCurrentConcentrations (
585- productName
591+ productName ,
586592 ) as CurrentConcentration ;
587593 }
588594 const productConcentration = concentrations [ productName ] ;
@@ -607,7 +613,7 @@ function App() {
607613
608614 const handleFinishInputConcentrationChange = (
609615 name : string ,
610- value : number
616+ value : number ,
611617 ) => {
612618 // this is called when the user finishes dragging the slider
613619 // it stores the previous collected data and resets the live data
@@ -631,7 +637,7 @@ function App() {
631637
632638 const handleSwitchView = ( ) => {
633639 setCurrentView ( ( prevView ) =>
634- prevView === ViewType . Lab ? ViewType . Simulation : ViewType . Lab
640+ prevView === ViewType . Lab ? ViewType . Simulation : ViewType . Lab ,
635641 ) ;
636642 } ;
637643
@@ -659,43 +665,43 @@ function App() {
659665 const currentTime = indexToTime (
660666 currentProductConcentrationArray . length ,
661667 timeFactor ,
662- simulationData . timeUnit
668+ simulationData . timeUnit ,
663669 ) ;
664670 const { newArray, index } = insertValueSorted (
665671 recordedReactantConcentrations ,
666- reactantConcentration
672+ reactantConcentration ,
667673 ) ;
668674 setRecordedReactantConcentration ( newArray ) ;
669675 updateArrayInState (
670676 productEquilibriumConcentrations ,
671677 index ,
672678 productConcentration ,
673- setProductEquilibriumConcentrations
679+ setProductEquilibriumConcentrations ,
674680 ) ;
675681 updateArrayInState (
676682 recordedInputConcentration ,
677683 index ,
678684 currentInputConcentration ,
679- setRecordedInputConcentration
685+ setRecordedInputConcentration ,
680686 ) ;
681687 updateArrayInState (
682688 timeToReachEquilibrium ,
683689 index ,
684690 currentTime ,
685- setTimeToReachEquilibrium
691+ setTimeToReachEquilibrium ,
686692 ) ;
687693 const color =
688694 PLOT_COLORS [
689695 getColorIndex (
690696 currentInputConcentration ,
691- simulationData . getMaxConcentration ( currentModule )
697+ simulationData . getMaxConcentration ( currentModule ) ,
692698 )
693699 ] ;
694700 updateArrayInState ( dataColors , index , color , setDataColors ) ;
695701 setEquilibriumFeedbackTimeout (
696702 < >
697703 Great! < CheckCircleOutlined />
698- </ >
704+ </ > ,
699705 ) ;
700706 } ;
701707
0 commit comments