@@ -19,8 +19,15 @@ import HelpButton from "../../components/HelpButton";
19
19
import { ExpandLess , ExpandMore } from "@mui/icons-material" ;
20
20
import { ChangeEvent , useState } from "react" ;
21
21
import { getTableHeight } from "../../shared/calculateTableHeights" ;
22
- import { Simulation , SimulationPlot , SimulationRead , SimulationSlider , SubjectGroupRead , UnitRead } from "../../app/backendApi" ;
23
- import { UseFormReset } from "react-hook-form" ;
22
+ import {
23
+ Simulation ,
24
+ SimulationPlot ,
25
+ SimulationRead ,
26
+ SimulationSlider ,
27
+ SubjectGroupRead ,
28
+ UnitRead ,
29
+ } from "../../app/backendApi" ;
30
+ import { Control } from "react-hook-form" ;
24
31
25
32
type SimulationsSidePanelType = {
26
33
portalId : string ;
@@ -30,11 +37,11 @@ type SimulationsSidePanelType = {
30
37
} [ ] ;
31
38
handleAddPlot : ( plot : number ) => void ;
32
39
isSharedWithMe : boolean ;
33
- layoutOptions : { value : string , label : string } [ ] ;
40
+ layoutOptions : { value : string ; label : string } [ ] ;
34
41
layout : string ;
35
42
setLayout : ( layout : string ) => void ;
36
43
plots : SimulationPlot [ ] ;
37
- control : UseFormReset < Simulation > ;
44
+ control : Control < Simulation , any > ;
38
45
units : UnitRead [ ] ;
39
46
simulation : SimulationRead ;
40
47
groups ?: SubjectGroupRead [ ] ;
@@ -45,15 +52,15 @@ type SimulationsSidePanelType = {
45
52
label : string ;
46
53
} [ ] ;
47
54
handleAddSlider : ( slider : number ) => void ;
48
- orderedSliders : SimulationSlider [ ] ;
55
+ orderedSliders : ( SimulationSlider & { fieldArrayIndex : number } ) [ ] ;
49
56
handleChangeSlider : ( variable : number , value : number ) => void ;
50
- handleRemoveSlider : ( index : number ) => void ;
51
- handleSaveSlider : ( slider : SimulationSlider ) => void ;
57
+ handleRemoveSlider : ( index : number ) => ( ) => void ;
58
+ handleSaveSlider : ( slider : SimulationSlider ) => ( value : number ) => void ;
52
59
exportSimulation : ( ) => void ;
53
60
showReference : boolean ;
54
61
setShowReference : ( reference : boolean ) => void ;
55
62
shouldShowLegend : boolean ;
56
- setShouldShowLegend : ( value : boolean ) => void
63
+ setShouldShowLegend : ( value : boolean ) => void ;
57
64
} ;
58
65
59
66
const ButtonSx = {
@@ -73,31 +80,31 @@ const ButtonSx = {
73
80
74
81
const SidePanelSteps = [
75
82
{
76
- minHeight : " 1100" ,
83
+ minHeight : 1100 ,
77
84
tableHeight : "75vh" ,
78
85
} ,
79
86
{
80
- minHeight : " 1000" ,
87
+ minHeight : 1000 ,
81
88
tableHeight : "72vh" ,
82
89
} ,
83
90
{
84
- minHeight : " 900" ,
91
+ minHeight : 900 ,
85
92
tableHeight : "70vh" ,
86
93
} ,
87
94
{
88
- minHeight : " 800" ,
95
+ minHeight : 800 ,
89
96
tableHeight : "65vh" ,
90
97
} ,
91
98
{
92
- minHeight : " 700" ,
99
+ minHeight : 700 ,
93
100
tableHeight : "60vh" ,
94
101
} ,
95
102
{
96
- minHeight : " 600" ,
103
+ minHeight : 600 ,
97
104
tableHeight : "55vh" ,
98
105
} ,
99
106
{
100
- minHeight : " 500" ,
107
+ minHeight : 500 ,
101
108
tableHeight : "53vh" ,
102
109
} ,
103
110
] ;
@@ -127,7 +134,7 @@ export const SimulationsSidePanel = ({
127
134
showReference,
128
135
setShowReference,
129
136
shouldShowLegend,
130
- setShouldShowLegend
137
+ setShouldShowLegend,
131
138
} : SimulationsSidePanelType ) => {
132
139
const portalRoot = document . getElementById ( portalId ) ;
133
140
const [ collapseLayout , setCollapseLayout ] = useState ( true ) ;
0 commit comments