refactor(ui): improve rendering, feedback, and help system
Improve UI rendering and feedback:
- `src/draw.rs` :
- Automatically enter Help mode if the model is empty.
- Render the `HelpWidget` with the current help page.
- Render the `WhichKeyWidget` when a transient keymap is active.
- `src/ui/tile_bar.rs` : Use more descriptive labels for axes (e.g., "Row",
"Col", "Pag").
- `src/ui/view_panel.rs` :
- Include an axis summary (e.g., "R:Region C:Product") next to view
names.
- Refactor `ViewContent` to hold a reference to the `Model` .
- `src/ui/effect.rs` : Add error feedback to `AddItem` , `AddItemInGroup` ,
and `AddFormula` when operations fail.
- `src/ui/help.rs` : Refactor `HelpWidget` into a multi-page system.
Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
@ -35,6 +35,8 @@ impl Effect for AddItem {
|
||||
fn apply(&self, app: &mut App) {
|
||||
if let Some(cat) = app.model.category_mut(&self.category) {
|
||||
cat.add_item(&self.item);
|
||||
} else {
|
||||
app.status_msg = format!("Unknown category '{}'", self.category);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,6 +51,8 @@ impl Effect for AddItemInGroup {
|
||||
fn apply(&self, app: &mut App) {
|
||||
if let Some(cat) = app.model.category_mut(&self.category) {
|
||||
cat.add_item_in_group(&self.item, &self.group);
|
||||
} else {
|
||||
app.status_msg = format!("Unknown category '{}'", self.category);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,8 +80,13 @@ pub struct AddFormula {
|
||||
}
|
||||
impl Effect for AddFormula {
|
||||
fn apply(&self, app: &mut App) {
|
||||
if let Ok(formula) = crate::formula::parse_formula(&self.raw, &self.target_category) {
|
||||
app.model.add_formula(formula);
|
||||
match crate::formula::parse_formula(&self.raw, &self.target_category) {
|
||||
Ok(formula) => {
|
||||
app.model.add_formula(formula);
|
||||
}
|
||||
Err(e) => {
|
||||
app.status_msg = format!("Formula error: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user