summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'schist_desktop_gui/src/gui')
-rw-r--r--schist_desktop_gui/src/gui/components/table/view_table.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/schist_desktop_gui/src/gui/components/table/view_table.rs b/schist_desktop_gui/src/gui/components/table/view_table.rs
index 81755dc..801bbb7 100644
--- a/schist_desktop_gui/src/gui/components/table/view_table.rs
+++ b/schist_desktop_gui/src/gui/components/table/view_table.rs
@@ -26,7 +26,7 @@ where
row_data
.get(&col.index)
.map(|datum| match datum {
- Value::String(text) => Text::default(text).weak(),
+ Value::String(text) => format_string(text),
Value::Currency(amount) => format_currency(*amount),
})
.unwrap_or_else(|| Text::default("")),
@@ -47,11 +47,15 @@ where
}
}
+fn format_string(text: &String) -> Text {
+ Text::default(text).weak()
+}
+
fn format_currency(amount: i32) -> Text {
let text = if amount >= 0 {
format!(" {} · {} ", amount / 100, amount % 100)
} else {
format!("({} · {})", -amount / 100, -amount % 100)
};
- Text::default(&text).align_right().width(iced::Length::Fill)
+ format_string(&text).align_right().width(iced::Length::Fill)
}