From cee861758df56be9838427f2034d944028a2bc0e Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Wed, 6 Nov 2024 16:38:08 +0100 Subject: [PATCH] remove previous idiocy --- crates/admin-fe/src/main.rs | 79 +++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/crates/admin-fe/src/main.rs b/crates/admin-fe/src/main.rs index 9ee38e3..5c6adc0 100644 --- a/crates/admin-fe/src/main.rs +++ b/crates/admin-fe/src/main.rs @@ -1,49 +1,44 @@ -// use std::io; +use std::io; -// use app::App; -// use crossterm::event::{self, KeyCode, KeyEventKind}; -// use ratatui::{style::Stylize, widgets::Paragraph, DefaultTerminal}; +use app::App; +use crossterm::event::{self, KeyCode, KeyEventKind}; +use ratatui::{style::Stylize, widgets::Paragraph, DefaultTerminal}; fn main() -> io::Result<()> { - // let mut term = ratatui::init(); - // term.clear()?; + let mut term = ratatui::init(); + term.clear()?; - // let r = App::default().run(&mut term); - // ratatui::restore(); - // r - let mut teststr = String::from("Hello! รครค"); + let r = App::default().run(&mut term); + ratatui::restore(); + r } -fn rev_in_place(s: &mut String) { - s.ch +mod app { + + use std::io; + + use ratatui::{DefaultTerminal, Frame}; + + #[derive(Default)] + pub struct App { + exit: bool, + } + + impl App { + 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!() + } + } } - -// mod app { - -// use std::io; - -// use ratatui::{DefaultTerminal, Frame}; - -// #[derive(Default)] -// pub struct App { -// exit: bool, -// } - -// impl App { -// 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!() -// } -// } -// }