Skip to content

Commit dba2f59

Browse files
committed
bulb: Tweaked styles for sidebar labels
1 parent 6f80f8a commit dba2f59

4 files changed

Lines changed: 16 additions & 32 deletions

File tree

bulb/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
<option id="opt_system" class="no-display" value="system_attribute">📃 System</option>
5555
<option id="opt_toll_zone" class="no-display" value="tag_reader">🏷️ Tag Reader</option>
5656
</select>
57-
<label id="sb_monitor" class="sb_label">📺 </label>
58-
<label id="sb_notify" class="sb_label"> </label>
57+
<label id="sb_monitor" class="sb_label">📺</label>
58+
<label id="sb_notify" class="sb_label"></label>
5959
<input id="sb_fullscreen" class="toggle" type="checkbox" aria-label="Toggle fullscreen">
6060
<label for="sb_fullscreen"></label>
6161
</div>

bulb/src/sse.rs

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::app::{self, DeferredAction};
1414
use crate::fetch::Uri;
1515
use crate::start::handle_notification;
1616
use crate::util::Doc;
17-
use hatmil::{Page, html};
1817
use js_sys::JsString;
1918
use resources::Res;
2019
use std::cell::RefCell;
@@ -33,8 +32,8 @@ pub enum NotifyState {
3332
Connecting,
3433
/// Updating after event receipt
3534
Updating,
36-
/// Good / connected
37-
Good,
35+
/// Connected to SSE server
36+
Connected,
3837
}
3938

4039
impl NotifyState {
@@ -45,30 +44,9 @@ impl NotifyState {
4544
Self::Disconnected => "⚫",
4645
Self::Connecting => "🟠",
4746
Self::Updating => "🟡",
48-
Self::Good => "🟢",
47+
Self::Connected => "🟢",
4948
}
5049
}
51-
52-
/// Get description of a state
53-
pub const fn description(self) -> &'static str {
54-
match self {
55-
Self::Starting => "Starting",
56-
Self::Disconnected => "Disconnected",
57-
Self::Connecting => "Connecting",
58-
Self::Updating => "Updating",
59-
Self::Good => "Good",
60-
}
61-
}
62-
63-
/// Build state HTML
64-
pub fn build_html(self) -> String {
65-
let mut page = Page::new();
66-
let mut div = page.frag::<html::Div>();
67-
div.class("tooltip").cdata(self.symbol());
68-
div.span().class("right").cdata(self.description()).close();
69-
div.cdata(" ");
70-
String::from(page)
71-
}
7250
}
7351

7452
/// SSE event listener
@@ -178,7 +156,7 @@ fn build_list(res: Option<Res>) -> String {
178156
/// Set refresh button text
179157
pub fn set_notify_state(ns: NotifyState) {
180158
let sb_notify = Doc::get().elem::<HtmlElement>("sb_notify");
181-
sb_notify.set_inner_html(&ns.build_html());
159+
sb_notify.set_inner_html(&ns.symbol());
182160
if NotifyState::Disconnected == ns {
183161
app::defer_action(DeferredAction::MakeEventSource, 5000);
184162
}
@@ -194,5 +172,8 @@ fn handle_notify(payload: JsString) {
194172
let name = chan.find('$').map(|i| chan.split_off(i));
195173
handle_notification(chan, name);
196174
}
197-
app::defer_action(DeferredAction::SetNotifyState(NotifyState::Good), 600);
175+
app::defer_action(
176+
DeferredAction::SetNotifyState(NotifyState::Connected),
177+
600,
178+
);
198179
}

bulb/src/videomonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl VideoMonitor {
152152
fn set_selected(&self) {
153153
app::set_mon_num(Some(self.mon_num));
154154
let mon_num = match app::mon_num() {
155-
Some(num) => format!("📺 #{num} "),
155+
Some(num) => format!("📺 #{num}"),
156156
None => "📺".to_string(),
157157
};
158158
let t = Doc::get().elem::<HtmlElement>("sb_monitor");

bulb/static/bulb.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ th, td {
122122
border: 1px solid #888;
123123
border-radius: 0.2rem;
124124
padding: 0.3rem;
125-
text-indent: 0;
125+
text-indent: unset;
126126
color: black;
127127
cursor: pointer;
128128
}
@@ -203,9 +203,12 @@ label:has(+ #sb_resource) {
203203
margin-left: 0.1rem;
204204
}
205205
.sb_label {
206+
text-indent: unset;
206207
color: black;
207208
background-color: #888;
208209
align-content: center;
210+
margin: 0.1rem;
211+
padding: 0.2rem;
209212
border-radius: 0.5rem;
210213
}
211214
#sb_search {
@@ -603,7 +606,7 @@ label:has(+ #sb_resource) {
603606
.signal-housing {
604607
align-self: start;
605608
background-color: black;
606-
text-indent: 0;
609+
text-indent: unset;
607610
padding: 0.2rem 0.2rem 0 0.2rem;
608611
border-radius: 0.2rem;
609612
border: 1px solid black;

0 commit comments

Comments
 (0)