Skip to content

Commit f6ce637

Browse files
Update entry points for Quo2 Preview (#16843)
This commit adds two new entry points (button on the top right corner in the navigation bar) for the Quo2 preview screen without having to log in to the app: - "New to Status" - "login" Additionally, this commit updates the theme switcher to be sticky at the top of the Quo2 preview screen to quickly change the theme without having to scroll all the way top. Signed-off-by: Mohamed Javid <[email protected]>
1 parent d9b54c4 commit f6ce637

File tree

4 files changed

+87
-47
lines changed

4 files changed

+87
-47
lines changed

src/status_im2/contexts/onboarding/new_to_status/view.cljs

+15-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
[utils.i18n :as i18n]
1010
[utils.re-frame :as rf]
1111
[status-im2.contexts.onboarding.common.overlay.view :as overlay]
12-
[status-im2.contexts.profile.profiles.view :as profiles]))
12+
[status-im2.contexts.profile.profiles.view :as profiles]
13+
[status-im2.config :as config]))
1314

1415
(defn navigate-back
1516
[]
@@ -109,14 +110,19 @@
109110
:icon-background :blur
110111
:icon :i/arrow-left
111112
:on-press navigate-back}
112-
:right-section-buttons [{:type :grey
113-
:icon :i/info
114-
:icon-background :blur
115-
:icon-override-theme :dark
116-
:on-press #(rf/dispatch
117-
[:show-bottom-sheet
118-
{:content getting-started-doc
119-
:shell? true}])}]}]])
113+
:right-section-buttons [(when config/quo-preview-enabled?
114+
{:type :grey
115+
:icon :i/reveal-whitelist
116+
:icon-background :blur
117+
:on-press #(rf/dispatch [:navigate-to
118+
:quo2-preview])})
119+
{:type :grey
120+
:icon :i/info
121+
:icon-background :blur
122+
:on-press #(rf/dispatch
123+
[:show-bottom-sheet
124+
{:content getting-started-doc
125+
:shell? true}])}]}]])
120126

121127
(defn new-to-status
122128
[]

src/status_im2/contexts/profile/profiles/style.cljs

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@
4545
:padding-top 56
4646
:padding-horizontal 20})
4747

48-
(def multi-profile-button
49-
{:align-self :flex-end
50-
:margin-bottom 20})
48+
(def multi-profile-button-container
49+
{:flex-direction :row
50+
:justify-content :flex-end
51+
:margin-bottom 20})
5152

5253
(def login-profile-card
5354
{:margin-bottom 20})

src/status_im2/contexts/profile/profiles/view.cljs

+30-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
(ns status-im2.contexts.profile.profiles.view
2-
(:require [native-module.core :as native-module]
2+
(:require [clojure.string :as string]
3+
[native-module.core :as native-module]
34
[quo2.core :as quo]
5+
[quo2.foundations.colors :as colors]
46
[react-native.core :as rn]
7+
[react-native.reanimated :as reanimated]
8+
[react-native.safe-area :as safe-area]
59
[reagent.core :as reagent]
610
[status-im2.common.confirmation-drawer.view :as confirmation-drawer]
11+
[status-im2.config :as config]
12+
[status-im2.constants :as constants]
713
[status-im2.contexts.onboarding.common.background.view :as background]
814
[status-im2.contexts.profile.profiles.style :as style]
915
[taoensso.timbre :as log]
1016
[utils.i18n :as i18n]
1117
[utils.re-frame :as rf]
1218
[utils.security.core :as security]
13-
[utils.transforms :as types]
14-
[quo2.foundations.colors :as colors]
15-
[react-native.safe-area :as safe-area]
16-
[clojure.string :as string]
17-
[react-native.reanimated :as reanimated]
18-
[status-im2.constants :as constants]))
19+
[utils.transforms :as types]))
1920

