|
5 | 5 | [status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
|
6 | 6 | [status-im.feature-flags :as ff]
|
7 | 7 | [utils.i18n :as i18n]
|
| 8 | + [utils.money :as money] |
8 | 9 | [utils.re-frame :as rf]))
|
9 | 10 |
|
10 | 11 | (defn- action-buy
|
|
21 | 22 | {:icon :i/send
|
22 | 23 | :accessibility-label :send
|
23 | 24 | :label (i18n/label :t/send)
|
| 25 | + :disabled? (:disabled? send-params) |
24 | 26 | :on-press (fn []
|
25 | 27 | (rf/dispatch [:hide-bottom-sheet])
|
26 | 28 | (rf/dispatch [:wallet/clean-send-data])
|
|
69 | 71 |
|
70 | 72 | (defn token-value-drawer
|
71 | 73 | [token watch-only? entry-point]
|
72 |
| - (let [token-symbol (:token token) |
73 |
| - token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered |
74 |
| - token-symbol])) |
75 |
| - selected-account? (rf/sub [:wallet/current-viewing-account-address]) |
76 |
| - token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol]) |
77 |
| - send-params (if selected-account? |
78 |
| - {:token token-data |
79 |
| - :stack-id :screen/wallet.accounts |
80 |
| - :start-flow? true |
81 |
| - :owners token-owners} |
82 |
| - {:token-symbol token-symbol |
83 |
| - :stack-id :wallet-stack |
84 |
| - :start-flow? true |
85 |
| - :owners token-owners}) |
86 |
| - bridge-params (if selected-account? |
87 |
| - {:token token-data |
88 |
| - :bridge-disabled? (send-utils/bridge-disabled? token-symbol) |
89 |
| - :stack-id :screen/wallet.accounts |
90 |
| - :start-flow? true |
91 |
| - :owners token-owners} |
92 |
| - {:token-symbol token-symbol |
93 |
| - :bridge-disabled? (send-utils/bridge-disabled? token-symbol) |
94 |
| - :stack-id :wallet-stack |
95 |
| - :start-flow? true |
96 |
| - :owners token-owners})] |
| 74 | + (let [token-symbol (:token token) |
| 75 | + token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered |
| 76 | + token-symbol])) |
| 77 | + fiat-unformatted-value (get-in token [:values :fiat-unformatted-value]) |
| 78 | + has-balance? (money/greater-than fiat-unformatted-value (money/bignumber "0")) |
| 79 | + selected-account? (rf/sub [:wallet/current-viewing-account-address]) |
| 80 | + token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol]) |
| 81 | + send-params (if selected-account? |
| 82 | + {:token token-data |
| 83 | + :stack-id :screen/wallet.accounts |
| 84 | + :disabled? (not has-balance?) |
| 85 | + :start-flow? true |
| 86 | + :owners token-owners} |
| 87 | + {:token-symbol token-symbol |
| 88 | + :stack-id :wallet-stack |
| 89 | + :start-flow? true |
| 90 | + :owners token-owners}) |
| 91 | + bridge-params (if selected-account? |
| 92 | + {:token token-data |
| 93 | + :bridge-disabled? (or (not has-balance?) |
| 94 | + (send-utils/bridge-disabled? token-symbol)) |
| 95 | + :stack-id :screen/wallet.accounts |
| 96 | + :start-flow? true |
| 97 | + :owners token-owners} |
| 98 | + {:token-symbol token-symbol |
| 99 | + :bridge-disabled? (send-utils/bridge-disabled? token-symbol) |
| 100 | + :stack-id :wallet-stack |
| 101 | + :start-flow? true |
| 102 | + :owners token-owners})] |
97 | 103 | [quo/action-drawer
|
98 | 104 | [(cond->> [(when (ff/enabled? ::ff/wallet.assets-modal-manage-tokens)
|
99 | 105 | (action-manage-tokens watch-only?))
|
|
0 commit comments