Update system widget layout with section headers

- Add section headers: CPU, RAM, Storage as plain titles
- Remove status icons from section headers
- Keep status icons only on data lines (Load, Usage, /tmp, filesystems)
- Restore (Single) label for all storage types
- Improve visual hierarchy with clear section separation
This commit is contained in:
Christoffer Martinsson 2025-10-23 19:34:27 +02:00
parent d193b90ba1
commit 997b30a9c0

View File

@ -254,11 +254,7 @@ impl SystemWidget {
_ => "—% —GB/—GB".to_string(), _ => "—% —GB/—GB".to_string(),
}; };
let pool_label = if pool.pool_type.to_lowercase() == "single" { let pool_label = format!("{} ({}):", pool.mount_point, pool.pool_type);
format!("{}:", pool.mount_point)
} else {
format!("{} ({}):", pool.mount_point, pool.pool_type)
};
let pool_spans = StatusIcons::create_status_spans( let pool_spans = StatusIcons::create_status_spans(
pool.status.clone(), pool.status.clone(),
&pool_label &pool_label
@ -421,14 +417,15 @@ impl Widget for SystemWidget {
Span::styled(format!("Agent: {}", short_hash), Typography::secondary()) Span::styled(format!("Agent: {}", short_hash), Typography::secondary())
])); ]));
// Empty line
lines.push(Line::from(vec![Span::raw("")]));
// CPU section // CPU section
lines.push(Line::from(vec![
Span::styled("CPU:", Typography::widget_title())
]));
let load_text = self.format_cpu_load(); let load_text = self.format_cpu_load();
let cpu_spans = StatusIcons::create_status_spans( let cpu_spans = StatusIcons::create_status_spans(
self.cpu_status.clone(), self.cpu_status.clone(),
&format!("CPU: {}", load_text) &format!("Load: {}", load_text)
); );
lines.push(Line::from(cpu_spans)); lines.push(Line::from(cpu_spans));
@ -439,10 +436,14 @@ impl Widget for SystemWidget {
])); ]));
// RAM section // RAM section
lines.push(Line::from(vec![
Span::styled("RAM:", Typography::widget_title())
]));
let memory_text = self.format_memory_usage(); let memory_text = self.format_memory_usage();
let memory_spans = StatusIcons::create_status_spans( let memory_spans = StatusIcons::create_status_spans(
self.memory_status.clone(), self.memory_status.clone(),
&format!("RAM: {}", memory_text) &format!("Usage: {}", memory_text)
); );
lines.push(Line::from(memory_spans)); lines.push(Line::from(memory_spans));
@ -456,10 +457,12 @@ impl Widget for SystemWidget {
)); ));
lines.push(Line::from(tmp_spans)); lines.push(Line::from(tmp_spans));
// Empty line before storage // Storage section
lines.push(Line::from(vec![Span::raw("")])); lines.push(Line::from(vec![
Span::styled("Storage:", Typography::widget_title())
// Storage section with tree structure ]));
// Storage items
lines.extend(self.render_storage()); lines.extend(self.render_storage());
let paragraph = Paragraph::new(Text::from(lines)); let paragraph = Paragraph::new(Text::from(lines));