Whale always patrols bottom row, not just during scans

This commit is contained in:
2026-05-31 20:27:00 +02:00
parent 64733130e2
commit c8d5ca548d
+19 -25
View File
@@ -38,6 +38,7 @@ pub struct AppState {
/// Spinner state
pub spinner_active: bool,
pub spinner_start: Option<Instant>,
pub whale_start: Instant,
}
#[derive(Clone, Copy, PartialEq)]
@@ -63,6 +64,7 @@ impl Default for AppState {
status_style: StatusStyle::Neutral,
spinner_active: false,
spinner_start: None,
whale_start: Instant::now(),
}
}
}
@@ -123,12 +125,8 @@ pub fn draw_main_menu(f: &mut Frame, state: &mut ListState, app: &AppState, save
let prompt = "↑/↓ navigate Enter select";
draw_select_list(f, chunks[2], &items, &descs, prompt, state);
// Whale patrols the status bar when spinner is active
if app.spinner_active {
draw_whale_separator(f, chunks[3], app);
} else {
draw_status_bar(f, chunks[3], app);
}
// Whale always patrols the bottom row
draw_whale_separator(f, chunks[3], app);
}
/// Draw the disclaimer popup with full warning text.
@@ -616,25 +614,21 @@ fn draw_whale_separator(f: &mut Frame, area: Rect, app: &AppState) {
Paragraph::new(Span::styled(sep, Style::default().fg(Color::DarkGray))),
area,
);
if app.spinner_active {
if let Some(start) = app.spinner_start {
let elapsed = start.elapsed().as_millis() as u64;
let bar_w = area.width as u64;
let speed_ms: u64 = 60;
let cooldown_ticks: u64 = 166;
let total = bar_w + cooldown_ticks;
let t = (elapsed / speed_ms) % total;
if t < bar_w {
let x = bar_w - t - 1;
let switch = ((elapsed / 400) * 7 + (elapsed / 600) * 13) % 2;
let variants: &[&str] = &["🐋", "🐳"];
let whale = variants[(switch % variants.len() as u64) as usize];
f.render_widget(
Paragraph::new(Span::styled(whale, Style::default().fg(Color::Cyan))),
Rect { x: area.x + (x as u16), y: area.y, width: 4, height: 1 },
);
}
}
let elapsed = app.whale_start.elapsed().as_millis() as u64;
let bar_w = area.width as u64;
let speed_ms: u64 = 60;
let cooldown_ticks: u64 = 166;
let total = bar_w + cooldown_ticks;
let t = (elapsed / speed_ms) % total;
if t < bar_w {
let x = bar_w - t - 1;
let switch = ((elapsed / 400) * 7 + (elapsed / 600) * 13) % 2;
let variants: &[&str] = &["🐋", "🐳"];
let whale = variants[(switch % variants.len() as u64) as usize];
f.render_widget(
Paragraph::new(Span::styled(whale, Style::default().fg(Color::Cyan))),
Rect { x: area.x + (x as u16), y: area.y, width: 4, height: 1 },
);
}
}