git-plumber 0.1.3

Explore git internals, the plumbing
Documentation
use ratatui::style::{Color, Style};
use ratatui::text::Span;

use crate::tui::model::{AppState, AppView};

use super::PackViewState;

pub fn render(f: &mut ratatui::Frame, app: &mut AppState, area: ratatui::layout::Rect) {
    if let AppView::PackObjectDetail {
        state: PackViewState {
            pack_widget: pack_widget_state,
            ..
        },
    } = &mut app.view
    {
        let is_focused = true;
        pack_widget_state.render(f, area, is_focused);
    }
}

pub fn navigation_hints(app: &AppState) -> Vec<Span<'_>> {
    match &app.view {
        AppView::PackObjectDetail { .. } => {
            vec![
                Span::styled("", Style::default().fg(Color::Blue)),
                Span::raw(" to scroll | "),
                Span::raw(""),
                Span::styled("Q", Style::default().fg(Color::Blue)),
                Span::styled("/", Style::default().fg(Color::Gray)),
                Span::styled("", Style::default().fg(Color::Blue)),
                Span::raw(" - go back"),
            ]
        }
        _ => Vec::new(),
    }
}