diff options
| author | lukeflo | 2025-07-04 13:56:55 +0200 |
|---|---|---|
| committer | lukeflo | 2025-07-04 13:56:55 +0200 |
| commit | 2594cf34dcf2f04f398dab7b6ecae364eb4c7d17 (patch) | |
| tree | 71ec0170052805eeaa9682541f372a2de892defc /src/app.rs | |
| parent | 61b22382e0979f756538215047bafd30866ccf1e (diff) | |
| download | bibiman-2594cf34dcf2f04f398dab7b6ecae364eb4c7d17.tar.gz bibiman-2594cf34dcf2f04f398dab7b6ecae364eb4c7d17.zip | |
impl `PopupItem` enum, adapt ui: include colors
Diffstat (limited to 'src/app.rs')
| -rw-r--r-- | src/app.rs | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -19,7 +19,7 @@ use crate::bibiman::CurrentArea; use crate::cliargs::CLIArgs; use crate::config::BibiConfig; use crate::tui::commands::InputCmdAction; -use crate::tui::popup::PopupKind; +use crate::tui::popup::{PopupItem, PopupKind}; use crate::tui::{self, Tui}; use crate::{bibiman::Bibiman, tui::commands::CmdAction}; use color_eyre::eyre::{Context, Ok, Result}; @@ -311,13 +311,25 @@ impl App { .selected() .unwrap(); let entry = self.bibiman.entry_table.entry_table_items[idx].clone(); - let mut items = vec![("Citekey: ".to_string(), entry.citekey.clone())]; + let mut items = vec![( + "Citekey: ".to_string(), + entry.citekey.clone(), + PopupItem::Default, + )]; if entry.doi_url.is_some() { - items.push(("Weblink: ".into(), entry.doi_url.unwrap().clone())) + items.push(( + "Weblink: ".into(), + entry.doi_url.unwrap().clone(), + PopupItem::Link, + )) } if entry.filepath.is_some() { entry.filepath.unwrap().iter().for_each(|p| { - items.push(("Filepath: ".into(), p.clone().into_string().unwrap())) + items.push(( + "Filepath: ".into(), + p.clone().into_string().unwrap(), + PopupItem::Entryfile, + )) }); // items.push(( // "Filepath: ".into(), @@ -348,13 +360,14 @@ impl App { .selected() .unwrap(); let entry = self.bibiman.entry_table.entry_table_items[idx].clone(); - let mut items: Vec<(String, String)> = vec![]; + let mut items: Vec<(String, String, PopupItem)> = vec![]; if entry.filepath.is_some() || entry.doi_url.is_some() || entry.notes.is_some() { if entry.doi_url.is_some() { items.push(( "Weblink (DOI/URL): ".into(), entry.doi_url.unwrap().clone(), + PopupItem::Link, )) } if entry.filepath.is_some() { @@ -374,12 +387,17 @@ impl App { } else { p.clone().into_string().unwrap() }, + PopupItem::Entryfile, )) }); } if entry.notes.is_some() { entry.notes.unwrap().iter().for_each(|n| { - items.push(("Note: ".into(), n.clone().into_string().unwrap())); + items.push(( + "Note: ".into(), + n.clone().into_string().unwrap(), + PopupItem::Notefile, + )); }); } |
