Skip to content

Commit

Permalink
fix styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
OBorce committed Jan 22, 2025
1 parent 7e85231 commit 448adef
Show file tree
Hide file tree
Showing 12 changed files with 187 additions and 78 deletions.
16 changes: 10 additions & 6 deletions node-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::env;

use common::time_getter::TimeGetter;
use iced::advanced::graphics::core::window;
use iced::widget::{column, container, row, text, tooltip, Text};
use iced::widget::{column, row, text, tooltip, Text};
use iced::{executor, Element, Length, Settings, Task, Theme};
use iced::{font, Subscription};
use iced_aw::widgets::spinner::Spinner;
Expand Down Expand Up @@ -57,6 +57,7 @@ pub fn main() -> iced::Result {
antialiasing: true,
..Settings::default()
})
.font(iced_fonts::REQUIRED_FONT_BYTES)
.run_with(initialize)
}

Expand Down Expand Up @@ -303,6 +304,7 @@ fn view(state: &MintlayerNodeGUI) -> Element<Message> {
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
iced::widget::button(text("Testnet")).on_press(InitNetwork::Testnet),
Expand All @@ -313,13 +315,14 @@ fn view(state: &MintlayerNodeGUI) -> Element<Message> {
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
]
.align_x(iced::Alignment::Center)
.spacing(5);

let res: Element<InitNetwork> =
container(error_box).center_x(Length::Fill).center_y(Length::Fill).into();
iced::widget::container(error_box).center(Length::Fill).into();

res.map(Message::InitNetwork)
}
Expand All @@ -336,6 +339,7 @@ fn view(state: &MintlayerNodeGUI) -> Element<Message> {
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
iced::widget::button(text("Cold")).on_press(WalletMode::Cold),
Expand All @@ -346,19 +350,20 @@ fn view(state: &MintlayerNodeGUI) -> Element<Message> {
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
]
.align_x(iced::Alignment::Center)
.spacing(5);

let res: Element<WalletMode> =
container(error_box).center_x(Length::Fill).center_y(Length::Fill).into();
iced::widget::container(error_box).center(Length::Fill).into();

res.map(Message::InitWalletMode)
}

MintlayerNodeGUI::Loading(_) => {
container(Spinner::new().width(Length::Fill).height(Length::Fill)).into()
iced::widget::container(Spinner::new().width(Length::Fill).height(Length::Fill)).into()
}

MintlayerNodeGUI::Loaded(_backend_sender, w) => w.view().map(Message::MainWindowMessage),
Expand All @@ -373,8 +378,7 @@ fn view(state: &MintlayerNodeGUI) -> Element<Message> {
.align_x(iced::Alignment::Center)
.spacing(5);

let res: Element<()> =
container(error_box).center_x(Length::Fill).center_y(Length::Fill).into();
let res: Element<()> = iced::widget::container(error_box).center(Length::Fill).into();

res.map(|_| Message::ShuttingDownFinished)
}
Expand Down
3 changes: 2 additions & 1 deletion node-gui/src/main_window/main_widget/tabs/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ impl Tab for SummaryTab {
NETWORK_TOOLTIP,
tooltip::Position::Bottom,
)
.gap(10),
.gap(10)
.style(iced::widget::container::bordered_box),
),
)
.push(
Expand Down
5 changes: 3 additions & 2 deletions node-gui/src/main_window/main_widget/tabs/wallet/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.

use iced::{
widget::{button, column, container, row, tooltip, Text},
widget::{button, column, row, tooltip, Text},
Element,
};
use iced_aw::{Grid, GridRow};
Expand All @@ -29,7 +29,7 @@ pub fn view_addresses(
account: &AccountInfo,
still_syncing: Option<WalletMessage>,
) -> Element<'static, WalletMessage> {
let field = |text: String| container(Text::new(text)).padding(5);
let field = |text: String| iced::widget::container(Text::new(text)).padding(5);
let addresses = account
.addresses
.iter()
Expand Down Expand Up @@ -57,6 +57,7 @@ pub fn view_addresses(
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
]
.into()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub fn view_console(
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
]
.into()
Expand Down
54 changes: 34 additions & 20 deletions node-gui/src/main_window/main_widget/tabs/wallet/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use std::collections::BTreeMap;

use iced::{
widget::{button, column, container, row, text_input, tooltip, tooltip::Position, Text},
widget::{button, column, row, text_input, tooltip, tooltip::Position, Text},
Element, Length,
};
use iced_aw::{Grid, GridRow};
Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn view_delegation(
delegate_staking_amounts: &BTreeMap<DelegationId, String>,
still_syncing: Option<WalletMessage>,
) -> Element<'static, WalletMessage> {
let field = |text: String| container(Text::new(text)).padding(5);
let field = |text: String| iced::widget::container(Text::new(text)).padding(5);

let delegation_balance_grid = {
// We print the table only if there are delegations
Expand Down Expand Up @@ -96,19 +96,22 @@ pub fn view_delegation(
GridRow::new()
.push(row![
tooltip(
container(Text::new(delegation_address.to_short_string()).font(
iced::font::Font {
family: iced::font::Family::Monospace,
weight: Default::default(),
stretch: Default::default(),
style: iced::font::Style::Normal,
}
))
iced::widget::container(
Text::new(delegation_address.to_short_string()).font(
iced::font::Font {
family: iced::font::Family::Monospace,
weight: Default::default(),
stretch: Default::default(),
style: iced::font::Style::Normal,
}
)
)
.padding(5),
Text::new(delegation_address.to_string()),
Position::Bottom,
)
.gap(5),
.gap(5)
.style(iced::widget::container::bordered_box),
button(
Text::new(iced_fonts::Bootstrap::ClipboardCheck.to_string())
.font(iced_fonts::BOOTSTRAP_FONT),
Expand All @@ -121,19 +124,22 @@ pub fn view_delegation(
])
.push(row![
tooltip(
container(Text::new(pool_address.to_short_string()).font(
iced::font::Font {
family: iced::font::Family::Monospace,
weight: Default::default(),
stretch: Default::default(),
style: iced::font::Style::Normal,
}
))
iced::widget::container(
Text::new(pool_address.to_short_string()).font(
iced::font::Font {
family: iced::font::Family::Monospace,
weight: Default::default(),
stretch: Default::default(),
style: iced::font::Style::Normal,
}
)
)
.padding(5),
Text::new(pool_address.to_string()),
Position::Bottom,
)
.gap(5),
.gap(5)
.style(iced::widget::container::bordered_box),
button(
Text::new(iced_fonts::Bootstrap::ClipboardCheck.to_string())
.font(iced_fonts::BOOTSTRAP_FONT),
Expand Down Expand Up @@ -184,6 +190,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
// ----- Create delegation
row![
Expand All @@ -203,6 +210,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
text_input("Delegation address", delegation_address)
Expand All @@ -221,6 +229,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
iced::widget::button(Text::new("Create delegation"))
Expand All @@ -233,6 +242,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
iced::widget::horizontal_rule(10),
// ----- Send delegation to address
Expand All @@ -253,6 +263,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
text_input("Amount to send", send_delegation_amount)
Expand All @@ -271,6 +282,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
text_input("Delegation address", send_delegation_id)
Expand All @@ -289,6 +301,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
row![
iced::widget::button(Text::new("Withdraw from delegation"))
Expand All @@ -301,6 +314,7 @@ pub fn view_delegation(
Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
],
iced::widget::horizontal_rule(10),
// ----- Delegation balance grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub fn view_left_panel(
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
];

button(label)
Expand Down Expand Up @@ -154,7 +155,7 @@ pub fn view_left_panel(
column![
text(file_name).size(25),
row![
pick_list.width(100),
pick_list,
button(Text::new("+"))
.style(iced::widget::button::success)
.on_press(WalletMessage::NewAccount),
Expand All @@ -165,6 +166,7 @@ pub fn view_left_panel(
tooltip::Position::Bottom
)
.gap(10)
.style(iced::widget::container::bordered_box),
]
.align_y(Alignment::Center)
.spacing(10)
Expand Down
Loading

0 comments on commit 448adef

Please sign in to comment.