summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-01-25 18:18:35 +0000
committerJoe Carstairs <me@joeac.net>2026-01-26 08:31:02 +0000
commite35e6d8ba4a7685af6a24b7cd3e77ff19e5f7b80 (patch)
treecb8cbc534905c4d4dde979f1919bfead8b5d943b /schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs
parent409b5bc15951001c6d16c2bcfa747fda25cb3735 (diff)
refactor bucket_navigation_entry
Diffstat (limited to 'schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs')
-rw-r--r--schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs b/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs
new file mode 100644
index 0000000..79b0ba9
--- /dev/null
+++ b/schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs
@@ -0,0 +1,28 @@
+use bucket_name_and_balance::BucketNameAndBalance;
+use iced::Element;
+use schist_models::Bucket;
+
+use crate::gui::components::navigation;
+
+mod bucket_name_and_balance;
+
+#[derive(Clone, Debug, PartialEq)]
+pub struct BucketNavigationEntry(BucketNameAndBalance);
+
+impl BucketNavigationEntry {
+ pub fn from_bucket(bucket: &Bucket) -> Self {
+ Self(BucketNameAndBalance::new(bucket))
+ }
+
+ pub fn to_string(&self) -> String {
+ self.0.bucket.name.clone()
+ }
+}
+
+impl<'a> From<&'a BucketNavigationEntry>
+ for Element<'a, navigation::Message<BucketNavigationEntry>>
+{
+ fn from(bucket_navigation_entry: &'a BucketNavigationEntry) -> Self {
+ (&bucket_navigation_entry.0).into()
+ }
+}