Skip to main content

graphrag_cli/ui/components/
mod.rs

1//! Reusable UI components for the TUI
2
3use crate::action::Action;
4use color_eyre::eyre::Result;
5use ratatui::{layout::Rect, Frame};
6
7pub mod help_overlay;
8pub mod info_panel;
9pub mod query_input;
10pub mod raw_results_viewer;
11pub mod results_viewer;
12pub mod status_bar;
13
14/// Component trait for UI elements
15pub trait Component {
16    /// Initialize the component
17    #[allow(dead_code)]
18    fn init(&mut self) -> Result<()> {
19        Ok(())
20    }
21
22    /// Handle an action and optionally return a new action
23    fn handle_action(&mut self, action: &Action) -> Option<Action> {
24        let _ = action;
25        None
26    }
27
28    /// Render the component
29    fn render(&mut self, f: &mut Frame, area: Rect);
30}