Skip to content

Commit fa73217

Browse files
authored
Basic market page (#22523)
* Market page basic implementation * fix safe area * feature flag * review notes fixed
1 parent 2594750 commit fa73217

File tree

15 files changed

+231
-13
lines changed

15 files changed

+231
-13
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ API_LOGGING_ENABLED=1
3939
SENTRY_ENABLED=0
4040
SENTRY_ENVIRONMENT=ci-main
4141
USE_PUBLIC_LOG_DIR=0
42+
FLAG_MARKET_ENABLED=0
833 Bytes
Loading
1.14 KB
Loading

src/quo/components/list_items/market_token/style.cljs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,3 @@
5454
(defn market-cap
5555
[theme]
5656
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)})
57-
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
(ns status-im.contexts.market.style
2+
(:require
3+
[quo.foundations.colors :as colors]
4+
[react-native.safe-area :as safe-area]
5+
[status-im.contexts.shell.constants :as constants]))
6+
7+
(defn header-background
8+
[theme]
9+
(colors/theme-colors colors/white colors/neutral-95 theme))
10+
11+
(defn swap-header-container
12+
[theme]
13+
{:background-color (header-background theme)
14+
:padding-horizontal 20
15+
:padding-vertical 12
16+
:flex-direction :row
17+
:justify-content :space-between})
18+
19+
(defn sort-header-container
20+
[theme]
21+
{:background-color (header-background theme)
22+
:padding-horizontal 20
23+
:padding-vertical 12
24+
:align-items :center
25+
:flex-direction :row})
26+
27+
(defn market-header-text
28+
[theme]
29+
{:color (colors/theme-colors colors/neutral-100 colors/white theme)})
30+
31+
(defn sort-text
32+
[theme]
33+
{:color (colors/theme-colors colors/neutral-40 colors/neutral-40 theme)})
34+
35+
(def list-container
36+
{:padding-bottom constants/floating-shell-button-height})
37+
38+
(defn home-container
39+
[]
40+
{:margin-top safe-area/top
41+
:flex 1})
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
(ns status-im.contexts.market.view
2+
(:require
3+
[quo.context]
4+
[quo.core :as quo]
5+
[quo.foundations.colors :as colors]
6+
[react-native.core :as rn]
7+
[status-im.common.home.top-nav.view :as common.top-nav]
8+
[status-im.common.refreshable-flat-list.view :as refreshable-flat-list]
9+
[status-im.contexts.market.style :as style]
10+
[utils.i18n :as i18n]
11+
[utils.re-frame :as rf]))
12+
13+
(defn swap-header
14+
[]
15+
(let [theme (quo.context/use-theme)]
16+
[rn/view {:style (style/swap-header-container theme)}
17+
[quo/text
18+
{:weight :semi-bold
19+
:size :heading-1
20+
:style (style/market-header-text theme)}
21+
(i18n/label :t/market)]
22+
[quo/button
23+
{:size 32
24+
:icon-left :i/swap
25+
:on-press #()}
26+
(i18n/label :t/swap)]]))
27+
28+
(defn sort-header
29+
[]
30+
(let [theme (quo.context/use-theme)]
31+
[rn/view {:style (style/sort-header-container theme)}
32+
[quo/text
33+
{:size :paragraph-2
34+
:style (style/sort-text theme)}
35+
(i18n/label :t/market-cap)]
36+
[quo/icon :i/arrow-down
37+
{:size 12
38+
:color colors/neutral-50
39+
:container-style {:margin-left 4}}]]))
40+
41+
(defn token
42+
[token-data]
43+
[quo/market-token token-data])
44+
45+
(defn view
46+
[]
47+
(let [tokens-loading? (rf/sub [:wallet/home-tokens-loading?])
48+
tokens (rf/sub [:market/tokens])
49+
[init-loaded? set-init-loaded] (rn/use-state false)]
50+
(rn/use-effect
51+
#(when (and (boolean? tokens-loading?) (not tokens-loading?) (not init-loaded?))
52+
(set-init-loaded true))
53+
[tokens-loading?])
54+
[rn/view {:style (style/home-container)}
55+
[common.top-nav/view]
56+
[refreshable-flat-list/view
57+
{:refresh-control [rn/refresh-control
58+
{:refreshing (and tokens-loading? init-loaded?)
59+
:colors [colors/neutral-40]
60+
:tint-color colors/neutral-40
61+
:on-refresh #()}]
62+
:header [rn/view
63+
[swap-header]
64+
[sort-header]]
65+
:content-container-style style/list-container
66+
:sticky-header-indices [0]
67+
:data tokens
68+
:render-fn token}]]))

src/status_im/contexts/shell/bottom_tabs/view.cljs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
[status-im.config :as config]
99
[status-im.contexts.shell.bottom-tabs.style :as style]
1010
[status-im.contexts.shell.constants :as shell.constants]
11+
[status-im.feature-flags :as ff]
1112
[utils.re-frame :as rf]))
1213

1314
(defn bottom-tab
14-
[icon stack-id shared-values notifications-data]
15-
(let [customization-color (rf/sub [:profile/customization-color])
15+
[icon stack-id shared-values]
16+
(let [notifications-data (rf/sub [:shell/bottom-tabs-notifications-data])
17+
customization-color (rf/sub [:profile/customization-color])
1618
on-press (rn/use-callback #(rf/dispatch [:shell/change-tab stack-id]))
1719
icon-color (->> stack-id
1820
(get shell.constants/tabs-icon-color-keywords)
@@ -29,8 +31,7 @@
2931

3032
(defn view
3133
[shared-values]
32-
(let [notifications-data (rf/sub [:shell/bottom-tabs-notifications-data])
33-
communities-double-tab-gesture (-> (gesture/gesture-tap)
34+
(let [communities-double-tab-gesture (-> (gesture/gesture-tap)
3435
(gesture/number-of-taps 2)
3536
(gesture/on-start
3637
(fn [_event]
@@ -44,10 +45,12 @@
4445
[reanimated/view
4546
{:style (style/bottom-tabs-container (:bottom-tabs-height shared-values))}
4647
[rn/view {:style (style/bottom-tabs)}
47-
[bottom-tab :i/wallet :screen/wallet-stack shared-values notifications-data]
48+
[bottom-tab :i/wallet :screen/wallet-stack shared-values]
49+
(when (ff/enabled? ::ff/market)
50+
[bottom-tab :i/swap :screen/market-stack shared-values])
4851
[gesture/gesture-detector {:gesture messages-double-tap-gesture}
49-
[bottom-tab :i/messages :screen/chats-stack shared-values notifications-data]]
52+
[bottom-tab :i/messages :screen/chats-stack shared-values]]
5053
[gesture/gesture-detector {:gesture communities-double-tab-gesture}
51-
[bottom-tab :i/communities :screen/communities-stack shared-values notifications-data]]
54+
[bottom-tab :i/communities :screen/communities-stack shared-values]]
5255
(when config/show-not-implemented-features?
53-
[bottom-tab :i/browser :screen/browser-stack shared-values notifications-data])]]]))
56+
[bottom-tab :i/browser :screen/browser-stack shared-values])]]]))

src/status_im/contexts/shell/constants.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@
1010

1111
;; Stacks
1212
(def stacks-ids
13-
#{:screen/communities-stack :screen/chats-stack :screen/wallet-stack :screen/browser-stack})
13+
#{:screen/communities-stack :screen/chats-stack :screen/wallet-stack :screen/browser-stack
14+
:screen/market-stack})
1415

1516
;; Keywords
1617
(def ^:const stacks-opacity-keywords
1718
{:screen/communities-stack :communities-stack-opacity
1819
:screen/chats-stack :chats-stack-opacity
1920
:screen/wallet-stack :wallet-stack-opacity
21+
:screen/market-stack :market-stack-opacity
2022
:screen/browser-stack :browser-stack-opacity})
2123

2224
(def ^:const tabs-icon-color-keywords
2325
{:screen/communities-stack :communities-tab-icon-color
2426
:screen/chats-stack :chats-tab-icon-opacity
2527
:screen/wallet-stack :wallet-tab-icon-opacity
28+
:screen/market-stack :market-tab-icon-opacity
2629
:screen/browser-stack :browser-tab-icon-opacity})
2730

2831
(def ^:const stacks-z-index-keywords
2932
{:screen/communities-stack :communities-stack-z-index
3033
:screen/chats-stack :chats-stack-z-index
3134
:screen/wallet-stack :wallet-stack-z-index
35+
:screen/market-stack :market-stack-z-index
3236
:screen/browser-stack :browser-stack-z-index})

src/status_im/contexts/shell/home_stack/view.cljs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[react-native.reanimated :as reanimated]
77
[status-im.contexts.chat.home.view :as chat]
88
[status-im.contexts.communities.home.view :as communities]
9+
[status-im.contexts.market.view :as market]
910
[status-im.contexts.shell.constants :as shell.constants]
1011
[status-im.contexts.shell.home-stack.style :as style]
1112
[status-im.contexts.shell.state :as state]
@@ -17,7 +18,8 @@
1718
:screen/communities-stack @state/load-communities-stack?
1819
:screen/chats-stack @state/load-chats-stack?
1920
:screen/browser-stack @state/load-browser-stack?
20-
:screen/wallet-stack @state/load-wallet-stack?))
21+
:screen/wallet-stack @state/load-wallet-stack?
22+
:screen/market-stack @state/load-market-stack?))
2123

2224
(defn- f-stack-view
2325
[stack-id shared-values]
@@ -32,6 +34,7 @@
3234
:screen/communities-stack [communities/view]
3335
:screen/chats-stack [chat/view]
3436
:screen/wallet-stack [wallet/view]
37+
:screen/market-stack [market/view]
3538
:screen/browser-stack [browser.stack/browser-stack]
3639
[:<>])])
3740

@@ -48,4 +51,5 @@
4851
[lazy-screen :screen/communities-stack shared-values theme]
4952
[lazy-screen :screen/chats-stack shared-values theme]
5053
[lazy-screen :screen/browser-stack shared-values theme]
51-
[lazy-screen :screen/wallet-stack shared-values theme]]))
54+
[lazy-screen :screen/wallet-stack shared-values theme]
55+
[lazy-screen :screen/market-stack shared-values theme]]))

src/status_im/contexts/shell/state.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
(def load-communities-stack? (reagent/atom false))
1212
(def load-chats-stack? (reagent/atom false))
1313
(def load-wallet-stack? (reagent/atom false))
14+
(def load-market-stack? (reagent/atom false))
1415
(def load-browser-stack? (reagent/atom false))

0 commit comments

Comments
 (0)