aboutsummaryrefslogtreecommitdiff
path: root/src/tui/popup.rs
diff options
context:
space:
mode:
authorlukeflo2025-02-21 21:55:17 +0100
committerlukeflo2025-02-21 21:55:17 +0100
commitc34412d9e3725bed48af925646110f2ca34b1bd4 (patch)
treee7f48bb25a605aeccf0c31ed310f1c7a1ae9e067 /src/tui/popup.rs
parentddb6326c1896b82b759d930fb08ea46a820e275a (diff)
downloadbibiman-c34412d9e3725bed48af925646110f2ca34b1bd4.tar.gz
bibiman-c34412d9e3725bed48af925646110f2ca34b1bd4.zip
implement working config file construct, error handling should be improved
Diffstat (limited to 'src/tui/popup.rs')
-rw-r--r--src/tui/popup.rs33
1 files changed, 21 insertions, 12 deletions
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),
]))
}