From e35e6d8ba4a7685af6a24b7cd3e77ff19e5f7b80 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Sun, 25 Jan 2026 18:18:35 +0000 Subject: refactor bucket_navigation_entry --- .../src/gui/components/bucket_navigation_entry.rs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs (limited to 'schist_desktop_gui/src/gui/components/bucket_navigation_entry.rs') 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> +{ + fn from(bucket_navigation_entry: &'a BucketNavigationEntry) -> Self { + (&bucket_navigation_entry.0).into() + } +} -- cgit v1.2.3