feat(wallet): add receive screen on wallet home and make wallet tab f… (#20219)
This commit is contained in:
parent
36be518174
commit
630be6685d
|
@ -30,12 +30,15 @@
|
|||
; should be :notification TODO
|
||||
; https://github.com/status-im/status-mobile/issues/17102
|
||||
:unread-indicator/new :mention
|
||||
nil)]
|
||||
nil)
|
||||
view-id (rf/sub [:view-id])
|
||||
initial-share-tab (if (= :wallet-stack view-id) :wallet :profile)]
|
||||
[quo/top-nav
|
||||
{:avatar-on-press #(rf/dispatch [:open-modal :settings])
|
||||
:scan-on-press #(rf/dispatch [:open-modal :shell-qr-reader])
|
||||
:activity-center-on-press #(rf/dispatch [:activity-center/open])
|
||||
:qr-code-on-press #(rf/dispatch [:open-modal :screen/share-shell])
|
||||
:qr-code-on-press #(rf/dispatch [:open-modal :screen/share-shell
|
||||
{:initial-tab initial-share-tab}])
|
||||
:container-style (merge style/top-nav-container container-style)
|
||||
:blur? blur?
|
||||
:jump-to? jump-to?
|
||||
|
|
|
@ -70,7 +70,8 @@
|
|||
:icon-name :i/close
|
||||
:on-press #(rf/dispatch [:navigate-back])
|
||||
:right-side [{:icon-name :i/qr-code
|
||||
:on-press #(debounce/throttle-and-dispatch [:open-modal :screen/share-shell]
|
||||
:on-press #(debounce/throttle-and-dispatch [:open-modal :screen/share-shell
|
||||
{:initial-tab :profile}]
|
||||
1000)}
|
||||
{:icon-name :i/share
|
||||
:on-press #(rf/dispatch [:open-share
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.shell.share.profile.view :as profile-view]
|
||||
[status-im.contexts.shell.share.style :as style]
|
||||
[status-im.contexts.shell.share.wallet.view :as wallet-view]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn header
|
||||
(defn- header
|
||||
[]
|
||||
[:<>
|
||||
[rn/view {:style style/header-row}
|
||||
|
@ -39,29 +38,29 @@
|
|||
:style style/header-heading}
|
||||
(i18n/label :t/share)]])
|
||||
|
||||
(defn tab-content
|
||||
[]
|
||||
(let [selected-tab (reagent/atom :profile)]
|
||||
(fn []
|
||||
[rn/view {:style {:padding-top (safe-area/get-top)}}
|
||||
[header]
|
||||
[rn/view {:style style/tabs-container}
|
||||
[quo/segmented-control
|
||||
{:size 28
|
||||
:blur? true
|
||||
:on-change #(reset! selected-tab %)
|
||||
:default-active :profile
|
||||
:data [{:id :profile
|
||||
:label (i18n/label :t/profile)}
|
||||
{:id :wallet
|
||||
:label (i18n/label :t/wallet)}]}]]
|
||||
(if (= @selected-tab :profile)
|
||||
[profile-view/profile-tab]
|
||||
[wallet-view/wallet-tab])])))
|
||||
(defn- tab-content
|
||||
[initial-tab]
|
||||
(let [[selected-tab set-selected-tab] (rn/use-state initial-tab)]
|
||||
[rn/view {:style {:padding-top (safe-area/get-top)}}
|
||||
[header]
|
||||
[rn/view {:style style/tabs-container}
|
||||
[quo/segmented-control
|
||||
{:size 28
|
||||
:blur? true
|
||||
:on-change set-selected-tab
|
||||
:default-active selected-tab
|
||||
:data [{:id :profile
|
||||
:label (i18n/label :t/profile)}
|
||||
{:id :wallet
|
||||
:label (i18n/label :t/wallet)}]}]]
|
||||
(if (= selected-tab :wallet)
|
||||
[wallet-view/wallet-tab]
|
||||
[profile-view/profile-tab])]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
[quo/overlay {:type :shell}
|
||||
[rn/view
|
||||
{:key :share}
|
||||
[tab-content]]])
|
||||
(let [{:keys [initial-tab] :or {initial-tab :profile}} (rf/sub [:get-screen-params])]
|
||||
[quo/overlay {:type :shell}
|
||||
[rn/view
|
||||
{:key :share}
|
||||
[tab-content initial-tab]]]))
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
(let [chain-id (or (:chain-id token-in) (:chain-id token-out))
|
||||
amount-in-units (native-module/hex-to-number
|
||||
(utils.hex/normalize-hex amount-in))
|
||||
amount-in-value (money/with-precision
|
||||
(money/wei->ether amount-in-units)
|
||||
precision)
|
||||
amount-in-value (str (money/with-precision
|
||||
(money/wei->ether amount-in-units)
|
||||
precision))
|
||||
amount-out-units (native-module/hex-to-number
|
||||
(utils.hex/normalize-hex amount-out))
|
||||
amount-out-value (money/with-precision
|
||||
(money/wei->ether amount-out-units)
|
||||
precision)
|
||||
amount-out-value (str (money/with-precision
|
||||
(money/wei->ether amount-out-units)
|
||||
precision))
|
||||
relative-date (datetime/timestamp->relative (* timestamp 1000))
|
||||
receiving-activity? (= activity-type constants/wallet-activity-type-receive)]
|
||||
[quo/wallet-activity
|
||||
|
|
|
@ -26,11 +26,13 @@
|
|||
(rf/dispatch [:wallet/set-token-to-send send-params]))})
|
||||
|
||||
(defn- action-receive
|
||||
[]
|
||||
[selected-account?]
|
||||
{:icon :i/receive
|
||||
:accessibility-label :receive
|
||||
:label (i18n/label :t/receive)
|
||||
:on-press #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}])})
|
||||
:on-press (if selected-account?
|
||||
#(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}])
|
||||
#(rf/dispatch [:open-modal :screen/share-shell {:initial-tab :wallet}]))})
|
||||
|
||||
(defn- action-bridge
|
||||
[token-data]
|
||||
|
@ -80,7 +82,7 @@
|
|||
(action-hide))]
|
||||
(not watch-only?) (concat [(action-buy)
|
||||
(action-send send-params)
|
||||
(action-receive)
|
||||
(action-receive selected-account?)
|
||||
(when (ff/enabled? ::ff/wallet.swap) (action-swap))
|
||||
(action-bridge token-data)]))]]))
|
||||
|
||||
|
|
Loading…
Reference in New Issue