File tree Expand file tree Collapse file tree 3 files changed +46
-37
lines changed
Expand file tree Collapse file tree 3 files changed +46
-37
lines changed Original file line number Diff line number Diff line change @@ -4,23 +4,14 @@ import { getFocus } from "../../../signals/core";
44import { showModal } from "../../../stores/modals" ;
55import { Button } from "../../common/Button" ;
66
7+ import { Keytips } from "./Keytips" ;
78import { ThemeIndicator } from "./ThemeIndicator" ;
89import { VersionButton } from "./VersionButton" ;
910
1011export function Footer ( ) : JSXElement {
1112 return (
1213 < footer class = "text-sub relative text-xs" >
13- < div
14- class = "mb-8 text-center leading-loose transition-opacity"
15- classList = { {
16- "opacity-0" : getFocus ( ) ,
17- } }
18- >
19- < kbd > tab</ kbd > and < kbd > enter</ kbd > - restart test
20- < br />
21- < kbd > ctrl/cmd</ kbd > + < kbd > shift</ kbd > + < kbd > p</ kbd > or < kbd > esc</ kbd > { " " }
22- - command line
23- </ div >
14+ < Keytips />
2415
2516 < div
2617 class = "-m-2 flex justify-between gap-8 transition-opacity"
Original file line number Diff line number Diff line change 1+ import { JSXElement , Show } from "solid-js" ;
2+
3+ import { getConfig } from "../../../signals/config" ;
4+ import { getFocus } from "../../../signals/core" ;
5+ import { Conditional } from "../../common/Conditional" ;
6+
7+ export function Keytips ( ) : JSXElement {
8+ const userAgent = window . navigator . userAgent . toLowerCase ( ) ;
9+ const modifierKey =
10+ userAgent . includes ( "mac" ) && ! userAgent . includes ( "firefox" )
11+ ? "cmd"
12+ : "ctrl" ;
13+
14+ const commandKey = ( ) : string =>
15+ getConfig . quickRestart === "esc" ? "tab" : "esc" ;
16+
17+ return (
18+ < Show when = { getConfig . showKeyTips } >
19+ < div
20+ class = "mb-8 text-center leading-loose transition-opacity"
21+ classList = { {
22+ "opacity-0" : getFocus ( ) ,
23+ } }
24+ >
25+ < Conditional
26+ if = { getConfig . quickRestart === "off" }
27+ then = {
28+ < >
29+ < kbd > tab</ kbd > + < kbd > enter</ kbd > - restart test
30+ </ >
31+ }
32+ else = {
33+ < >
34+ < kbd > { getConfig . quickRestart } </ kbd > - restart test
35+ </ >
36+ }
37+ />
38+ < br />
39+ < kbd > { commandKey ( ) } </ kbd > or < kbd > { modifierKey } </ kbd > + < kbd > shift</ kbd > { " " }
40+ + < kbd > p</ kbd > - command line
41+ </ div >
42+ </ Show >
43+ ) ;
44+ }
Original file line number Diff line number Diff line change @@ -43,23 +43,6 @@ export function setMediaQueryDebugLevel(level: number): void {
4343 }
4444}
4545
46- function updateKeytips ( ) : void {
47- const userAgent = window . navigator . userAgent . toLowerCase ( ) ;
48- const modifierKey =
49- userAgent . includes ( "mac" ) && ! userAgent . includes ( "firefox" )
50- ? "cmd"
51- : "ctrl" ;
52-
53- const commandKey = Config . quickRestart === "esc" ? "tab" : "esc" ;
54- qs ( "footer .keyTips" ) ?. setHtml ( `
55- ${
56- Config . quickRestart === "off"
57- ? "<kbd>tab</kbd> + <kbd>enter</kbd>"
58- : `<kbd>${ Config . quickRestart } </kbd>`
59- } - restart test<br>
60- <kbd>${ commandKey } </kbd> or <kbd>${ modifierKey } </kbd> + <kbd>shift</kbd> + <kbd>p</kbd> - command line` ) ;
61- }
62-
6346if ( isDevEnvironment ( ) ) {
6447 qs ( "header #logo .top" ) ?. setText ( "localhost" ) ;
6548 qs ( "head title" ) ?. setText (
@@ -124,15 +107,6 @@ createEffect(() => {
124107} ) ;
125108
126109ConfigEvent . subscribe ( async ( { key } ) => {
127- if ( key === "quickRestart" ) updateKeytips ( ) ;
128- if ( key === "showKeyTips" ) {
129- const keyTipsElement = qs ( "footer .keyTips" ) ;
130- if ( Config . showKeyTips ) {
131- keyTipsElement ?. removeClass ( "hidden" ) ;
132- } else {
133- keyTipsElement ?. addClass ( "hidden" ) ;
134- }
135- }
136110 if ( key === "fontFamily" ) {
137111 await applyFontFamily ( ) ;
138112 }
You can’t perform that action at this time.
0 commit comments