diff options
| author | lukeflo | 2025-06-30 14:59:39 +0200 |
|---|---|---|
| committer | lukeflo | 2025-06-30 14:59:39 +0200 |
| commit | 1b79ba0fb9f4a1d96c0de1fbf6ab42d8e1b0873c (patch) | |
| tree | 83258e7dee7f0eac0233c99ae930967e30a8cc4f /src/tui | |
| parent | 4ca8417812db530cd157fe5b1de70f6e74e9c400 (diff) | |
| download | bibiman-1b79ba0fb9f4a1d96c0de1fbf6ab42d8e1b0873c.tar.gz bibiman-1b79ba0fb9f4a1d96c0de1fbf6ab42d8e1b0873c.zip | |
colored symbols for attachements, basic implementation
Diffstat (limited to 'src/tui')
| -rw-r--r-- | src/tui/ui.rs | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 95b9f2c..970a71d 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -580,7 +580,7 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec .bg(cfg.colors.bar_bg_color); let header = Row::new(vec![ - Cell::from(Line::from("")).bg(cfg.colors.bar_bg_color), + // Cell::from(Line::from("")).bg(cfg.colors.bar_bg_color), Cell::from( Line::from(vec![{ Span::raw("Author") }, { if let Some(EntryTableColumn::Authors) = @@ -699,34 +699,46 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec .iter_mut() .enumerate() .map(|(_i, data)| { - let item = data.ref_vec(); - item.into_iter() - .map(|content| Cell::from(Text::from(content.to_string()))) - .collect::<Row>() - .style( - // Style::new().fg(color_list( - // args, - // i as i32, - // app.bibiman - // .entry_table - // .entry_table_state - // .selected() - // .unwrap_or(0) as i32, - // args.colors.highlight_text_color, - // 20, - // )), - Style::new().fg(if let CurrentArea::EntryArea = app.bibiman.current_area { - cfg.colors.highlight_text_color - } else { - cfg.colors.main_text_color - }), - ) - .height(1) + let item = data.ref_vec(cfg); + + let row = Row::new(vec![ + Cell::from(Line::from(item.authors)), + Cell::from(Line::from(item.title)), + Cell::from(Line::from(item.year)), + Cell::from(Line::from(item.pubtype)), + Cell::from(Line::from(vec![ + Span::styled( + item.symbols[0].clone(), + Style::new().fg(cfg.colors.file_color), + ), + Span::styled( + item.symbols[1].clone(), + Style::new().fg(cfg.colors.link_color), + ), + Span::styled( + item.symbols[2].clone(), + Style::new().fg(cfg.colors.note_color), + ), + ])), + ]); + + // let row = item + // .into_iter() + // .map(|content| Cell::from(Text::from(content.to_string()))) + // .collect::<Row>(); + + row.style( + Style::new().fg(if let CurrentArea::EntryArea = app.bibiman.current_area { + cfg.colors.highlight_text_color + } else { + cfg.colors.main_text_color + }), + ) + .height(1) }); let entry_table = Table::new( rows, [ - Constraint::Length(4), Constraint::Percentage(20), Constraint::Fill(1), Constraint::Length( @@ -739,6 +751,7 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec }, ), Constraint::Percentage(10), + Constraint::Length(4), ], ) .block(block) |
