From a4ef50340946e2563f3ffa2436736187aae65918 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Wed, 4 Dec 2024 01:57:35 +0100 Subject: [PATCH] cool stuff --- src/tui.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tui.rs b/src/tui.rs index 6a73c4a..8bd0f26 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -2,12 +2,12 @@ use anyhow::Result; use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind}; use nvrs::*; use ratatui::{ - layout::Alignment, - widgets::{Block, BorderType, List, ListItem}, - Frame, + layout::Alignment, style::{Style, Stylize}, widgets::{Block, BorderType, List, ListItem}, Frame }; use tachyonfx::{fx, Duration as FxDuration, Effect, EffectRenderer, Shader}; +const KEYBINDS: &str = " [q] Quit [s] Sync "; + struct AppState { is_running: bool, is_syncing: bool, @@ -42,13 +42,14 @@ impl AppState { fn draw(&mut self, frame: &mut Frame) { let new_names = self.verfiles.1.data.data.keys().collect::>(); - let list = List::new(new_names.iter().map(|p| ListItem::new(p.to_string()))).block( + let list = List::new(new_names.iter().map(|p| ListItem::new(format!("📦️ {}", p)).style(Style::default().blue()))).block( Block::bordered() - .title(if self.is_syncing { + .title_top(if self.is_syncing { " Synchronizing... " } else { " nvrs " }) + .title_bottom(KEYBINDS) .title_alignment(Alignment::Center) .border_type(BorderType::Rounded), );