2021
(defonce push-animation-fn-atom (atom nil))
2122
(defonce pop-animation-fn-atom (atom nil))
@@ -228,16 +229,28 @@
228229
[rn/keyboard-avoiding-view
229230
{:style style/login-container
230231
:keyboardVerticalOffset (- (safe-area/get-bottom))}
231-
[quo/button
232-
{:size 32
233-
:type :grey
234-
:background :blur
235-
:icon-only? true
236-
:on-press set-show-profiles
237-
:disabled? processing
238-
:accessibility-label :show-profiles
239-
:container-style style/multi-profile-button}
240-
:i/multi-profile]
232+
[rn/view
233+
{:style style/multi-profile-button-container}
234+
(when config/quo-preview-enabled?
235+
[quo/button
236+
{:size 32
237+
:type :grey
238+
:background :blur
239+
:icon-only? true
240+
:on-press #(rf/dispatch [:navigate-to :quo2-preview])
241+
:disabled? processing
242+
:accessibility-label :quo2-preview
243+
:container-style {:margin-right 12}}
244+
:i/reveal-whitelist])
245+
[quo/button
246+
{:size 32
247+
:type :grey
248+
:background :blur
249+
:icon-only? true
250+
:on-press set-show-profiles
251+
:disabled? processing
252+
:accessibility-label :show-profiles}
253+
:i/multi-profile]]
241254
[rn/scroll-view
242255
{:keyboard-should-persist-taps :always
243256
:style {:flex 1}}

src/status_im2/contexts/quo_preview/main.cljs

+38-18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require
44
[quo2.core :as quo]
55
[quo2.foundations.colors :as colors]
6-
[re-frame.core :as re-frame]
6+
[reagent.core :as reagent]
77
[react-native.core :as rn]
88
[status-im2.common.theme.core :as theme]
99
[status-im2.contexts.quo-preview.animated-header-list.animated-header-list :as animated-header-list]
@@ -107,7 +107,7 @@
107107
[status-im2.contexts.quo-preview.wallet.network-bridge :as network-bridge]
108108
[status-im2.contexts.quo-preview.wallet.account-card :as account-card]
109109
[status-im2.contexts.quo-preview.wallet.token-input :as token-input]
110-
[reagent.core :as reagent]))
110+
[utils.re-frame :as rf]))
111111

112112
(def screens-categories
113113
{:foundations [{:name :shadows
@@ -206,7 +206,7 @@
206206
:options {:topBar {:visible true}}
207207
:component action-drawers/preview-action-drawers}
208208
{:name :documentation-drawer
209-
:insets {:top false}
209+
:options {:topBar {:visible true}}
210210
:component documenation-drawers/preview-documenation-drawers}
211211
{:name :drawer-buttons
212212
:options {:topBar {:visible true}}
@@ -420,11 +420,29 @@
420420

421421
(def screens (flatten (map val screens-categories)))
422422

423+
(defn navigation-bar
424+
[]
425+
(let [logged-in? (rf/sub [:multiaccount/logged-in?])
426+
has-profiles? (boolean (rf/sub [:profile/profiles-overview]))]
427+
[quo/page-nav
428+
{:align-mid? true
429+
:mid-section {:type :text-only
430+
:main-text "Quo2 components preview"}
431+
:left-section {:icon :i/close
432+
:on-press (fn []
433+
(when-not logged-in?
434+
(theme/set-theme :dark))
435+
(rf/dispatch [:navigate-back])
436+
(when-not has-profiles?
437+
(rf/dispatch [:open-modal :new-to-status])))}}]))
438+
423439
(defn theme-switcher
424440
[]
425441
[rn/view
426-
{:style {:flex-direction :row
427-
:margin-vertical 8}}
442+
{:style {:flex-direction :row
443+
:justify-content :space-between
444+
:padding-horizontal 24
445+
:padding-vertical 12}}
428446
[quo/button {:on-press #(theme/set-theme :light)} "Set light theme"]
429447
[quo/button {:on-press #(theme/set-theme :dark)} "Set dark theme"]])
430448

@@ -441,26 +459,28 @@
441459
[quo/button
442460
{:type :outline
443461
:container-style {:margin-vertical 8}
444-
:on-press #(re-frame/dispatch [:navigate-to name])}
462+
:on-press #(rf/dispatch [:navigate-to name])}
445463
(clojure.core/name name)]))])))
446464

447465
(defn main-screen
448466
[]
449467
(fn []
450-
[rn/scroll-view
451-
{:flex 1
452-
:padding-bottom 8
453-
:padding-horizontal 16
454-
:background-color (colors/theme-colors colors/white colors/neutral-90)}
468+
[:<>
469+
[navigation-bar]
455470
[theme-switcher]
456-
[quo/text {:size :heading-1} "Preview Quo2 Components"]
457-
[rn/view
458-
(map (fn [category]
459-
^{:key (get category 0)}
460-
[category-view category])
461-
(sort screens-categories))]]))
471+
[rn/scroll-view
472+
{:flex 1
473+
:padding-bottom 8
474+
:padding-horizontal 16
475+
:background-color (colors/theme-colors colors/white colors/neutral-90)}
476+
[rn/view
477+
(map (fn [category]
478+
^{:key (get category 0)}
479+
[category-view category])
480+
(sort screens-categories))]]]))
462481

463482
(def main-screens
464483
[{:name :quo2-preview
465-
:options {:topBar {:visible true}}
484+
:options {:topBar {:visible false}
485+
:insets {:top? true}}
466486
:component main-screen}])

0 commit comments

Comments
 (0)