eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
use crate::app::{actions::Action, state::AppState};

pub fn handle(state: &mut AppState, action: &Action) -> bool {
    match action {
        Action::ShowPrHelper => {
            state.pr_helper = true;
            state.pr_selected = 0;
            state.command_palette = false;
        }
        Action::HidePrHelper => {
            state.pr_helper = false;
        }
        Action::PrHelperUp => {
            if state.pr_selected > 0 {
                state.pr_selected -= 1;
            }
        }
        Action::PrHelperDown => {
            let max_idx = state.pr_list.len().saturating_sub(1);
            if state.pr_selected < max_idx {
                state.pr_selected += 1;
            }
        }
        Action::SetPrList(list) => {
            state.pr_list = list.clone();
            state.pr_selected = 0;
        }
        _ => return false,
    }
    true
}