Skip to content

Commit

Permalink
add functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilad75 committed Apr 12, 2024
1 parent f8cc85f commit ab3beb0
Showing 1 changed file with 53 additions and 40 deletions.
93 changes: 53 additions & 40 deletions src/status_im/contexts/wallet/common/token_value/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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])}])})])

0 comments on commit ab3beb0

Please sign in to comment.