summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui/components/transactions_view.rs
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-02-08 15:49:01 +0000
committerJoe Carstairs <me@joeac.net>2026-02-08 15:49:01 +0000
commit170c1a58ebd8b6ff1dceb5f46146f76b601c91ad (patch)
treebf686c5c4e6e14e05139daf5914bf451724cb583 /schist_desktop_gui/src/gui/components/transactions_view.rs
parentb9244f6049c685c2b983632359676521506f8772 (diff)
task-085: factor out Viewable impl for TransactionsView
Diffstat (limited to 'schist_desktop_gui/src/gui/components/transactions_view.rs')
-rw-r--r--schist_desktop_gui/src/gui/components/transactions_view.rs40
1 files changed, 4 insertions, 36 deletions
diff --git a/schist_desktop_gui/src/gui/components/transactions_view.rs b/schist_desktop_gui/src/gui/components/transactions_view.rs
index 6f2ad44..f39b522 100644
--- a/schist_desktop_gui/src/gui/components/transactions_view.rs
+++ b/schist_desktop_gui/src/gui/components/transactions_view.rs
@@ -1,17 +1,13 @@
+mod view_transactions_view;
+
use std::collections::HashMap;
-use iced::{
- alignment,
- widget::{column, row, Container},
- Element, Length,
-};
use itertools::Itertools;
use schist_models::{Account, Transaction};
use crate::{
- gui::components::{navigation, AccountNavigationEntry, Navigation, Text},
- style::SPACING_LG,
- traits::{Component, Viewable},
+ gui::components::{navigation, AccountNavigationEntry, Navigation},
+ traits::Component,
};
#[derive(Clone, Debug)]
@@ -52,34 +48,6 @@ impl TransactionsView {
}
}
-impl<'a> Viewable<'a, Message> for TransactionsView {
- fn view(&'a self) -> Element<'a, Message> {
- let navigation = self.navigation.view().map(Message::NavigationMessage);
- let main_content = column![
- Text::default("Hello, transactions!").as_element(),
- Text::default(&format!(
- "{} transactions in this account.",
- self.navigation.active_option.clone().map_or(
- 0,
- |AccountNavigationEntry { account, .. }| self
- .transactions_by_account_id
- .get(&account.id)
- .map_or(0, |transactions| transactions.len())
- )
- ))
- .as_element(),
- ];
- row![
- Container::new(navigation).width(Length::FillPortion(1)),
- Container::new(main_content).width(Length::FillPortion(3)),
- ]
- .align_y(alignment::Vertical::Center)
- .height(Length::Fill)
- .spacing(SPACING_LG)
- .into()
- }
-}
-
impl<'a> Component<'a, Message, Action> for TransactionsView {
fn update(&mut self, message: Message) -> Action {
match message {