[Add] Terms UI, [WIP] Main UI
This commit is contained in:
parent
a0fddf723f
commit
bac1c608fe
13 changed files with 450 additions and 112 deletions
41
src/gui/screens/main_screen.rs
Normal file
41
src/gui/screens/main_screen.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
use std::{any::Any, sync::Arc};
|
||||
|
||||
use crossterm::event::KeyEvent;
|
||||
use ratatui::{
|
||||
Frame,
|
||||
layout::Rect,
|
||||
widgets::{Block, Borders},
|
||||
};
|
||||
|
||||
use crate::gui::{interaction_result::InteractionResult, screens::screens::Screen, ui::UI};
|
||||
|
||||
pub struct MainScreen {
|
||||
ui: Arc<UI>,
|
||||
}
|
||||
|
||||
impl MainScreen {
|
||||
pub async fn new(ui: Arc<UI>) -> Self {
|
||||
MainScreen { ui }
|
||||
}
|
||||
}
|
||||
impl Screen for MainScreen {
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_any_mut(&mut self) -> &mut dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn get_ui(&self) -> &Arc<UI> {
|
||||
&self.ui
|
||||
}
|
||||
|
||||
fn render(&self, f: &mut Frame, rect: Rect) {
|
||||
f.render_widget(Block::default().title("Main").borders(Borders::ALL), rect);
|
||||
}
|
||||
|
||||
fn handle_input(&mut self, event: KeyEvent) -> InteractionResult {
|
||||
InteractionResult::Unhandled
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue