-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Brian Sztamfater <brian@status.im>
- Loading branch information
1 parent
cc990d5
commit 9286a8d
Showing
6 changed files
with
132 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/status_im2/contexts/wallet/send/select_asset/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns status-im2.contexts.wallet.send.select-asset.style) | ||
|
||
(defn container | ||
[margin-top] | ||
{:flex 1 | ||
:margin-top margin-top}) | ||
|
||
(def title-container | ||
{:margin-horizontal 20 | ||
:margin-vertical 12}) | ||
|
||
(def tabs | ||
{:padding-top 20 | ||
:padding-bottom 12}) | ||
|
||
(def tabs-content | ||
{:padding-left 20 | ||
:padding-right 8}) | ||
|
||
(def empty-container-style | ||
{:justify-content :center | ||
:flex 1 | ||
:margin-bottom 44}) | ||
|
||
(def button | ||
{:justify-self :flex-end | ||
:margin-bottom 46 | ||
:margin-horizontal 20}) |
88 changes: 88 additions & 0 deletions
88
src/status_im2/contexts/wallet/send/select_asset/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
(ns status-im2.contexts.wallet.send.select-asset.view | ||
(:require | ||
[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])) | ||
|
||
(def tabs-data | ||
[{:id :tab/assets :label (i18n/label :t/assets) :accessibility-label :assets-tab} | ||
{:id :tab/collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}]) | ||
|
||
(defn- asset-component | ||
[] | ||
(fn [_ _ _ _] | ||
(let [_ {:on-press #(js/alert "Not implemented yet") | ||
:active-state? false}] | ||
[rn/view]))) | ||
|
||
(defn- asset-list | ||
[] | ||
(fn [] | ||
(let [local-suggestion (rf/sub [:wallet/local-suggestions])] | ||
[rn/view {:style {:flex 1}} | ||
[rn/flat-list | ||
{:data local-suggestion | ||
:content-container-style {:flex-grow 1} | ||
:key-fn :id | ||
:on-scroll-to-index-failed identity | ||
:render-fn asset-component}]]))) | ||
|
||
(defn- tab-view | ||
[selected-tab] | ||
(case selected-tab | ||
:tab/assets [asset-list] | ||
:tab/collectibles [quo/empty-state | ||
{:title (i18n/label :t/no-collectibles) | ||
:description (i18n/label :t/no-collectibles-description) | ||
:placeholder? true | ||
:container-style style/empty-container-style}])) | ||
|
||
(defn- search-input | ||
[] | ||
(fn [] | ||
[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])] | ||
(fn [] | ||
[rn/scroll-view | ||
{:content-container-style (style/container margin-top) | ||
:keyboard-should-persist-taps :never | ||
:scroll-enabled false} | ||
[quo/page-nav | ||
{:icon-name :i/arrow-left | ||
:on-press on-close | ||
:accessibility-label :top-bar | ||
:right-side :account-switcher | ||
:account-switcher {:customization-color :purple | ||
:on-press #(js/alert "Not implemented yet") | ||
:state :default | ||
:emoji "🍑"}}] | ||
[quo/text-combinations | ||
{:title (i18n/label :t/select-asset) | ||
:container-style style/title-container | ||
:title-accessibility-label :title-label}] | ||
[quo/segmented-control | ||
{:size 32 | ||
:blur? false | ||
:symbol false | ||
:default-active :tab/assets | ||
:container-style {:margin-horizontal 20} | ||
:data tabs-data | ||
:on-change #(reset! selected-tab %)}] | ||
[search-input] | ||
[tab-view @selected-tab]]))) | ||
|
||
(defn- view-internal | ||
[] | ||
[:f> f-view-internal]) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters