Skip to content

Commit fbec4a8

Browse files
committed
improve visibility of network status
adding text 'NETWORK OFFLINE' in red when the network is offline
1 parent cf87bb7 commit fbec4a8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

client/uis/infobars.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export class InfoBarsUI {
4646
setInterval(() => this._updateClock(), 1000);
4747

4848
// Populate network icon
49-
this._infoElements.networkIcon.innerHTML = (navigator.onLine ? '🖧' : ''); // Either "three-networked-computers" unicode symbol or nothing
50-
window.addEventListener('online', () => this._infoElements.networkIcon.innerHTML = '🖧');
51-
window.addEventListener('offline', () => this._infoElements.networkIcon.innerHTML = '');
49+
this._infoElements.networkIcon.classList.toggle("offline", !navigator.onLine);
50+
window.addEventListener("online", () => this._infoElements.networkIcon.classList.remove("offline"));
51+
window.addEventListener("offline", () => this._infoElements.networkIcon.classList.add("offline"));
5252
}
5353

5454
private _updateClock(): void {

static/css/styles.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ footer span {
117117
margin: 0 var(--padding);
118118
}
119119

120+
/*
121+
header span.info-network-icon::after {
122+
content: ' ONLINE';
123+
}
124+
*/
125+
126+
header span.info-network-icon.offline {
127+
color: var(--color-text-error);
128+
}
129+
130+
header span.info-network-icon.offline::after {
131+
content: ' COMPUTER OFFLINE';
132+
}
133+
120134
#info-debug {
121135
color: var(--color-text-error);
122136
}

0 commit comments

Comments
 (0)