File tree Expand file tree Collapse file tree 6 files changed +13
-40
lines changed Expand file tree Collapse file tree 6 files changed +13
-40
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,8 @@ export default class ServerTab extends Tab {
59
59
}
60
60
61
61
updateBadge ( count : number ) : void {
62
- if ( count > 0 ) {
63
- const formattedCount = count > 999 ? "1K+" : count . toString ( ) ;
64
- this . $badge . textContent = formattedCount ;
65
- this . $badge . classList . add ( "active" ) ;
66
- } else {
67
- this . $badge . classList . remove ( "active" ) ;
68
- }
62
+ this . $badge . textContent = count > 999 ? "1K+" : count . toString ( ) ;
63
+ this . $badge . classList . toggle ( "active" , count > 0 ) ;
69
64
}
70
65
71
66
generateShortcutText ( ) : string {
Original file line number Diff line number Diff line change @@ -206,11 +206,7 @@ export default class WebView {
206
206
}
207
207
208
208
// To show or hide the loading indicator in the the active tab
209
- if ( this . loading ) {
210
- this . $webviewsContainer . remove ( "loaded" ) ;
211
- } else {
212
- this . $webviewsContainer . add ( "loaded" ) ;
213
- }
209
+ this . $webviewsContainer . toggle ( "loaded" , ! this . loading ) ;
214
210
215
211
this . $el . classList . add ( "active" ) ;
216
212
this . focus ( ) ;
@@ -293,11 +289,7 @@ export default class WebView {
293
289
const $backButton = document . querySelector (
294
290
"#actions-container #back-action" ,
295
291
) ! ;
296
- if ( this . getWebContents ( ) . canGoBack ( ) ) {
297
- $backButton . classList . remove ( "disable" ) ;
298
- } else {
299
- $backButton . classList . add ( "disable" ) ;
300
- }
292
+ $backButton . classList . toggle ( "disable" , ! this . getWebContents ( ) . canGoBack ( ) ) ;
301
293
}
302
294
303
295
forward ( ) : void {
Original file line number Diff line number Diff line change @@ -699,13 +699,8 @@ export class ServerManagerView {
699
699
}
700
700
701
701
showLoading ( loading : boolean ) : void {
702
- if ( ! loading ) {
703
- this . $reloadButton . removeAttribute ( "style" ) ;
704
- this . $loadingIndicator . style . display = "none" ;
705
- } else if ( loading ) {
706
- this . $reloadButton . style . display = "none" ;
707
- this . $loadingIndicator . removeAttribute ( "style" ) ;
708
- }
702
+ this . $reloadButton . classList . toggle ( "hidden" , loading ) ;
703
+ this . $loadingIndicator . classList . toggle ( "hidden" , ! loading ) ;
709
704
}
710
705
711
706
async destroyTab ( name : string , index : number ) : Promise < void > {
@@ -772,11 +767,7 @@ export class ServerManagerView {
772
767
}
773
768
774
769
toggleSidebar ( show : boolean ) : void {
775
- if ( show ) {
776
- this . $sidebar . classList . remove ( "sidebar-hide" ) ;
777
- } else {
778
- this . $sidebar . classList . add ( "sidebar-hide" ) ;
779
- }
770
+ this . $sidebar . classList . toggle ( "sidebar-hide" , ! show ) ;
780
771
}
781
772
782
773
// Toggles the dnd button icon.
Original file line number Diff line number Diff line change @@ -58,10 +58,9 @@ export function initFindAccounts(props: FindAccountsProps): void {
58
58
} ) ;
59
59
60
60
$serverUrlField . addEventListener ( "input" , ( ) => {
61
- if ( $serverUrlField . value ) {
62
- $serverUrlField . classList . remove ( "invalid-input-value" ) ;
63
- } else {
64
- $serverUrlField . classList . add ( "invalid-input-value" ) ;
65
- }
61
+ $serverUrlField . classList . toggle (
62
+ "invalid-input-value" ,
63
+ $serverUrlField . value === "" ,
64
+ ) ;
66
65
} ) ;
67
66
}
Original file line number Diff line number Diff line change @@ -83,11 +83,7 @@ export function initNetworkSection({$root}: NetworkSectionProps): void {
83
83
} ) ;
84
84
85
85
function toggleManualProxySettings ( option : boolean ) : void {
86
- if ( option ) {
87
- $manualProxyBlock . classList . remove ( "hidden" ) ;
88
- } else {
89
- $manualProxyBlock . classList . add ( "hidden" ) ;
90
- }
86
+ $manualProxyBlock . classList . toggle ( "hidden" , ! option ) ;
91
87
}
92
88
93
89
function updateProxyOption ( ) : void {
Original file line number Diff line number Diff line change 30
30
< i class ="material-icons md-48 "> notifications</ i >
31
31
< span id ="dnd-tooltip " style ="display: none "> Do Not Disturb</ span >
32
32
</ div >
33
- < div class ="action-button " id ="reload-action ">
33
+ < div class ="action-button hidden " id ="reload-action ">
34
34
< i class ="material-icons md-48 "> refresh</ i >
35
35
< span id ="reload-tooltip " style ="display: none "> Reload</ span >
36
36
</ div >
You can’t perform that action at this time.
0 commit comments