1- import { Checkbox , Switch } from '@blueprintjs/core' ;
1+ import { Switch } from '@blueprintjs/core' ;
22import type { NMRiumPanelPreferences } from '@zakodium/nmrium-core' ;
33import { useCallback , useMemo } from 'react' ;
44import { Controller , useFormContext } from 'react-hook-form' ;
@@ -18,7 +18,7 @@ interface ListItem {
1818 hideOpenOption ?: boolean ;
1919}
2020
21- type PanelStatus = 'hidden' | 'available' | 'active' ;
21+ type PanelStatus = 'hidden' | 'available' | 'active' | 'open' ;
2222interface PanelStatusItem {
2323 label : string ;
2424 value : PanelStatus ;
@@ -33,6 +33,10 @@ const PANEL_STATUS: PanelStatusItem[] = [
3333 label : 'Available' ,
3434 value : 'available' ,
3535 } ,
36+ {
37+ label : 'Open' ,
38+ value : 'open' ,
39+ } ,
3640 {
3741 label : 'Active' ,
3842 value : 'active' ,
@@ -108,6 +112,7 @@ function DisplayTabContent() {
108112 ( panelName : keyof NMRiumPanelPreferences , status : PanelStatus ) => {
109113 let visible = false ;
110114 let display = false ;
115+ let open = false ;
111116
112117 if ( status === 'available' ) {
113118 visible = true ;
@@ -117,7 +122,13 @@ function DisplayTabContent() {
117122 visible = true ;
118123 display = true ;
119124 }
125+ if ( status === 'open' ) {
126+ visible = true ;
127+ display = true ;
128+ open = true ;
129+ }
120130
131+ setValue ( `${ basePath } .${ panelName } .open` , open ) ;
121132 setValue ( `${ basePath } .${ panelName } .display` , display ) ;
122133 setValue ( `${ basePath } .${ panelName } .visible` , visible ) ;
123134 } ,
@@ -172,19 +183,8 @@ function DisplayTabContent() {
172183 />
173184 ) ,
174185 } ,
175- {
176- index : 4 ,
177- Header : 'Open on load' ,
178- style : { textAlign : 'center' } ,
179- Cell : ( { row } ) => (
180- < Checkbox
181- style = { { margin : 0 } }
182- { ...register ( `${ basePath } .${ row . original . name } .open` ) }
183- />
184- ) ,
185- } ,
186186 ] ,
187- [ control , onChange , register ] ,
187+ [ control , onChange ] ,
188188 ) ;
189189
190190 return (
0 commit comments