@@ -9,77 +9,66 @@ import * as VersionHistoryModal from "../modals/version-history";
99import { envConfig } from "virtual:env-config" ;
1010import { COMPATIBILITY_CHECK } from "@monkeytype/contracts" ;
1111import { lastSeenServerCompatibility } from "../ape/adapters/ts-rest-adapter" ;
12+ import { qs } from "../utils/dom" ;
1213
13- document
14- . querySelector ( "footer #commandLineMobileButton" )
15- ?. addEventListener ( "click" , async ( ) => {
16- Commandline . show ( {
17- singleListOverride : false ,
18- } ) ;
14+ qs ( "footer #commandLineMobileButton" ) ?. on ( "click" , async ( ) => {
15+ Commandline . show ( {
16+ singleListOverride : false ,
1917 } ) ;
18+ } ) ;
2019
21- document
22- . querySelector ( "footer #newVersionIndicator" )
23- ?. addEventListener ( "click" , ( e ) => {
24- e . stopPropagation ( ) ;
25- document . querySelector ( "#newVersionIndicator" ) ?. classList . add ( "hidden" ) ;
26- } ) ;
20+ qs ( "footer #newVersionIndicator" ) ?. on ( "click" , ( e ) => {
21+ e . stopPropagation ( ) ;
22+ qs ( "#newVersionIndicator" ) ?. hide ( ) ;
23+ } ) ;
2724
28- document
29- . querySelector ( "footer .currentVersion" )
30- ?. addEventListener ( "click" , ( e ) => {
31- const event = e as MouseEvent ;
32- if ( event . shiftKey ) {
33- alert (
34- JSON . stringify (
35- {
36- clientVersion : envConfig . clientVersion ,
37- clientCompatibility : COMPATIBILITY_CHECK ,
38- lastSeenServerCompatibility,
39- } ,
40- null ,
41- 2 ,
42- ) ,
43- ) ;
44- } else {
45- VersionHistoryModal . show ( ) ;
46- }
47- } ) ;
25+ qs ( "footer .currentVersion" ) ?. on ( "click" , ( e ) => {
26+ const event = e as MouseEvent ;
27+ if ( event . shiftKey ) {
28+ alert (
29+ JSON . stringify (
30+ {
31+ clientVersion : envConfig . clientVersion ,
32+ clientCompatibility : COMPATIBILITY_CHECK ,
33+ lastSeenServerCompatibility,
34+ } ,
35+ null ,
36+ 2 ,
37+ ) ,
38+ ) ;
39+ } else {
40+ VersionHistoryModal . show ( ) ;
41+ }
42+ } ) ;
4843
49- document
50- . querySelector ( "footer .right .current-theme" )
51- ?. addEventListener ( "click" , async ( event ) => {
52- const e = event as MouseEvent ;
53- if ( e . shiftKey ) {
54- if ( Config . customTheme ) {
55- setConfig ( "customTheme" , false ) ;
56- return ;
57- }
58- if (
59- isAuthenticated ( ) &&
60- ( DB . getSnapshot ( ) ?. customThemes ?. length ?? 0 ) < 1
61- ) {
62- Notifications . add ( "No custom themes!" , 0 ) ;
63- setConfig ( "customTheme" , false ) ;
64- return ;
65- }
66- setConfig ( "customTheme" , true ) ;
67- } else {
68- const subgroup = Config . customTheme ? "customTheme" : "themes" ;
69- Commandline . show ( {
70- subgroupOverride : subgroup ,
71- } ) ;
44+ qs ( "footer .right .current-theme" ) ?. on ( "click" , async ( event ) => {
45+ const e = event as MouseEvent ;
46+ if ( e . shiftKey ) {
47+ if ( Config . customTheme ) {
48+ setConfig ( "customTheme" , false ) ;
49+ return ;
7250 }
73- } ) ;
51+ if (
52+ isAuthenticated ( ) &&
53+ ( DB . getSnapshot ( ) ?. customThemes ?. length ?? 0 ) < 1
54+ ) {
55+ Notifications . add ( "No custom themes!" , 0 ) ;
56+ setConfig ( "customTheme" , false ) ;
57+ return ;
58+ }
59+ setConfig ( "customTheme" , true ) ;
60+ } else {
61+ const subgroup = Config . customTheme ? "customTheme" : "themes" ;
62+ Commandline . show ( {
63+ subgroupOverride : subgroup ,
64+ } ) ;
65+ }
66+ } ) ;
7467
75- document
76- . querySelector ( "footer #supportMeButton" )
77- ?. addEventListener ( "click" , ( ) => {
78- SupportPopup . show ( ) ;
79- } ) ;
68+ qs ( "footer #supportMeButton" ) ?. on ( "click" , ( ) => {
69+ SupportPopup . show ( ) ;
70+ } ) ;
8071
81- document
82- . querySelector ( "footer #contactPopupButton" )
83- ?. addEventListener ( "click" , ( ) => {
84- ContactModal . show ( ) ;
85- } ) ;
72+ qs ( "footer #contactPopupButton" ) ?. on ( "click" , ( ) => {
73+ ContactModal . show ( ) ;
74+ } ) ;
0 commit comments