Skip to content

Commit

Permalink
fetch tokens and (wip) render token network fields
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed Nov 2, 2023
1 parent f5ce963 commit 151d240
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/status_im2/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:customization-color :blue}]
[quo/wallet-graph {:time-frame :empty}]
[quo/wallet-ctas
{:send-action #(rf/dispatch [:open-modal :wallet-select-address])
{:send-action #(rf/dispatch [:open-modal :wallet-select-address (:address account)])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-drawer}])}]
[quo/tabs
Expand Down
37 changes: 19 additions & 18 deletions src/status_im2/contexts/wallet/send/select_asset/view.cljs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
(ns status-im2.contexts.wallet.send.select-asset.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.contexts.wallet.send.select-asset.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[quo.foundations.resources :as quo.resources]
[status-im2.contexts.quo-preview.list-items.token-network :as token-network]))
[utils.re-frame :as rf]))

(def tabs-data
[{:id :tab/assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
Expand All @@ -18,28 +17,28 @@

(defn- asset-component
[]
(fn [token-network _ _ _]
(fn [token _ _ _]
(let [_ {:on-press #(js/alert "Not implemented yet")
:active-state? false}]
[quo/token-network
token-network])))
(println token "token")
[quo/token-network token])))

(defn- asset-list
[]
[account-address]
(fn []
(let [local-suggestion (rf/sub [:wallet/local-suggestions])]
(let [tokens (rf/sub [:wallet/tokens])]
[rn/view {:style {:flex 1}}
[rn/flat-list
{:data local-suggestion
{:data (get tokens (keyword account-address))
:content-container-style {:flex-grow 1}
:key-fn :id
:on-scroll-to-index-failed identity
:render-fn asset-component}]])))

(defn- tab-view
[selected-tab]
[account selected-tab]
(case selected-tab
:tab/assets [asset-list]
:tab/assets [asset-list account]
:tab/collectibles [quo/empty-state
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
Expand All @@ -52,10 +51,12 @@
[rn/view]))

(defn- f-view-internal
[]
(let [margin-top (safe-area/get-top)
selected-tab (reagent/atom (:id (first tabs-data)))
on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])]
[account-address]
(let [margin-top (safe-area/get-top)
selected-tab (reagent/atom (:id (first tabs-data)))
account-address (string/lower-case (or account-address
(rf/sub [:get-screen-params :wallet-accounts])))
on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])]
(fn []
[rn/scroll-view
{:content-container-style (style/container margin-top)
Expand Down Expand Up @@ -83,10 +84,10 @@
:data tabs-data
:on-change #(reset! selected-tab %)}]
[search-input]
[tab-view @selected-tab]])))
[tab-view account-address @selected-tab]])))

(defn- view-internal
[]
[:f> f-view-internal])
[{:keys [account-address]}]
[:f> f-view-internal account-address])

(def view (quo.theme/with-theme view-internal))

0 comments on commit 151d240

Please sign in to comment.