Change tree symbols to use secondary text color

Update all tree symbols (└─, ├─) in system and backup widgets to use
Typography::secondary() style instead of raw text for consistent
text coloring throughout the interface.
This commit is contained in:
Christoffer Martinsson 2025-10-23 20:02:49 +02:00
parent b391448d33
commit ecee256f91
3 changed files with 37 additions and 30 deletions

36
TODO.md
View File

@ -10,18 +10,19 @@
## System panel (agent/dashboard)
use following layput:
use following layout:
'''
NixOS:
Build: xxxxxx dd/mm/yy H:M:S
Active users: cm, simon
Build: xxxxxx
Agen: xxxxxx
CPU:
● Load: 0.02 0.31 0.86 • 3000MHz
● Load: 0.02 0.31 0.86
└─ Freq: 3000MHz
RAM:
● Usage: 33% 2.6GB/7.6GB
● /tmp: 0% 0B/2.0GB
└─ ● /tmp: 0% 0B/2.0GB
Storage:
root (Single):
/:
├─ ● nvme0n1 T: 40C • W: 4%
└─ ● 8% 75.0GB/906.2GB
'''
@ -29,14 +30,35 @@ Storage:
- Add support to show login/active users
- Add support to show timestamp/version for latest nixos rebuild
## Backup panel (dashboard)
use following layout:
'''
Latest backup:
<timestamp>
└─ Duration: 1.3m
Disk:
● Samsung SSD 870 QVO 1TB
├─ S/N: S5RRNF0W800639Y
└─ Usage: 50.5GB/915.8GB
Repos:
● gitea (4) 5.1GB
● immich (4) 45.0GB
● kryddorten (4) 67.8MB
● mariehall2 (4) 322.7MB
● nixosbox (4) 5.5MB
● unifi (4) 5.7MB
● vaultwarden (4) 508kB
'''
## Keyboard navigation and scrolling (dashboard)
- Add keyboard navigation between panels "Shift-Tab"
- Add lower statusbar with dynamic updated shortcuts when switchng between panels
- Add scrolling support when text do not fit
## Remote execution (agent/dashboard)
- Add lower statusbar with dynamic updated shortcuts when switchng between panels
- Add support for send command via dashboard to agent to do nixos rebuid
- Add support for navigating services in dashboard and trigger start/stop/restart
- Add support for trigger backup

View File

@ -80,21 +80,6 @@ impl BackupWidget {
}
/// Format duration for display
fn format_duration(&self) -> String {
match self.duration_seconds {
Some(seconds) => {
if seconds >= 3600 {
format!("{:.1}h", seconds as f32 / 3600.0)
} else if seconds >= 60 {
format!("{:.1}m", seconds as f32 / 60.0)
} else {
format!("{}s", seconds)
}
}
None => "".to_string(),
}
}
/// Format timestamp for display
fn format_last_run(&self) -> String {
@ -363,7 +348,7 @@ impl Widget for BackupWidget {
if let Some(duration) = self.duration_seconds {
let duration_text = self.format_duration(duration);
lines.push(ratatui::text::Line::from(vec![
ratatui::text::Span::raw(" └─ "),
ratatui::text::Span::styled(" └─ ", Typography::secondary()),
ratatui::text::Span::styled(format!("Duration: {}", duration_text), Typography::secondary())
]));
}
@ -384,7 +369,7 @@ impl Widget for BackupWidget {
// Serial number as sub-item
if let Some(serial) = &self.backup_disk_serial_number {
lines.push(ratatui::text::Line::from(vec![
ratatui::text::Span::raw(" ├─ "),
ratatui::text::Span::styled(" ├─ ", Typography::secondary()),
ratatui::text::Span::styled(format!("S/N: {}", serial), Typography::secondary())
]));
}
@ -394,7 +379,7 @@ impl Widget for BackupWidget {
let used_str = Self::format_size_with_proper_units(used);
let total_str = Self::format_size_with_proper_units(total);
lines.push(ratatui::text::Line::from(vec![
ratatui::text::Span::raw(" └─ "),
ratatui::text::Span::styled(" └─ ", Typography::secondary()),
ratatui::text::Span::styled(format!("Usage: {}/{}", used_str, total_str), Typography::secondary())
]));
}

View File

@ -286,7 +286,7 @@ impl SystemWidget {
let mut drive_spans = vec![
Span::raw(" "),
Span::raw(tree_symbol),
Span::styled(tree_symbol, Typography::secondary()),
Span::raw(" "),
];
drive_spans.extend(StatusIcons::create_status_spans(drive.status.clone(), &drive_text));
@ -298,7 +298,7 @@ impl SystemWidget {
let tree_symbol = "└─";
let mut usage_spans = vec![
Span::raw(" "),
Span::raw(tree_symbol),
Span::styled(tree_symbol, Typography::secondary()),
Span::raw(" "),
];
usage_spans.extend(StatusIcons::create_status_spans(pool.status.clone(), &usage_text));
@ -435,7 +435,7 @@ impl Widget for SystemWidget {
let freq_text = self.format_cpu_frequency();
lines.push(Line::from(vec![
Span::raw(" └─ "),
Span::styled(" └─ ", Typography::secondary()),
Span::styled(format!("Freq: {}", freq_text), Typography::secondary())
]));
@ -453,7 +453,7 @@ impl Widget for SystemWidget {
let tmp_text = self.format_tmp_usage();
let mut tmp_spans = vec![
Span::raw(" └─ "),
Span::styled(" └─ ", Typography::secondary()),
];
tmp_spans.extend(StatusIcons::create_status_spans(
self.memory_status.clone(),