diff --git a/dioxus-wallet/src/components/txn_list.rs b/dioxus-wallet/src/components/txn_list.rs index 1fe50d71..43ee5d3c 100644 --- a/dioxus-wallet/src/components/txn_list.rs +++ b/dioxus-wallet/src/components/txn_list.rs @@ -11,14 +11,13 @@ pub fn TransactionList( chain: Chain, ) -> Element { cx.render(rsx! { - transactions.iter().map(|tx| { + transactions.iter().map(|tx| { if let Some(metadata) = tx.transaction.metadata.clone(){ let sender = metadata["from"].clone(); let amount = metadata["amount"].as_str().unwrap(); let is_sender = chain_state.account.eq(&sender); let converted_amount = convert_to_highest_unit( - amount.to_string(), - chain.clone()).unwrap_or_else(|_|{"0".to_string()}); + amount.to_string(), *chain).unwrap_or_else(|_|{"0".to_string()}); let (title,address,icon) = match is_sender { true => ( "SENT", @@ -31,7 +30,7 @@ pub fn TransactionList( img!("receive-txn.png") ) }; - rsx! { + rsx! { div { class: "transaction-item", div { @@ -41,25 +40,26 @@ pub fn TransactionList( src: icon, } } - div { - class: "tx-content-container", div { - class: "tx-title", - "{title}" + class: "tx-content-container", + div { + class: "tx-title", + "{title}" + } + div { + class: "txn-address", + "{address}" + } } div { - class: "txn-address", - "{address}" - } - } - div { - class: "tx-amount", - "{converted_amount}" + class: "tx-amount", + "{converted_amount}" + } } - } - } - } - else {rsx!({})} + } + } else { + rsx!{{}} + } + }) }) - }) } diff --git a/dioxus-wallet/src/routes/txns.rs b/dioxus-wallet/src/routes/txns.rs index 62c3b8e7..7b6957f5 100644 --- a/dioxus-wallet/src/routes/txns.rs +++ b/dioxus-wallet/src/routes/txns.rs @@ -21,7 +21,7 @@ pub fn Txns(cx: Scope) -> Element { let alerts = use_atom_ref(&cx, ALERTS); let router = use_router(&cx); let loader_state = use_set(&cx, LOADER).clone(); - let transactions_state: &UseRef> = use_ref(&cx, || vec![]); + let transactions_state: &UseRef> = use_ref(&cx, Vec::new); cx.use_hook(|| { let alerts = alerts.clone(); let transactions_state = transactions_state.clone(); @@ -81,7 +81,7 @@ pub fn Txns(cx: Scope) -> Element { uri: img!("send.png") } } - div{ + div { class:"transaction-container", TransactionList { chain_state:state.clone(),