-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from MutinyWallet/add-info-header
add header with info about balance and mint
- Loading branch information
Showing
9 changed files
with
136 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use iced::widget::{container, scrollable, Column}; | ||
use iced::Length; | ||
use iced::{Element, Padding}; | ||
|
||
use crate::Message; | ||
|
||
pub fn basic_layout(column: Column<Message>) -> Element<Message> { | ||
container( | ||
scrollable(column.width(Length::Fixed(512.)).padding(Padding::new(48.))) | ||
.height(Length::Fill), | ||
) | ||
.into() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::components::lighten; | ||
use iced::widget::{horizontal_rule, rule, vertical_rule}; | ||
use iced::{Element, Theme}; | ||
|
||
use crate::Message; | ||
|
||
pub fn hr() -> Element<'static, Message> { | ||
horizontal_rule(1) | ||
.style(|theme: &Theme| { | ||
{ | ||
let gray = lighten(theme.palette().background, 0.1); | ||
// TODO: is there an easier way to just override the color? | ||
rule::Style { | ||
color: gray, | ||
width: 1, | ||
radius: (0.).into(), | ||
fill_mode: rule::FillMode::Full, | ||
} | ||
} | ||
}) | ||
.into() | ||
} | ||
|
||
pub fn vr() -> Element<'static, Message> { | ||
vertical_rule(1) | ||
.style(|theme: &Theme| { | ||
{ | ||
let gray = lighten(theme.palette().background, 0.1); | ||
// TODO: is there an easier way to just override the color? | ||
rule::Style { | ||
color: gray, | ||
width: 1, | ||
radius: (0.).into(), | ||
fill_mode: rule::FillMode::Full, | ||
} | ||
} | ||
}) | ||
.into() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use iced::{ | ||
widget::{column, row, text}, | ||
Alignment, Element, Length, | ||
}; | ||
|
||
use crate::{HarborWallet, Message}; | ||
|
||
use super::{hr, map_icon, vr, FederationItem, SvgIcon}; | ||
|
||
pub fn h_screen_header(harbor: &HarborWallet, show_balance: bool) -> Element<Message> { | ||
if let Some(item) = harbor.federation_list.first() { | ||
let FederationItem { name, id: _id } = item; | ||
let people_icon = map_icon(SvgIcon::People).width(24).height(24); | ||
let current_federation = row![people_icon, text(name).size(24)] | ||
.align_items(Alignment::Center) | ||
.spacing(16) | ||
.width(Length::Shrink) | ||
.padding(16); | ||
|
||
let balance = row![text(format!("{} sats", harbor.balance_sats)).size(24)] | ||
.align_items(Alignment::Center) | ||
.padding(16); | ||
|
||
let row = row![current_federation].spacing(16); | ||
|
||
column![ | ||
row.push_maybe(show_balance.then_some(vr())) | ||
.push_maybe(show_balance.then_some(balance)) | ||
.height(Length::Shrink), | ||
hr() | ||
] | ||
.into() | ||
} else { | ||
row![].spacing(16).into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters