Feat: UI / UX fixes

This commit is contained in:
2026-02-26 21:17:53 +01:00
parent f618f47811
commit 6b56655661
20 changed files with 268 additions and 169 deletions

View File

@@ -3,7 +3,7 @@ use std::time::{Duration, Instant};
use cagire_markdown::ParsedMarkdown;
use cagire_ratatui::Sparkles;
use tachyonfx::{fx, Effect, EffectManager, Interpolation};
use tachyonfx::{fx, Effect, EffectManager, Interpolation, Motion};
use crate::page::Page;
use crate::state::effects::FxId;
@@ -83,6 +83,8 @@ pub struct UiState {
pub window_height: u32,
pub load_demo_on_startup: bool,
pub demo_index: usize,
pub nav_indicator_until: Option<Instant>,
pub nav_fx: RefCell<Option<Effect>>,
}
impl Default for UiState {
@@ -135,6 +137,8 @@ impl Default for UiState {
window_height: 800,
load_demo_on_startup: true,
demo_index: 0,
nav_indicator_until: None,
nav_fx: RefCell::new(None),
}
}
}
@@ -196,6 +200,19 @@ impl UiState {
self.minimap = MinimapMode::Hidden;
}
pub fn show_nav_indicator(&mut self, duration_ms: u64, direction: Motion) {
self.nav_indicator_until = Some(Instant::now() + Duration::from_millis(duration_ms));
let bg = crate::theme::get().ui.bg;
*self.nav_fx.borrow_mut() = Some(fx::fade_from_fg(bg, (150, Interpolation::QuadOut)));
crate::state::effects::nav_sweep(self, direction);
}
pub fn nav_indicator_visible(&self) -> bool {
self.nav_indicator_until
.map(|t| Instant::now() < t)
.unwrap_or(false)
}
pub fn invalidate_help_cache(&self) {
self.help_parsed
.borrow_mut()