aboutsummaryrefslogtreecommitdiff
path: root/src/tui/ui.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui/ui.rs')
-rw-r--r--src/tui/ui.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs
index e3fddfd..6a3b8de 100644
--- a/src/tui/ui.rs
+++ b/src/tui/ui.rs
@@ -212,25 +212,14 @@ pub fn render_popup(app: &mut App, args: &CLIArgs, frame: &mut Frame) {
let doi_lines = paragraph.line_count(area.width / 2);
// Calculate popup size
- let popup_width = area.width / 2;
+ let popup_width = area.width / 4 * 3;
let popup_height = doi_lines as u16; // Adjust as needed
let popup_area = popup_area(area, popup_width, popup_height);
// Render the popup
frame.render_widget(Clear, popup_area);
- render_cursor(app, frame, popup_area, 6, 2);
+ render_cursor(app, frame, popup_area, 6, doi_lines as u16 - 1);
frame.render_widget(paragraph, popup_area);
-
- // // Set the cursor position
- // if app.input_mode {
- // // Calculate cursor x and y
- // let input_prefix_len = "Title: ".len() as u16 + 1; // +1 for padding
- // let cursor_x = popup_area.x
- // + input_prefix_len
- // + app.bibiman.popup_area.add_entry_cursor_position as u16;
- // let cursor_y = popup_area.y + 1; // Line after 'Title: '
- // frame.set_cursor_position(Position::new(cursor_x, cursor_y));
- // }
}
Some(PopupKind::MessageConfirm) => {
let area = frame.area();
@@ -294,7 +283,7 @@ pub fn render_popup(app: &mut App, args: &CLIArgs, frame: &mut Frame) {
frame.render_widget(Clear, popup_area);
frame.render_widget(&content, popup_area)
}
- Some(PopupKind::Selection) => {
+ Some(PopupKind::SelectRes) | Some(PopupKind::SelectFile) => {
let list_items: Vec<ListItem> = app
.bibiman
.popup_area
@@ -303,8 +292,16 @@ pub fn render_popup(app: &mut App, args: &CLIArgs, frame: &mut Frame) {
.map(|item| ListItem::from(item.to_owned()))
.collect();
+ let title = if let Some(PopupKind::SelectRes) = app.bibiman.popup_area.popup_kind {
+ " Open "
+ } else if let Some(PopupKind::SelectFile) = app.bibiman.popup_area.popup_kind {
+ " Select file to append entry "
+ } else {
+ " Select "
+ };
+
let block = Block::bordered()
- .title_top(" Open ".bold())
+ .title_top(title.bold())
.title_bottom(" (j,k|↓,↑) ━ (ENTER) ━ (ESC) ".bold())
.title_alignment(Alignment::Center)
.style(