Feat: documentation, UI/UX

This commit is contained in:
2026-03-01 19:09:52 +01:00
parent ecb559e556
commit db44f9b98e
57 changed files with 1531 additions and 615 deletions

View File

@@ -30,6 +30,7 @@ pub(super) fn handle_help_page(ctx: &mut InputContext, key: KeyEvent) -> InputRe
}
KeyCode::Esc if ctx.app.ui.help_focused_block.is_some() => {
ctx.app.ui.help_focused_block = None;
ctx.app.ui.help_block_output = None;
}
KeyCode::Tab => ctx.dispatch(AppCommand::HelpToggleFocus),
KeyCode::Left if ctx.app.ui.help_focus == HelpFocus::Topics => {
@@ -106,6 +107,7 @@ fn navigate_code_block(ctx: &mut InputContext, forward: bool) {
let scroll_to = parsed.code_blocks[next].start_line.saturating_sub(2);
drop(cache);
ctx.app.ui.help_focused_block = Some(next);
ctx.app.ui.help_block_output = None;
*ctx.app.ui.help_scroll_mut() = scroll_to;
}
@@ -115,7 +117,7 @@ fn execute_focused_block(ctx: &mut InputContext) {
let Some(parsed) = cache[ctx.app.ui.help_topic].as_ref() else {
return;
};
let idx = ctx.app.ui.help_focused_block.expect("block focused in code nav");
let idx = ctx.app.ui.help_focused_block.unwrap();
let Some(block) = parsed.code_blocks.get(idx) else {
return;
};
@@ -126,11 +128,17 @@ fn execute_focused_block(ctx: &mut InputContext) {
.map(|l| l.split(" => ").next().unwrap_or(l))
.collect::<Vec<_>>()
.join("\n");
let topic = ctx.app.ui.help_topic;
let block_idx = ctx.app.ui.help_focused_block.expect("block focused in code nav");
match ctx
.app
.execute_script_oneshot(&cleaned, ctx.link, ctx.audio_tx)
{
Ok(()) => ctx.app.ui.flash("Executed", 100, FlashKind::Info),
Ok(Some(output)) => {
ctx.app.ui.flash(&output, 200, FlashKind::Info);
ctx.app.ui.help_block_output = Some((topic, block_idx, output));
}
Ok(None) => ctx.app.ui.flash("Executed", 100, FlashKind::Info),
Err(e) => ctx
.app
.ui
@@ -153,6 +161,7 @@ fn collapse_help_section(ctx: &mut InputContext) {
}
ctx.app.ui.help_on_section = Some(section);
ctx.app.ui.help_focused_block = None;
ctx.app.ui.help_block_output = None;
}
fn expand_help_section(ctx: &mut InputContext) {
@@ -167,6 +176,7 @@ fn expand_help_section(ctx: &mut InputContext) {
ctx.app.ui.help_topic = first;
}
ctx.app.ui.help_focused_block = None;
ctx.app.ui.help_block_output = None;
}
fn collapse_dict_section(ctx: &mut InputContext) {