Skip to content

Commit

Permalink
use liana-ui::theme methods
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Jan 23, 2025
1 parent 011f74a commit 91e442f
Show file tree
Hide file tree
Showing 19 changed files with 330 additions and 330 deletions.
52 changes: 26 additions & 26 deletions liana-gui/src/app/view/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn coin_list_view<'a>(
// It is not possible to know if a coin is a
// change coin or not so for now, From is
// enough
p1_regular("From").style(color::GREY_3),
p1_regular("From").color(color::GREY_3),
)
.push(p1_regular(label)),
)
Expand All @@ -101,7 +101,7 @@ fn coin_list_view<'a>(
// It is not possible to know if a coin is a
// change coin or not so for now, From is
// enough
p1_regular("From").style(color::GREY_3),
p1_regular("From").color(color::GREY_3),
)
.push(p1_regular(label)),
)
Expand Down Expand Up @@ -130,7 +130,7 @@ fn coin_list_view<'a>(
.align_y(Alignment::Center)
.spacing(20),
)
.style(theme::Button::TransparentBorder)
.style(theme::button::transparent_border)
.padding(10)
.on_press(Message::Select(index)),
)
Expand All @@ -156,7 +156,7 @@ fn coin_list_view<'a>(
if blockheight > b as u32 + timelock as u32 {
Some(Container::new(
p1_bold("One of the recovery path is available")
.style(color::RED),
.color(color::RED),
))
} else {
Some(Container::new(p1_bold(format!(
Expand All @@ -178,32 +178,32 @@ fn coin_list_view<'a>(
.push(
p2_regular("Address label:")
.bold()
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(if let Some(label) = labels.get(&address) {
p2_regular(label).style(color::GREY_2)
p2_regular(label).color(color::GREY_2)
} else {
p2_regular("No label").style(color::GREY_2)
p2_regular("No label").color(color::GREY_2)
})
.spacing(5),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(p2_regular("Address:").bold().style(color::GREY_2))
.push(p2_regular("Address:").bold().color(color::GREY_2))
.push(
Row::new()
.align_y(Alignment::Center)
.push(
p2_regular(address.clone())
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(
Button::new(icon::clipboard_icon())
.on_press(Message::Clipboard(
address.clone(),
))
.style(theme::Button::TransparentBorder),
.style(theme::button::transparent_border),
),
)
.spacing(5),
Expand All @@ -214,50 +214,50 @@ fn coin_list_view<'a>(
.push(
p2_regular("Deposit transaction label:")
.bold()
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(if let Some(label) = labels.get(&txid) {
p2_regular(label).style(color::GREY_2)
p2_regular(label).color(color::GREY_2)
} else {
p2_regular("No label").style(color::GREY_2)
p2_regular("No label").color(color::GREY_2)
})
.spacing(5),
)
.push(
Row::new()
.align_y(Alignment::Center)
.push(p2_regular("Outpoint:").bold().style(color::GREY_2))
.push(p2_regular("Outpoint:").bold().color(color::GREY_2))
.push(
Row::new()
.align_y(Alignment::Center)
.push(
p2_regular(format!("{}", coin.outpoint))
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(
Button::new(icon::clipboard_icon())
.on_press(Message::Clipboard(
coin.outpoint.to_string(),
))
.style(theme::Button::TransparentBorder),
.style(theme::button::transparent_border),
),
)
.spacing(5),
)
.push_maybe(coin.block_height.map(|b| {
Row::new()
.push(
p2_regular("Block height:").bold().style(color::GREY_2),
p2_regular("Block height:").bold().color(color::GREY_2),
)
.push(p2_regular(format!("{}", b)).style(color::GREY_2))
.push(p2_regular(format!("{}", b)).color(color::GREY_2))
.spacing(5)
})),
)
.push(if let Some(info) = coin.spend_info {
Column::new()
.push(
Row::new()
.push(p2_regular("Spend txid:").bold().style(color::GREY_2))
.push(p2_regular("Spend txid:").bold().color(color::GREY_2))
.push(p2_regular(format!("{}", info.txid)))
.spacing(5),
)
Expand All @@ -266,13 +266,13 @@ fn coin_list_view<'a>(
.push(
p2_regular("Spend block height:")
.bold()
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(p2_regular(format!("{}", height)))
.spacing(5)
} else {
Row::new().push(
p2_regular("Not in a block").bold().style(color::GREY_2),
p2_regular("Not in a block").bold().color(color::GREY_2),
)
})
.spacing(5)
Expand All @@ -291,7 +291,7 @@ fn coin_list_view<'a>(
None
}),
)
.style(theme::Container::Card(theme::Card::Simple))
.style(theme::card::simple)
}

pub fn coin_sequence_label<'a, T: 'a>(seq: u32, timelock: u32) -> Container<'a, T> {
Expand All @@ -304,7 +304,7 @@ pub fn coin_sequence_label<'a, T: 'a>(seq: u32, timelock: u32) -> Container<'a,
.align_y(Alignment::Center),
)
.padding(10)
.style(theme::Container::Pill(theme::Pill::Warning))
.style(theme::pill::warning)
} else if seq < timelock * 10 / 100 {
Container::new(
Row::new()
Expand All @@ -314,17 +314,17 @@ pub fn coin_sequence_label<'a, T: 'a>(seq: u32, timelock: u32) -> Container<'a,
.align_y(Alignment::Center),
)
.padding(10)
.style(theme::Container::Pill(theme::Pill::Simple))
.style(theme::pill::simple)
} else {
Container::new(
Row::new()
.spacing(5)
.push(icon::clock_icon().width(Length::Fixed(20.0)))
.push(p2_regular(expire_message(seq)).style(color::GREY_3))
.push(p2_regular(expire_message(seq)).color(color::GREY_3))
.align_y(Alignment::Center),
)
.padding(10)
.style(theme::Container::Pill(theme::Pill::Simple))
.style(theme::pill::simple)
}
}

Expand Down
26 changes: 13 additions & 13 deletions liana-gui/src/app/view/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ pub fn home_view<'a>(
SyncStatus::WalletFullScan => text("Syncing"),
_ => text("Checking for new transactions"),
}
.style(color::GREY_2),
.color(color::GREY_2),
)
.push(spinner::typing_text_carousel(
"...",
true,
Duration::from_millis(2000),
|content| text(content).style(color::GREY_2),
|content| text(content).color(color::GREY_2),
)),
)
} else {
Expand All @@ -86,9 +86,9 @@ pub fn home_view<'a>(
Some(
Row::new()
.spacing(10)
.push(text("+").size(H3_SIZE).style(color::GREY_3))
.push(text("+").size(H3_SIZE).color(color::GREY_3))
.push(unconfirmed_amount_with_size(unconfirmed_balance, H3_SIZE))
.push(text("unconfirmed").size(H3_SIZE).style(color::GREY_3)),
.push(text("unconfirmed").size(H3_SIZE).color(color::GREY_3)),
)
} else {
None
Expand All @@ -111,13 +111,13 @@ pub fn home_view<'a>(
.push(
icon::tooltip_icon()
.size(20)
.style(color::GREY_3)
.color(color::GREY_3)
.width(Length::Fixed(20.0)),
)
.width(Length::Fill),
)
.padding(25)
.style(theme::Card::Border)
.style(theme::card::border)
})
} else {
Some(
Expand All @@ -140,7 +140,7 @@ pub fn home_view<'a>(
),
)
.padding(25)
.style(theme::Card::Invalid),
.style(theme::card::invalid),
)
})
.push(
Expand Down Expand Up @@ -168,15 +168,15 @@ pub fn home_view<'a>(
)
.width(Length::Fill)
.padding(15)
.style(theme::Button::TransparentBorder)
.style(theme::button::transparent_border)
.on_press_maybe(if !processing {
Some(Message::Next)
} else {
None
}),
)
.width(Length::Fill)
.style(theme::Container::Card(theme::Card::Simple)),
.style(theme::card::simple),
)
} else {
None
Expand All @@ -193,7 +193,7 @@ fn event_list_view(event: &Payment) -> Element<'_, Message> {
event
.address_label
.as_ref()
.map(|label| p1_regular(format!("address label: {}", label)).style(color::GREY_3))
.map(|label| p1_regular(format!("address label: {}", label)).color(color::GREY_3))
};
if event.kind == PaymentKind::Incoming {
if let Some(t) = event.time {
Expand Down Expand Up @@ -298,7 +298,7 @@ pub fn payment_view<'a>(
.push_maybe(tx.fee_amount.map(|fee_amount| {
Row::new()
.align_y(Alignment::Center)
.push(h3("Miner fee: ").style(color::GREY_3))
.push(h3("Miner fee: ").color(color::GREY_3))
.push(amount_with_size(&fee_amount, H3_SIZE))
.push(text(" ").size(H3_SIZE))
.push(
Expand All @@ -307,7 +307,7 @@ pub fn payment_view<'a>(
fee_amount.to_sat() / tx.tx.vsize() as u64
))
.size(H4_SIZE)
.style(color::GREY_3),
.color(color::GREY_3),
)
}))
.push(card::simple(
Expand All @@ -334,7 +334,7 @@ pub fn payment_view<'a>(
.push(
Button::new(icon::clipboard_icon())
.on_press(Message::Clipboard(tx.tx.txid().to_string()))
.style(theme::Button::TransparentBorder),
.style(theme::button::transparent_border),
)
.width(Length::Shrink),
),
Expand Down
12 changes: 6 additions & 6 deletions liana-gui/src/app/view/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn hw_list_view(
kind, pairing_code, ..
} => hw::locked_hardware_wallet(kind, pairing_code.as_ref()),
})
.style(theme::Button::Border)
.style(theme::button::container_border)
.width(Length::Fill);
if !signing {
if let HardwareWallet::Supported { registered, .. } = hw {
Expand All @@ -80,7 +80,7 @@ pub fn hw_list_view(
}
Container::new(bttn)
.width(Length::Fill)
.style(theme::Container::Card(theme::Card::Simple))
.style(theme::card::simple)
.into()
}

Expand Down Expand Up @@ -137,14 +137,14 @@ pub fn hw_list_view_for_registration(
kind, pairing_code, ..
} => hw::locked_hardware_wallet(kind, pairing_code.as_ref()),
})
.style(theme::Button::Border)
.style(theme::button::container_border)
.width(Length::Fill);
if !processing && hw.is_supported() {
bttn = bttn.on_press(Message::SelectHardwareWallet(i));
}
Container::new(bttn)
.width(Length::Fill)
.style(theme::Container::Card(theme::Card::Simple))
.style(theme::card::simple)
.into()
}

Expand Down Expand Up @@ -222,13 +222,13 @@ pub fn hw_list_view_verify_address(
),
};
let mut bttn = Button::new(content)
.style(theme::Button::Border)
.style(theme::button::container_border)
.width(Length::Fill);
if selectable && hw.is_supported() {
bttn = bttn.on_press(Message::SelectHardwareWallet(i));
}
Container::new(bttn)
.width(Length::Fill)
.style(theme::Container::Card(theme::Card::Simple))
.style(theme::card::simple)
.into()
}
Loading

0 comments on commit 91e442f

Please sign in to comment.