From c34412d9e3725bed48af925646110f2ca34b1bd4 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Fri, 21 Feb 2025 21:55:17 +0100 Subject: implement working config file construct, error handling should be improved --- src/tui/popup.rs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/tui/popup.rs') diff --git a/src/tui/popup.rs b/src/tui/popup.rs index 4ef9fc3..6a2e8ff 100644 --- a/src/tui/popup.rs +++ b/src/tui/popup.rs @@ -16,12 +16,12 @@ ///// use ratatui::{ - style::{Color, Stylize}, + style::Stylize, text::{Line, Span, Text}, widgets::ListState, }; -use crate::cliargs::CLIArgs; +use crate::config::BibiConfig; #[derive(Debug)] pub enum PopupKind { @@ -47,7 +47,7 @@ pub struct PopupArea { } impl PopupArea { - pub fn popup_help<'a>(args: &CLIArgs) -> Text<'a> { + pub fn popup_help<'a>(cfg: &BibiConfig) -> Text<'a> { let help = [ ("General", "first"), ("TAB: ", "Toggle areas (Entries, Keywords)"), @@ -89,22 +89,31 @@ impl PopupArea { for (keys, help) in help { if help == "first" { helptext.push(Line::from( - Span::raw(keys) - .bold() - .fg(Color::Indexed(args.colors.main_text_color)), + Span::raw(keys).bold().fg(cfg + .colors + .as_ref() + .unwrap() + .main_text_color + .unwrap()), )) } else if help == "sub" { helptext.push(Line::from("")); helptext.push(Line::from( - Span::raw(keys) - .bold() - .fg(Color::Indexed(args.colors.main_text_color)), + Span::raw(keys).bold().fg(cfg + .colors + .as_ref() + .unwrap() + .main_text_color + .unwrap()), )) } else { helptext.push(Line::from(vec![ - Span::raw(keys) - .bold() - .fg(Color::Indexed(args.colors.keyword_color)), + Span::raw(keys).bold().fg(cfg + .colors + .as_ref() + .unwrap() + .main_text_color + .unwrap()), Span::raw(help), ])) } -- cgit v1.2.3