Skip to content

Commit

Permalink
fixed wallet button
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-medicala-yral committed Dec 24, 2024
1 parent abbd7c4 commit a050b14
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
16 changes: 8 additions & 8 deletions ssr/src/component/buttons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ pub fn HighlightedButton(
children: Children,
on_click: impl Fn() + 'static,
#[prop(optional)] classes: String,
#[prop(optional)] alt_style: Signal<bool>,
#[prop(optional)] disabled: Signal<bool>,
#[prop(optional)] alt_style: bool,
#[prop(optional)] disabled: bool,
) -> impl IntoView {
let on_click = move |_| on_click();
view! {
<button
on:click=on_click
disabled=move ||disabled.get()
class=move || format!(
disabled=disabled
class=format!(
"w-full px-5 py-3 rounded-lg disabled:text-white/50 flex items-center transition-all justify-center gap-8 font-kumbh font-bold {} {}",
if alt_style.get() {
if alt_style{
"text-primary-600"
} else {
"text-white"
},
classes,
)
style=move || format!(
style=format!(
"background: linear-gradient(73deg, {} );",
if disabled.get() {
if disabled {
"#DE98BE 0%, #E761A9 33%, #7B5369 100%"
} else if alt_style.get() {
} else if alt_style {
"#FFF 0%, #FFF 1000%"
} else {
"#DA539C 0%, #E2017B 33%, #5F0938 100%"
Expand Down
3 changes: 2 additions & 1 deletion ssr/src/page/token/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ pub fn TokenInfo() -> impl IntoView {
.map(|info| {
match info {
Ok(Some(TokenInfoResponse { meta, root, key_principal, is_user_principal, is_token_viewer_airdrop_claimed })) => {
println!("{} {:?} {:?}", is_token_viewer_airdrop_claimed, key_principal.clone().unwrap().to_text(), meta.token_owner.clone().unwrap().principal_id.to_text());
if let Ok(AirdropParam { airdrop_amt }) = airdrop_param.get(){
if !is_token_viewer_airdrop_claimed && meta.token_owner.clone().map(|t| t.principal_id) != key_principal{
if !is_token_viewer_airdrop_claimed && meta.token_owner.clone().map(|t| t.principal_id) == key_principal && !is_user_principal{
return view! {
<AirdropPage airdrop_amount=airdrop_amt meta/>
}
Expand Down
52 changes: 36 additions & 16 deletions ssr/src/page/wallet/airdrop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,43 @@ pub fn AirdropPage(meta: TokenMetadata, airdrop_amount: u64) -> impl IntoView {
</div>
}
}}}
<HighlightedButton
classes="max-w-96 mx-auto".to_string()
alt_style=claimed.into()
disabled=buffer_signal.into()
on_click=move || {airdrop_action.dispatch(());}
>
{move || {
if buffer_signal.get() {
view!{<div classes="max-w-90"><SpinnerFit /></div>}.into_view()
}else if claimed.get() {
view!{<a href="/wallet">"Go to wallet"</a>}.into_view()
} else {
view!{"Claim Now"}.into_view()
}
}
{move || {
if buffer_signal.get() {
view! {
<HighlightedButton
classes="max-w-96 mx-auto".to_string()
alt_style=false
disabled=true
on_click=move || {}
>
<div class="max-w-90"><SpinnerFit /></div>
</HighlightedButton>
}.into_view()
} else if claimed.get() {
view! {
<a href="/wallet" classes="max-w-96 mx-auto">
<HighlightedButton
alt_style=true
disabled=false
on_click=move || {}
>
"Go to wallet"
</HighlightedButton>
</a>
}.into_view()
} else {
view! {
<HighlightedButton
classes="max-w-96 mx-auto".to_string()
alt_style=false
disabled=false
on_click=move || { airdrop_action.dispatch(()); }
>
"Claim Now"
</HighlightedButton>
}.into_view()
}
</HighlightedButton>
}}
</div>
</div>
}
Expand Down

0 comments on commit a050b14

Please sign in to comment.