Compare commits
No commits in common. "e4a840d7e4fc9f3d44479c3f70d14522835d88e6" and "857f0771f029f87465ed5e8b297bb9995dc990d1" have entirely different histories.
e4a840d7e4
...
857f0771f0
7 changed files with 12 additions and 44 deletions
|
@ -8,4 +8,4 @@ edition = "2021"
|
|||
[dependencies]
|
||||
crossterm = "0.26.1"
|
||||
ratatui = "0.21.0"
|
||||
sqlx = { version = "0.6.3", features = ["postgres", "runtime-tokio-native-tls", "sqlite"] }
|
||||
rusqlite = "0.29.0"
|
||||
|
|
|
@ -14,9 +14,5 @@
|
|||
buildInputs = with pkgs; [
|
||||
ruststable
|
||||
rust-analyzer
|
||||
bacon
|
||||
|
||||
pkg-config
|
||||
openssl
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,5 +4,3 @@ pub mod app;
|
|||
pub mod tui;
|
||||
|
||||
pub mod ui;
|
||||
|
||||
pub mod uis;
|
||||
|
|
32
src/ui.rs
32
src/ui.rs
|
@ -1,4 +1,6 @@
|
|||
use crate::app::App;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::app::{AppResult, App};
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
|
@ -8,8 +10,6 @@ use ratatui::{
|
|||
Frame,
|
||||
};
|
||||
|
||||
use crate::uis::render_history_tab;
|
||||
|
||||
|
||||
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())
|
||||
.split(size);
|
||||
|
||||
let bottom_block = Block::default()
|
||||
.borders(Borders::ALL);
|
||||
let bottom_block = Block::default();
|
||||
f.render_widget(bottom_block, chunks[1]);
|
||||
|
||||
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) {
|
||||
|
||||
let status_bar_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([Constraint::Percentage(75), Constraint::Min(10)])
|
||||
.constraints([Constraint::Percentage(50), Constraint::Min(10)])
|
||||
.margin(1)
|
||||
.split(status_rect);
|
||||
|
||||
let left_block = Block::default()
|
||||
.borders(Borders::ALL);
|
||||
let right_block = Block::default()
|
||||
let top_block = Block::default()
|
||||
.borders(Borders::ALL);
|
||||
|
||||
f.render_widget(top_block, status_rect);
|
||||
|
||||
let titles = app
|
||||
.tabs
|
||||
|
@ -55,10 +46,9 @@ pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &
|
|||
.collect();
|
||||
|
||||
let tabs = Tabs::new(titles)
|
||||
//.block(Block::default().borders(Borders::NONE))
|
||||
.block(left_block)
|
||||
.block(Block::default().borders(Borders::NONE))
|
||||
.select(app.tab_index)
|
||||
//.style(Style::default().fg(Color::Cyan))
|
||||
.style(Style::default().fg(Color::Cyan))
|
||||
.highlight_style(
|
||||
Style::default()
|
||||
.fg(Color::White)
|
||||
|
@ -72,7 +62,7 @@ pub fn render_statusbar<B: Backend> (f: &mut Frame<B>, status_rect: Rect, app: &
|
|||
Text::styled("Aurora",
|
||||
Style::default().fg(Color::Green)
|
||||
)
|
||||
).block(right_block);
|
||||
);
|
||||
|
||||
f.render_widget(connection_paragraph, status_bar_chunks[1]);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
|
||||
pub mod history;
|
||||
pub use self::history::render_history_tab;
|
Loading…
Reference in a new issue