From 0b1ab5b8117c891c959b3e94082081b3fd37134f Mon Sep 17 00:00:00 2001 From: Milad Date: Wed, 10 Apr 2024 11:49:41 +0330 Subject: [PATCH] add functionality --- .../wallet/common/token_value/view.cljs | 93 +++++++++++-------- 1 file changed, 53 insertions(+), 40 deletions(-) diff --git a/src/status_im/contexts/wallet/common/token_value/view.cljs b/src/status_im/contexts/wallet/common/token_value/view.cljs index c0a194f4963b..1601c9546c3a 100644 --- a/src/status_im/contexts/wallet/common/token_value/view.cljs +++ b/src/status_im/contexts/wallet/common/token_value/view.cljs @@ -3,50 +3,63 @@ [utils.i18n :as i18n] [utils.re-frame :as rf])) +(defn watch-only-token-value-drawer + [] + [quo/action-drawer + [[{:icon :i/settings + :accessibility-label :settings + :label (i18n/label :t/manage-tokens) + :on-press #(js/alert "to be implemented")} + {:icon :i/hide + :accessibility-label :hide + :label (i18n/label :t/hide) + :on-press #(js/alert "to be implemented")}]]]) + (defn token-value-drawer [token] (let [token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered (:token token)]))] - [:<> - [quo/action-drawer - [[{:icon :i/buy - :accessibility-label :buy - :label (i18n/label :t/buy) - :on-press #(js/alert "to be implemented") - :right-icon :i/external} - {:icon :i/send - :accessibility-label :send - :label (i18n/label :t/send) - :on-press (fn [] - (rf/dispatch [:hide-bottom-sheet]) - (rf/dispatch [:wallet/clean-send-data]) - (rf/dispatch [:wallet/send-select-token - {:token token-data - :start-flow? true}]))} - {:icon :i/receive - :accessibility-label :receive - :label (i18n/label :t/receive) - :on-press #(js/alert "to be implemented")} - {:icon :i/bridge - :accessibility-label :bridge - :label (i18n/label :t/bridge) - :on-press #(js/alert "to be implemented")} - {:icon :i/settings - :accessibility-label :settings - :label (i18n/label :t/manage-tokens) - :on-press #(js/alert "to be implemented") - :add-divider? true} - {:icon :i/hide - :accessibility-label :hide - :label (i18n/label :t/hide) - :on-press #(js/alert "to be implemented")}]]]])) + [quo/action-drawer + [[{:icon :i/buy + :accessibility-label :buy + :label (i18n/label :t/buy) + :on-press #(js/alert "to be implemented") + :right-icon :i/external} + {:icon :i/send + :accessibility-label :send + :label (i18n/label :t/send) + :on-press (fn [] + (rf/dispatch [:hide-bottom-sheet]) + (rf/dispatch [:wallet/clean-send-data]) + (rf/dispatch [:wallet/send-select-token + {:token token-data + :start-flow? true}]))} + {:icon :i/receive + :accessibility-label :receive + :label (i18n/label :t/receive) + :on-press #(js/alert "to be implemented")} + {:icon :i/bridge + :accessibility-label :bridge + :label (i18n/label :t/bridge) + :on-press #(js/alert "to be implemented")} + {:icon :i/settings + :accessibility-label :settings + :label (i18n/label :t/manage-tokens) + :on-press #(js/alert "to be implemented") + :add-divider? true} + {:icon :i/hide + :accessibility-label :hide + :label (i18n/label :t/hide) + :on-press #(js/alert "to be implemented")}]]])) (defn view [item _ _ {:keys [watch-only?]}] [quo/token-value - (cond-> item - (not watch-only?) - (assoc :on-long-press - #(rf/dispatch - [:show-bottom-sheet - {:content (fn [] [token-value-drawer item]) - :selected-item (fn [] [quo/token-value item])}])))]) + (merge item + {:on-long-press + #(rf/dispatch + [:show-bottom-sheet + {:content (fn [] + (if watch-only? + [watch-only-token-value-drawer] + [token-value-drawer item])) + :selected-item (fn [] [quo/token-value item])}])})])