init oops
This commit is contained in:
parent
aa4036afba
commit
5f9bb732b8
7 changed files with 391 additions and 60 deletions
9
crates/admin-fe/Cargo.toml
Normal file
9
crates/admin-fe/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "admin-fe"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
crossterm = "0.28.1"
|
||||
ratatui = "0.28.1"
|
44
crates/admin-fe/src/main.rs
Normal file
44
crates/admin-fe/src/main.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
use std::io;
|
||||
|
||||
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 r = App::default().run(&mut term);
|
||||
ratatui::restore();
|
||||
r
|
||||
}
|
||||
|
||||
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!()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ create table chats (
|
|||
|
||||
create table messages (
|
||||
id uuid default (gen_random_uuid()) primary key,
|
||||
timestamp timestamptz default (now()),
|
||||
chat_id uuid not null references chats(id),
|
||||
content varchar(2000) not null,
|
||||
from_admin boolean not null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue