aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/ui.rs
diff options
context:
space:
mode:
authorlukeflo2024-10-17 23:02:06 +0200
committerlukeflo2024-10-17 23:02:06 +0200
commit1fb272e563aca3b90a82fcbef68ed1c28cb7b212 (patch)
tree8dc10dd07d80556d53ce7276cfddf47de1fec496 /src/frontend/ui.rs
parent5abdd1822a1d388feb36b0d4e62316b4671bf406 (diff)
downloadbibiman-1fb272e563aca3b90a82fcbef68ed1c28cb7b212.tar.gz
bibiman-1fb272e563aca3b90a82fcbef68ed1c28cb7b212.zip
Implement sorting and remove unneccessary struct
- Implement sorting of list (by authors for now) - Remove hole BibiData struct - Create entry table content directly through iterator
Diffstat (limited to 'src/frontend/ui.rs')
-rw-r--r--src/frontend/ui.rs27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/frontend/ui.rs b/src/frontend/ui.rs
index 08cebcb..1767cea 100644
--- a/src/frontend/ui.rs
+++ b/src/frontend/ui.rs
@@ -47,6 +47,8 @@ const SELECTED_STYLE: Style = Style::new()
.add_modifier(Modifier::REVERSED);
const TEXT_FG_COLOR: Color = Color::Indexed(252);
const TEXT_UNSELECTED_FG_COLOR: Color = Color::Indexed(245);
+const SORTED_ENTRIES: &str = "▼";
+const SORTED_ENTRIES_REVERSED: &str = "▲";
const SCROLLBAR_UPPER_CORNER: Option<&str> = Some("┓");
const SCROLLBAR_LOWER_CORNER: Option<&str> = Some("┛");
@@ -259,15 +261,22 @@ impl App {
let header_style = Style::default().bold().fg(TEXT_FG_COLOR);
- let header = [
- "Authors".underlined(),
- "Title".underlined(),
- "Year".underlined(),
- "Type".underlined(),
- ]
- .into_iter()
- .map(Cell::from)
- .collect::<Row>()
+ let header = Row::new(vec![
+ Cell::from(Line::from(vec![
+ Span::raw("Author").underlined(),
+ Span::raw(format!(
+ " {}",
+ if self.entry_table.entry_table_reversed_sort {
+ SORTED_ENTRIES_REVERSED
+ } else {
+ SORTED_ENTRIES
+ }
+ )),
+ ])),
+ Cell::from("Title".to_string().underlined()),
+ Cell::from("Year".to_string().underlined()),
+ Cell::from("Type".to_string().underlined()),
+ ])
.style(header_style)
.height(1);