system settings
git clone https://git.lucas.co/cce-system-interface.git
fix: render the ctrl-nav section highlight on Accounts and Storage
Both pages took the focus flags as `_sec_focused` and passed a hardcoded `false`
as each section's focused argument, so ctrl+j/k moved the app-side section index
with nothing on screen to show for it — ctrl-nav was invisible on exactly these
two of the fourteen pages (noted as an open NB in the 6w RFC entry).
Threads `sec_focused` through each page's free `view()` — the same shape the
other twelve pages already use — and indexes it per section: storage's three
add_section calls take flags 0/1/2, accounts' single add_section_spanned takes
flag 0. Both section counts already matched what `section_widgets()` reports, so
no group bookkeeping changed.
Live-verified by injected ctrl+j: storage cycles the highlight Local Storage ->
Memory on successive presses; accounts highlights its one section (pixel-diffed
rather than eyeballed — 42513 changed pixels distributed as a rectangle outline,
dense at the well's top and bottom edges and constant down the sides).
Co-Authored-By: Claude Opus 5 <[email protected]>
src/pages/accounts.rs | 8 ++++----
src/pages/storage.rs | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/pages/accounts.rs b/src/pages/accounts.rs
index e1094e8..e02677e 100644
--- a/src/pages/accounts.rs
+++ b/src/pages/accounts.rs
@@ -352,7 +352,7 @@ const ACCENT_BG: [f32; 4] = [0.20, 0.40, 0.65, 0.35];
const TEXT_BTN: [f32; 4] = [0.90, 0.90, 0.95, 1.0];
const TEXT_DANGER: [f32; 4] = [0.95, 0.55, 0.55, 1.0];
-pub fn view(state: &mut AccountsState, cx: f32, cy: f32, cw: f32, ch: f32, layout: &mut dyn LayoutStrategy, ctx: &mut cce_ui::context::UiContext) -> PageContent {
+pub fn view(state: &mut AccountsState, cx: f32, cy: f32, cw: f32, ch: f32, sec_focused: &[bool], layout: &mut dyn LayoutStrategy, ctx: &mut cce_ui::context::UiContext) -> PageContent {
let mut final_pc = PageContent::new();
let sec_w = 320.0f32;
let mut builder = PageLayoutBuilder::new(layout, cx, cy, cw, ch, sec_w).with_section_count(1);
@@ -361,7 +361,7 @@ pub fn view(state: &mut AccountsState, cx: f32, cy: f32, cw: f32, ch: f32, layou
let widget_h = cce_ui::layout::spinbox_height();
let btn_h = 26.0;
- builder.add_section_spanned(&mut final_pc, "", 1, false, |sec| {
+ builder.add_section_spanned(&mut final_pc, "", 1, sec_focused.first().copied().unwrap_or(false), |sec| {
if !state.loaded {
sec.text("Loading online accounts...", 12.0, 0.0, 12.0, TEXT_DIM);
return;
@@ -727,11 +727,11 @@ impl crate::pages::AppPage for AccountsState {
cw: f32,
ch: f32,
_root_focused: bool,
- _sec_focused: &[bool],
+ sec_focused: &[bool],
layout: &mut dyn cce_ui::layout::LayoutStrategy,
ctx: &mut cce_ui::context::UiContext,
) -> crate::app::PageContent {
- view(self, cx, cy, cw, ch, layout, ctx)
+ view(self, cx, cy, cw, ch, sec_focused, layout, ctx)
}
fn propagate_widget_changes(&mut self, _actions: &mut Vec<crate::app::AppAction>) {
diff --git a/src/pages/storage.rs b/src/pages/storage.rs
index 0c00000..fa90e6d 100644
--- a/src/pages/storage.rs
+++ b/src/pages/storage.rs
@@ -170,13 +170,13 @@ const BTN_HOVER: [f32; 4] = [0.28, 0.50, 0.78, 1.0];
const BTN_DISABLED: [f32; 4] = [0.15, 0.18, 0.22, 1.0];
const WHITE: [f32; 4] = [1.0, 1.0, 1.0, 1.0];
-pub fn view(state: &StorageState, cx: f32, cy: f32, cw: f32, ch: f32, layout: &mut dyn LayoutStrategy, ctx: &mut cce_ui::context::UiContext) -> PageContent {
+pub fn view(state: &StorageState, cx: f32, cy: f32, cw: f32, ch: f32, sec_focused: &[bool], layout: &mut dyn LayoutStrategy, ctx: &mut cce_ui::context::UiContext) -> PageContent {
let mut final_pc = PageContent::new();
let sec_w = 320.0f32;
let mut builder = PageLayoutBuilder::new(layout, cx, cy, cw, ch, sec_w).with_section_count(3);
// Section 1: Local Storage
- builder.add_section(&mut final_pc, "Local Storage", false, |sec| {
+ builder.add_section(&mut final_pc, "Local Storage", sec_focused.first().copied().unwrap_or(false), |sec| {
let sec_w = sec.cw;
if !state.loaded {
sec.text("Loading storage usage...", 12.0, 0.0, 12.0, TEXT_FG);
@@ -203,7 +203,7 @@ pub fn view(state: &StorageState, cx: f32, cy: f32, cw: f32, ch: f32, layout: &m
});
// Section 2: Memory
- builder.add_section(&mut final_pc, "Memory", false, |sec| {
+ builder.add_section(&mut final_pc, "Memory", sec_focused.get(1).copied().unwrap_or(false), |sec| {
let sec_w = sec.cw;
if !state.loaded {
sec.text("Loading memory usage...", 12.0, 0.0, 12.0, TEXT_FG);
@@ -230,7 +230,7 @@ pub fn view(state: &StorageState, cx: f32, cy: f32, cw: f32, ch: f32, layout: &m
});
// Section 2: Full System Backup
- builder.add_section(&mut final_pc, "Full System Backup", false, |sec| {
+ builder.add_section(&mut final_pc, "Full System Backup", sec_focused.get(2).copied().unwrap_or(false), |sec| {
if !state.backup_loaded {
sec.text("Loading backup state...", 12.0, 0.0, 12.0, TEXT_DIM);
} else {
@@ -321,11 +321,11 @@ impl crate::pages::AppPage for StorageState {
cw: f32,
ch: f32,
_root_focused: bool,
- _sec_focused: &[bool],
+ sec_focused: &[bool],
layout: &mut dyn LayoutStrategy,
ctx: &mut cce_ui::context::UiContext,
) -> crate::app::PageContent {
- view(self, cx, cy, cw, ch, layout, ctx)
+ view(self, cx, cy, cw, ch, sec_focused, layout, ctx)
}
fn propagate_widget_changes(&mut self, _actions: &mut Vec<crate::app::AppAction>) {}