WIP: ratatui app init

This commit is contained in:
2026-07-26 14:08:20 +02:00
parent 11978af863
commit d6d819bf40
6 changed files with 1565 additions and 11 deletions

View File

@@ -1,2 +1,3 @@
pub mod config;
pub mod source;
pub mod ui;

62
src/modules/ui/app.rs Normal file
View File

@@ -0,0 +1,62 @@
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind};
use ratatui::{
DefaultTerminal, Frame,
buffer::Buffer,
layout::Rect,
style::Stylize,
symbols::border,
text::{Line, Text},
widgets::{Block, Paragraph, Widget},
};
enum UiState {
LIST,
FILTER,
EDIT,
ADD,
DELETE,
}
enum FilterVariant {
WORD,
LANG,
}
struct Filter {
variant: FilterVariant,
value: String,
}
pub struct App {
state: UiState,
scroll_percentage: u32,
filters: Vector<Filter>,
exit: bool,
}
impl App {
pub fn new() -> Self {
Self {
state: UiState.LIST,
scroll_percentage: 0,
filters: vec![],
exit: false,
}
}
pub fn run(&mut self, terminal: &mut DefaultTerminal) -> io::Result<()> {
while !self.exit {
terminal.draw(|frame| self.draw(frame))?;
self.handle_events()?;
}
Ok(())
}
fn draw(&self, frame: &mut Frame) {
todo!()
}
fn handle_events(&mut self) -> io::Result<()> {
todo!()
}
}

1
src/modules/ui/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod app;