From 77b9c04ca6e718753e9f6cfd37a06faba767f29c Mon Sep 17 00:00:00 2001 From: Brian Sztamfater Date: Mon, 25 Nov 2024 18:38:46 -0300 Subject: [PATCH] reintroduce bonder fees informational bottom sheet --- .../send/input_amount/estimated_fees.cljs | 45 +++++++++++++++---- .../wallet/send/input_amount/style.cljs | 2 +- .../wallet/send/input_amount/view.cljs | 7 +-- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/estimated_fees.cljs b/src/status_im/contexts/wallet/send/input_amount/estimated_fees.cljs index 533177324a..e924ab5c81 100644 --- a/src/status_im/contexts/wallet/send/input_amount/estimated_fees.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/estimated_fees.cljs @@ -6,10 +6,43 @@ [status-im.common.not-implemented :as not-implemented] [status-im.contexts.wallet.send.input-amount.style :as style] [status-im.feature-flags :as ff] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) + +(defn- bonder-fee-info-sheet + [] + [:<> + [quo/drawer-top + {:title (i18n/label :t/understanding-bonder-fees-title)}] + [rn/view {:style {:padding-horizontal 20}} + [quo/text + {:weight :regular + :size :paragraph-2} + (i18n/label :t/understanding-bonder-fees-description)]]]) + +(defn- show-bonder-fee-info + [] + (rf/dispatch + [:show-bottom-sheet {:content bonder-fee-info-sheet}])) + +(defn- received-amount + [{:keys [loading-routes?]}] + (let [amount (rf/sub [:wallet/send-total-amount-formatted]) + tx-type (rf/sub [:wallet/wallet-send-tx-type]) + {:keys [full-name]} (rf/sub [:wallet/bridge-to-network-details])] + (when (= tx-type :tx/bridge) + [quo/data-item + {:container-style style/amount-data-item + :status (if loading-routes? :loading :default) + :size :small + :title-icon :i/info + :title (i18n/label :t/bridged-to + {:network full-name}) + :subtitle amount + :on-press show-bonder-fee-info}]))) (defn view - [{:keys [loading-routes? bridge-tx? bridge-to-network bridge-to-value fees]}] + [{:keys [loading-routes? fees]}] [rn/view {:style style/estimated-fees-container} (when (ff/enabled? ::ff/wallet.advanced-sending) [rn/view {:style style/estimated-fees-content-container} @@ -28,10 +61,4 @@ :size :small :title (i18n/label :t/max-fees) :subtitle fees}] - (when bridge-tx? - [quo/data-item - {:container-style style/bridged-to-data-item - :status (if loading-routes? :loading :default) - :size :small - :title (i18n/label :t/bridged-to {:network bridge-to-network}) - :subtitle bridge-to-value}])]) + [received-amount {:loading-routes? loading-routes?}]]) diff --git a/src/status_im/contexts/wallet/send/input_amount/style.cljs b/src/status_im/contexts/wallet/send/input_amount/style.cljs index 9daa4b27ff..39958ca816 100644 --- a/src/status_im/contexts/wallet/send/input_amount/style.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/style.cljs @@ -29,7 +29,7 @@ :height 40 :background-color :transparent}) -(def bridged-to-data-item +(def amount-data-item {:flex 1 :height 40 :background-color :transparent}) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index cecfdd6b58..e2949879a9 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -280,11 +280,8 @@ (when (or (and (not no-routes-found?) (or loading-routes? route)) not-enough-asset?) [estimated-fees/view - {:loading-routes? loading-routes? - :fees fee-formatted - :bridge-tx? (= tx-type :tx/bridge) - :bridge-to-network (:full-name bridge-to-network-details) - :bridge-to-value (str bridge-to-value " " token-symbol)}]) + {:loading-routes? loading-routes? + :fees fee-formatted}]) (when show-no-routes? [no-routes-found]) [quo/bottom-actions