Skip to content

Commit

Permalink
chore(wallet): show activity tab after sending a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 committed May 15, 2024
1 parent 91c347f commit 4ba54ed
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
15 changes: 6 additions & 9 deletions src/status_im/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.account.style :as style]
[status-im.contexts.wallet.account.tabs.view :as tabs]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
Expand All @@ -23,9 +22,8 @@

(defn view
[]
(let [selected-tab (reagent/atom first-tab-id)]
(fn []
(let [{:keys [name color formatted-balance
(let [selected-tab (or (rf/sub [:wallet/account-tab]) first-tab-id)
{:keys [name color formatted-balance
watch-only?]} (rf/sub [:wallet/current-viewing-account])
customization-color (rf/sub [:profile/customization-color])]
[rn/view {:style {:flex 1}}
Expand Down Expand Up @@ -61,16 +59,15 @@
[quo/tabs
{:style style/tabs
:size 32
:default-active @selected-tab
:default-active selected-tab
:data (tabs-data watch-only?)
:on-change (rn/use-callback (fn [tab]
(reset! selected-tab tab)))
:on-change #(rf/dispatch [:wallet/select-account-tab %])
:scrollable? true
:scroll-on-press? true}]
[tabs/view {:selected-tab @selected-tab}]
[tabs/view {:selected-tab selected-tab}]
[quo/floating-shell-button
{:jump-to
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
style/shell-button]]))))
style/shell-button]]))
4 changes: 4 additions & 0 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
[:dispatch [:navigate-to :screen/wallet.accounts address]]
[:dispatch [:wallet/show-account-created-toast address]]]}))

(rf/reg-event-fx :wallet/select-account-tab
(fn [{:keys [db]} [tab]]
{:db (assoc-in db [:wallet :ui :account-page :active-tab] tab)}))

(rf/reg-event-fx :wallet/switch-current-viewing-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)}))
Expand Down
10 changes: 5 additions & 5 deletions src/status_im/contexts/wallet/send/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,18 @@
(assoc-in [:wallet :transactions] transaction-details)
(assoc-in [:wallet :ui :send :transaction-ids] transaction-ids))
:fx [[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen :screen/wallet.transaction-confirmation
:flow-id :wallet-send-flow}]]]})))
[:wallet/end-transaction-flow]]]})))

(rf/reg-event-fx :wallet/close-transaction-progress-page
(rf/reg-event-fx :wallet/end-transaction-flow
(fn [_]
{:fx [[:dispatch [:wallet/clean-scanned-address]]
[:dispatch [:wallet/clean-local-suggestions]]
[:dispatch [:wallet/clean-send-address]]
[:dispatch [:wallet/clean-disabled-from-networks]]
[:dispatch [:wallet/select-address-tab nil]]
[:dispatch [:dismiss-modal :screen/wallet.transaction-progress]]]}))
[:dispatch [:wallet/fetch-activities]]
[:dispatch [:wallet/select-account-tab :activity]]
[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]]}))

(defn- transaction-data
[{:keys [from-address to-address token-address route data eth-transfer?]}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

(defn view
[]
(let [leave-page #(rf/dispatch [:wallet/close-transaction-progress-page])
(let [leave-page #(rf/dispatch [:wallet/end-transaction-flow])
{:keys [color]} (rf/sub [:wallet/current-viewing-account])]
(fn []
(rn/use-effect
Expand Down
6 changes: 6 additions & 0 deletions src/status_im/subs/wallet/wallet.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@
(fn [accounts]
(remove :watch-only? accounts)))

(rf/reg-sub
:wallet/account-tab
:<- [:wallet/ui]
(fn [ui]
(get-in ui [:account-page :active-tab])))

(rf/reg-sub
:wallet/current-viewing-account-token-values
:<- [:wallet/current-viewing-account]
Expand Down

0 comments on commit 4ba54ed

Please sign in to comment.