Compare commits

..

No commits in common. "e4a840d7e4fc9f3d44479c3f70d14522835d88e6" and "857f0771f029f87465ed5e8b297bb9995dc990d1" have entirely different histories.

7 changed files with 12 additions and 44 deletions

View file

@ -8,4 +8,4 @@ edition = "2021"
[dependencies] [dependencies]
crossterm = "0.26.1" crossterm = "0.26.1"
ratatui = "0.21.0" ratatui = "0.21.0"
sqlx = { version = "0.6.3", features = ["postgres", "runtime-tokio-native-tls", "sqlite"] } rusqlite = "0.29.0"

View file

@ -14,9 +14,5 @@
buildInputs = with pkgs; [ buildInputs = with pkgs; [
ruststable ruststable
rust-analyzer rust-analyzer
bacon
pkg-config
openssl
]; ];
} }

View file

View file

@ -4,5 +4,3 @@ pub mod app;
pub mod tui; pub mod tui;
pub mod ui; pub mod ui;
pub mod uis;

View file

@ -1,4 +1,6 @@
use crate::app::App; use std::rc::Rc;
use crate::app::{AppResult, App};
use ratatui::{ use ratatui::{
backend::Backend, backend::Backend,
layout::{Constraint, Direction, Layout, Rect}, layout::{Constraint, Direction, Layout, Rect},
@ -8,8 +10,6 @@ use ratatui::{
Frame, Frame,
}; };
use crate::uis::render_history_tab;
pub fn render<B: Backend> (f: &mut Frame<B>, app: &App) { pub fn render<B: Backend> (f: &mut Frame<B>, app: &App) {
@ -19,33 +19,24 @@ pub fn render<B: Backend> (f: &mut Frame<B>, app: &App) {
.constraints([Constraint::Length(3), Constraint::Min(0)].as_ref()) .constraints([Constraint::Length(3), Constraint::Min(0)].as_ref())
.split(size); .split(size);
let bottom_block = Block::default() let bottom_block = Block::default();
.borders(Borders::ALL);
f.render_widget(bottom_block, chunks[1]); f.render_widget(bottom_block, chunks[1]);
render_statusbar(f, chunks[0], app); render_statusbar(f, chunks[0], app);
let bottom_chunk = Layout::default()
.direction(Direction::Vertical)
.margin(1)
.constraints([Constraint::Percentage(100)])
.split(chunks[1]);
// if app.tabs selected == history,
render_history_tab(f, bottom_chunk[0], app);
} }
pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &App) { pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &App) {
let status_bar_chunks = Layout::default() let status_bar_chunks = Layout::default()
.direction(Direction::Horizontal) .direction(Direction::Horizontal)
.constraints([Constraint::Percentage(75), Constraint::Min(10)]) .constraints([Constraint::Percentage(50), Constraint::Min(10)])
.margin(1)
.split(status_rect); .split(status_rect);
let left_block = Block::default() let top_block = Block::default()
.borders(Borders::ALL);
let right_block = Block::default()
.borders(Borders::ALL); .borders(Borders::ALL);
f.render_widget(top_block, status_rect);
let titles = app let titles = app
.tabs .tabs
@ -55,10 +46,9 @@ pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &
.collect(); .collect();
let tabs = Tabs::new(titles) let tabs = Tabs::new(titles)
//.block(Block::default().borders(Borders::NONE)) .block(Block::default().borders(Borders::NONE))
.block(left_block)
.select(app.tab_index) .select(app.tab_index)
//.style(Style::default().fg(Color::Cyan)) .style(Style::default().fg(Color::Cyan))
.highlight_style( .highlight_style(
Style::default() Style::default()
.fg(Color::White) .fg(Color::White)
@ -72,7 +62,7 @@ pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &
Text::styled("Aurora", Text::styled("Aurora",
Style::default().fg(Color::Green) Style::default().fg(Color::Green)
) )
).block(right_block); );
f.render_widget(connection_paragraph, status_bar_chunks[1]); f.render_widget(connection_paragraph, status_bar_chunks[1]);
} }

View file

@ -1,12 +0,0 @@
use ratatui::{backend::Backend, Frame, layout::Rect, widgets::Paragraph, text::Text, style::{Style, Color}};
use crate::app::App;
pub fn render_history_tab<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &App) {
let connection_paragraph = Paragraph::new(
Text::styled("I'm a ghost!",
Style::default().fg(Color::Green)
)
);
f.render_widget(connection_paragraph, status_rect);
}

View file

@ -1,4 +0,0 @@
pub mod history;
pub use self::history::render_history_tab;