refactor: add Effect trait and apply_effects infrastructure

Define Effect trait in ui/effect.rs with concrete effect structs for
all model mutations, view changes, navigation, and app state updates.
Each effect implements apply(&self, &mut App). Add App::apply_effects
to apply a sequence of effects. No behavior change yet — existing
key handlers still work as before.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Edward Langley
2026-04-03 22:36:44 -07:00
parent 567ca341f7
commit 9421d01da5
3 changed files with 405 additions and 0 deletions

View File

@ -91,6 +91,12 @@ impl App {
}
}
pub fn apply_effects(&mut self, effects: Vec<Box<dyn super::effect::Effect>>) {
for effect in effects {
effect.apply(self);
}
}
/// True when the model has no categories yet (show welcome screen)
pub fn is_empty_model(&self) -> bool {
self.model.categories.is_empty()