Skip to content

Commit

Permalink
fix event dispatching
Browse files Browse the repository at this point in the history
  • Loading branch information
vkjr committed Dec 14, 2023
1 parent b9f7d56 commit c74874a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 46 deletions.
4 changes: 4 additions & 0 deletions src/status_im2/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
db
(data-store/rpc->accounts wallet-accounts))
:fx [[:dispatch [:wallet/get-wallet-token]]
[:dispatch
[:wallet/request-collectibles
{:start-at-index 0
:new-request? true}]]
(when new-account?
[:dispatch [:wallet/navigate-to-new-account navigate-to-account]])]})))

Expand Down
77 changes: 31 additions & 46 deletions src/status_im2/contexts/wallet/home/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,37 @@
{:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab}])

(def aval
(atom {:a 1
:b 2}))

(reset! aval {:a 4})

(defn f-view-internal
[selected-tab]
(let [networks (rf/sub [:wallet/network-details])
account-cards-data (rf/sub [:wallet/account-cards-data])
accounts (rf/sub [:wallet/accounts])
cards (conj account-cards-data (new-account-card-data))]
(rn/use-effect (fn []
(rf/dispatch [:wallet/request-collectibles
{:start-at-index 0
:new-request? true}]))
[(count accounts)])
[rn/view {:style style/home-container}
[common.top-nav/view]
[rn/view {:style style/overview-container}
[quo/wallet-overview (temp/wallet-overview-state networks)]]
[quo/wallet-graph {:time-frame :empty}]
[rn/flat-list
{:style style/accounts-list
:content-container-style style/accounts-list-container
:data cards
:horizontal true
:separator [rn/view {:style styles/separator}]
:render-fn quo/account-card
:shows-horizontal-scroll-indicator false}]
[quo/tabs
{:style style/tabs
:size 32
:default-active @selected-tab
:data tabs-data
:on-change #(reset! selected-tab %)}]
(case @selected-tab
:assets [rn/flat-list
{:render-fn quo/token-value
:data temp/tokens
:key :assets-list
:content-container-style style/selected-tab-container}]
:collectibles [collectibles/view]
[activity/view])]))

(defn view
[]
(let [selected-tab (reagent/atom (:id (first tabs-data)))]
[:f> f-view-internal selected-tab]))
(fn []
(let [networks (rf/sub [:wallet/network-details])
account-cards-data (rf/sub [:wallet/account-cards-data])
cards (conj account-cards-data (new-account-card-data))]
[rn/view {:style style/home-container}
[common.top-nav/view]
[rn/view {:style style/overview-container}
[quo/wallet-overview (temp/wallet-overview-state networks)]]
[quo/wallet-graph {:time-frame :empty}]
[rn/flat-list
{:style style/accounts-list
:content-container-style style/accounts-list-container
:data cards
:horizontal true
:separator [rn/view {:style styles/separator}]
:render-fn quo/account-card
:shows-horizontal-scroll-indicator false}]
[quo/tabs
{:style style/tabs
:size 32
:default-active @selected-tab
:data tabs-data
:on-change #(reset! selected-tab %)}]
(case @selected-tab
:assets [rn/flat-list
{:render-fn quo/token-value
:data temp/tokens
:key :assets-list
:content-container-style style/selected-tab-container}]
:collectibles [collectibles/view]
[activity/view])]))))

0 comments on commit c74874a

Please sign in to comment.