@@ -29,14 +29,30 @@ export default {
2929 wind . height = "7.5vh" ;
3030 wind . width = "100vw" ;
3131
32+ const root = document . createElement ( "div" ) ;
33+ root . style . display = "flex" ;
34+ root . style . height = "100%" ;
35+ root . style . width = "100%" ;
36+ root . style . justifyContent = "space-between" ;
37+
38+ wind . dom . appendChild ( root ) ;
39+
3240 const buttons = document . createElement ( "div" ) ;
3341 buttons . style . display = "flex" ;
3442 buttons . style . height = "100%" ;
3543 buttons . style . alignItems = "center" ;
3644 buttons . style . gap = "1vh" ;
3745 buttons . style . padding = "0 1vh" ;
3846
39- wind . dom . appendChild ( buttons ) ;
47+ const icons = document . createElement ( "div" ) ;
48+ icons . style . display = "flex" ;
49+ icons . style . height = "100%" ;
50+ icons . style . alignItems = "center" ;
51+ icons . style . gap = "1vh" ;
52+ icons . style . padding = "0 1vh" ;
53+
54+ root . appendChild ( buttons ) ;
55+ root . appendChild ( icons ) ;
4056
4157 const fsedit_button = document . createElement ( "button" ) ;
4258 fsedit_button . innerText = "FSEdit" ;
@@ -69,6 +85,30 @@ export default {
6985 buttons . appendChild ( mc_button ) ;
7086 }
7187
88+ // add icon to reflect network status
89+ const net_manager = kernel . get_network_manager ( ) ;
90+ const net_icon = document . createElement ( "span" ) ;
91+ net_icon . style . height = "3vh" ;
92+ net_icon . style . width = "3vh" ;
93+ net_icon . style . fontSize = "3vh" ;
94+ net_icon . style . display = "flex" ;
95+ net_icon . style . justifyContent = "center" ;
96+ net_icon . style . alignItems = "center" ;
97+
98+ const is_up = await net_manager . is_up ( ) ;
99+ net_icon . style . color = is_up ? "green" : "red" ;
100+ net_icon . innerText = is_up ? "🌐︎" : "🔌︎" ;
101+ net_icon . title = is_up ? "Online" : "Offline" ;
102+
103+ // update when status changes
104+ process . network_add_manager_listener ( "state_change" , ( now_up ) => {
105+ net_icon . style . color = now_up ? "green" : "red" ;
106+ net_icon . innerText = now_up ? "🌐︎" : "🔌︎" ;
107+ net_icon . title = now_up ? "Online" : "Offline" ;
108+ } ) ;
109+
110+ icons . appendChild ( net_icon ) ;
111+
72112 wind . show ( ) ;
73113
74114 process . detach ( ) ;
0 commit comments