Skip to content

Commit

Permalink
Merge pull request #55 from yeastplume/fixes_2
Browse files Browse the repository at this point in the history
More Fixes
  • Loading branch information
yeastplume committed Jan 19, 2023
2 parents 9bf635a + fcae779 commit 8d23697
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 55 deletions.
12 changes: 7 additions & 5 deletions src/gui/element/wallet/operation/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,25 +615,27 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont

let status_container = Container::new(status_container_contents)
.style(grin_gui_core::theme::ContainerStyle::BrightForeground)
.height(Length::Fill)
.width(Length::Fill)
.style(grin_gui_core::theme::ContainerStyle::NormalBackground);
.height(Length::Units(25))
.width(Length::Fill);

let status_row = Row::new()
.push(status_container)
.align_items(Alignment::Center)
.spacing(25);

// Buttons to perform operations go here, but empty container for now
let tx_list_display = tx_list_display::data_container(config, &state.tx_list_display_state);
let tx_list_display =
tx_list_display::data_container(config, &state.tx_list_display_state).height(Length::Fill);

// Overall Home screen layout column
let column = Column::new()
.push(header_container)
.push(first_row_container)
.push(Space::with_height(Length::Units(DEFAULT_PADDING * 3)))
.push(tx_list_display)
.push(status_row);
.push(Space::with_height(Length::Units(DEFAULT_PADDING)))
.push(status_row)
.height(Length::Fill);

Container::new(column).padding(iced::Padding::from([
DEFAULT_PADDING, // top
Expand Down
37 changes: 4 additions & 33 deletions src/gui/element/wallet/operation/tx_list_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont

let table_header_container = Container::new(table_header_row).padding(iced::Padding::from([
0, // top
DEFAULT_PADDING, // right - should roughly match width of content scroll bar to align table headers
DEFAULT_PADDING * 3, // right - should roughly match width of content scroll bar to align table headers
0, // bottom
0, // left
]));
Expand Down Expand Up @@ -373,9 +373,6 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont
let mut tx_list_scrollable =
Scrollable::new(content).style(grin_gui_core::theme::ScrollableStyle::Primary);

// Bottom space below the scrollable.
let bottom_space = Space::new(Length::FillPortion(1), Length::Units(DEFAULT_PADDING));

// This column gathers all the tx list elements together.
let mut tx_list_content = Column::new();

Expand All @@ -386,39 +383,13 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont

// TRANSACTION LISTING

let main_column = Column::new();

let scrollable =
Scrollable::new(main_column).style(grin_gui_core::theme::ScrollableStyle::Primary);

let table_colummn = Column::new()
let column = Column::new()
.push(header_container)
.push(table_header_container)
.push(scrollable)
.push(tx_list_content);
let table_container = Container::new(table_colummn)
//.style(grin_gui_core::theme::ContainerStyle::PanelBordered)
.height(Length::Fill)
.width(Length::Fill);

let row = Row::new().push(
Column::new()
.push(table_container)
.push(Space::with_height(Length::Units(DEFAULT_PADDING))), //.push(button_row),
);

let content = Container::new(row)
.center_x()
.width(Length::Fill)
.height(Length::Shrink)
.style(grin_gui_core::theme::ContainerStyle::NormalBackground);

let wrapper_column = Column::new()
.height(Length::Fill)
.push(header_container)
.push(content);

// Returns the final container.
Container::new(wrapper_column)
Container::new(column)
.padding(iced::Padding::from([
DEFAULT_PADDING, // top
DEFAULT_PADDING, // right
Expand Down
25 changes: 10 additions & 15 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ pub struct GrinGui {
mode: Mode,
config: Config,

/// Top-level error modal overlay
modal_state: modal::State<element::modal::StateContainer>,

/// Main menu state
menu_state: element::menu::StateContainer,

Expand All @@ -69,17 +66,16 @@ pub struct GrinGui {
/// About screen state
about_state: element::about::StateContainer,

show_modal: bool,
show_exit: bool,
show_error_modal: bool,
show_exit_modal: bool,
exit: bool,
theme: Theme,
}

impl GrinGui {
pub fn show_exit (&mut self, show: bool) {
self.modal_state.show(show);
self.show_exit = show;
self.show_modal = show;
self.show_exit_modal = true;
self.show_error_modal = false;
}

pub fn safe_exit (&mut self) {
Expand All @@ -106,7 +102,6 @@ impl GrinGui{
error: None,
mode: Mode::Catalog,
config: Config::default(),
modal_state: Default::default(),
menu_state: Default::default(),
wallet_state: Default::default(),
node_state: Default::default(),
Expand All @@ -115,8 +110,8 @@ impl GrinGui{
node_settings_state: Default::default(),
general_settings_state: Default::default(),
about_state: Default::default(),
show_modal: false,
show_exit: false,
show_error_modal: false,
show_exit_modal: false,
exit: false,
theme,
}
Expand Down Expand Up @@ -266,22 +261,22 @@ impl Application for GrinGui {
.style(grin_gui_core::theme::ContainerStyle::NormalBackground)
.into();

let show_exit = self.show_exit;
let show_exit = self.show_exit_modal;
let error_cause = if let Some(e) = &self.error {
error_cause_string(&e)
} else {
"".into()
};

Modal::new(self.show_modal, content, move|| {
if show_exit {
Modal::new(self.show_exit_modal || self.show_error_modal, content, move|| {
if self.show_exit_modal {
element::modal::exit_card().into()
} else {
element::modal::error_card(error_cause.clone()).into()
}
})
//.backdrop(Message::Interaction(Interaction::CloseErrorModal))
//.on_esc(Message::Interaction(Interaction::CloseErrorModal))
.on_esc(Message::Interaction(Interaction::CloseErrorModal))
.style(grin_gui_core::theme::ModalStyle::Normal)
.into()

Expand Down
4 changes: 2 additions & 2 deletions src/gui/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result<Comman
}
},
// Error modal state
Message::Interaction(Interaction::OpenErrorModal) => grin_gui.modal_state.show(true),
Message::Interaction(Interaction::CloseErrorModal) => grin_gui.modal_state.show(false),
Message::Interaction(Interaction::OpenErrorModal) => grin_gui.show_error_modal = true,
Message::Interaction(Interaction::CloseErrorModal) => grin_gui.show_error_modal = false,
// Clipboard messages
Message::Interaction(Interaction::WriteToClipboard(contents)) => {
return Ok(clipboard::write::<Message>(contents));
Expand Down

0 comments on commit 8d23697

Please sign in to comment.