1- import { Show , createMemo , } from 'solid-js'
1+ import { Show , createMemo } from 'solid-js'
22import { Button , Checkbox , Input , Select } from '@tanstack/devtools-ui'
33import { useDevtoolsSettings } from '../context/use-devtools-context'
44import { uppercaseFirstLetter } from '../utils/sanitize'
@@ -9,19 +9,22 @@ export const SettingsTab = () => {
99 const { setSettings, settings } = useDevtoolsSettings ( )
1010 const styles = useStyles ( )
1111 const hotkey = createMemo ( ( ) => settings ( ) . openHotkey )
12- const modifiers : Array < ModifierKey > = [ " Control" , " Alt" , " Meta" , " Shift" ]
12+ const modifiers : Array < ModifierKey > = [ ' Control' , ' Alt' , ' Meta' , ' Shift' ]
1313 const changeHotkey = ( newHotkey : ModifierKey ) => ( ) => {
1414 if ( hotkey ( ) . includes ( newHotkey ) ) {
1515 return setSettings ( {
16- openHotkey : hotkey ( ) . filter ( key => key !== newHotkey ) ,
17- } ) ;
16+ openHotkey : hotkey ( ) . filter ( ( key ) => key !== newHotkey ) ,
17+ } )
1818 }
19- const existingModifiers = hotkey ( ) . filter ( key => modifiers . includes ( key as any ) ) ;
20- const otherModifiers = hotkey ( ) . filter ( key => ! modifiers . includes ( key as any ) ) ;
19+ const existingModifiers = hotkey ( ) . filter ( ( key ) =>
20+ modifiers . includes ( key as any ) ,
21+ )
22+ const otherModifiers = hotkey ( ) . filter (
23+ ( key ) => ! modifiers . includes ( key as any ) ,
24+ )
2125 setSettings ( {
2226 openHotkey : [ ...existingModifiers , newHotkey , ...otherModifiers ] ,
23- } ) ;
24-
27+ } )
2528 }
2629 return (
2730 < div class = { styles ( ) . settingsContainer } >
@@ -154,40 +157,57 @@ export const SettingsTab = () => {
154157 < div class = { styles ( ) . settingsGroup } >
155158 < div class = { styles ( ) . settingsModifiers } >
156159 < Show keyed when = { hotkey ( ) } >
157- < Button variant = "success" onclick = { changeHotkey ( "Shift" ) } outline = { ! hotkey ( ) . includes ( "Shift" ) } >
160+ < Button
161+ variant = "success"
162+ onclick = { changeHotkey ( 'Shift' ) }
163+ outline = { ! hotkey ( ) . includes ( 'Shift' ) }
164+ >
158165 Shift
159166 </ Button >
160- < Button variant = "success" onclick = { changeHotkey ( "Alt" ) } outline = { ! hotkey ( ) . includes ( "Alt" ) } >
167+ < Button
168+ variant = "success"
169+ onclick = { changeHotkey ( 'Alt' ) }
170+ outline = { ! hotkey ( ) . includes ( 'Alt' ) }
171+ >
161172 Alt
162173 </ Button >
163- < Button variant = "success" onclick = { changeHotkey ( "Meta" ) } outline = { ! hotkey ( ) . includes ( "Meta" ) } >
174+ < Button
175+ variant = "success"
176+ onclick = { changeHotkey ( 'Meta' ) }
177+ outline = { ! hotkey ( ) . includes ( 'Meta' ) }
178+ >
164179 Meta
165180 </ Button >
166- < Button variant = "success" onclick = { changeHotkey ( "Control" ) } outline = { ! hotkey ( ) . includes ( "Control" ) } >
181+ < Button
182+ variant = "success"
183+ onclick = { changeHotkey ( 'Control' ) }
184+ outline = { ! hotkey ( ) . includes ( 'Control' ) }
185+ >
167186 Control
168187 </ Button >
169-
170188 </ Show >
171189 </ div >
172-
173190 < Input
174191 label = "Hotkey to open/close devtools"
175192 description = "Use '+' to combine keys (e.g., 'A+B' or 'D')"
176193 placeholder = "A"
177- value = { hotkey ( ) . filter ( key => ! ( [ "Shift" , "Meta" , "Alt" , "Ctrl" ] . includes ( key ) ) ) . join ( '+' ) }
194+ value = { hotkey ( )
195+ . filter ( ( key ) => ! [ 'Shift' , 'Meta' , 'Alt' , 'Ctrl' ] . includes ( key ) )
196+ . join ( '+' ) }
178197 onChange = { ( e ) =>
179198 setSettings ( {
180199 openHotkey : [
181- ...hotkey ( ) . filter ( key => ( [ "Shift" , "Meta" , "Alt" , "Ctrl" ] . includes ( key ) ) ) ] ,
200+ ...hotkey ( ) . filter ( ( key ) =>
201+ [ 'Shift' , 'Meta' , 'Alt' , 'Ctrl' ] . includes ( key ) ,
202+ ) ,
203+ ] ,
182204 ...e
183205 . split ( '+' )
184206 . map ( ( key ) => uppercaseFirstLetter ( key ) )
185207 . filter ( Boolean ) ,
186-
187208 } )
188209 }
189210 />
190-
191211 Final shortcut is: { hotkey ( ) . join ( ' + ' ) }
192212 </ div >
193213 </ div >
0 commit comments