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:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user