1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-License-Identifier: MIT OR Apache-2.0
//! 2026-09-26: [`Section`], the sidebar's navigation model. The sidebar draws
//! its rows from `Section::ALL` and `subs`, `⇥` steps through the same rows
//! (`App::nav_rows`), and a click maps a sidebar row back to a section
//! (`App::sidebar_click`).
//!
//! Owner: server tui.
//! Invariants: none beyond the types.
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Section {
Main,
Stats,
Network,
Library,
Benchmarks,
Terminal,
Help,
}
impl Section {
pub const ALL: [Section; 7] = [
Section::Main,
Section::Stats,
Section::Network,
Section::Library,
Section::Benchmarks,
Section::Terminal,
Section::Help,
];
pub fn label(self) -> &'static str {
match self {
Section::Main => "Main",
Section::Stats => "Stats",
Section::Network => "Network",
Section::Library => "Library",
Section::Benchmarks => "Benchmarks",
Section::Terminal => "Terminal",
Section::Help => "Help",
}
}
pub fn icon(self) -> &'static str {
match self {
Section::Main => "◆",
Section::Stats => "∿",
Section::Network => "⬡",
Section::Library => "▤",
Section::Benchmarks => "▰",
Section::Terminal => "❯",
Section::Help => "✚",
}
}
/// 2026-09-26: Subsection labels, in sidebar order. The sidebar draws
/// them, a repeated section key cycles through them (`App::jump`), and `⇥`
/// stops on each (`App::nav_rows`).
pub fn subs(self) -> &'static [&'static str] {
match self {
Section::Main => &["Overview", "Kernels"],
Section::Benchmarks => &["Suite", "History"],
Section::Terminal => &["Ops", "Chat"],
Section::Help => &["Guide", "Report Issue"],
Section::Stats | Section::Network | Section::Library => &[],
}
}
}
#[cfg(test)]
#[path = "section_tests.rs"]
mod tests;