Skip to content

Commit 6b72126

Browse files
[#17986] feat: implement new settings ui, header section (#17991)
1 parent 589a581 commit 6b72126

File tree

16 files changed

+416
-7
lines changed

16 files changed

+416
-7
lines changed

src/quo/components/overlay/style.cljs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(ns quo.components.overlay.style
2+
(:require [quo.foundations.colors :as colors]))
3+
4+
(defn overlay-background
5+
[type]
6+
(let [background-color (case type
7+
:shell colors/neutral-80-opa-80-blur
8+
:drawer colors/neutral-100-opa-70-blur
9+
nil)]
10+
{:position :absolute
11+
:top 0
12+
:left 0
13+
:right 0
14+
:bottom 0
15+
:background-color background-color}))
16+
17+
(def container
18+
{:flex 1})
19+
20+
(def blur-container
21+
{:flex 1
22+
:background-color :transparent})

src/quo/components/overlay/view.cljs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(ns quo.components.overlay.view
2+
(:require
3+
[quo.components.overlay.style :as style]
4+
[react-native.blur :as blur]
5+
[react-native.core :as rn]))
6+
7+
(defn view
8+
[{:keys [type]} & children]
9+
[rn/view {:style (style/overlay-background type)}
10+
(if (= type :shell)
11+
[blur/view
12+
{:blur-amount 20
13+
:blur-radius 25
14+
:blur-type :transparent
15+
:overlay-color :transparent
16+
:style style/container}
17+
[rn/view {:style style/blur-container}
18+
children]]
19+
[rn/view {:style style/container}
20+
children])])

src/quo/components/text_combinations/style.cljs

+5
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99

1010
(def description-description-text
1111
{:margin-top 8})
12+
13+
(def emoji-hash
14+
{:margin-top 8
15+
:letter-spacing 0.5
16+
:line-height 20.5})

src/quo/components/text_combinations/view.cljs

+8-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
description-accessibility-label
2828
button-icon
2929
button-on-press
30-
customization-color]}]
30+
customization-color
31+
emoji-hash]}]
3132
[rn/view {:style container-style}
3233
[rn/view
3334
{:style {:flex-direction :row
@@ -55,6 +56,11 @@
5556
:weight :regular
5657
:size :paragraph-1
5758
:style style/description-description-text}
58-
description])])
59+
description])
60+
(when emoji-hash
61+
[text/text
62+
{:number-of-lines 1
63+
:style style/emoji-hash}
64+
emoji-hash])])
5965

6066
(def view (theme/with-theme view-internal))

src/quo/core.cljs

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
quo.components.numbered-keyboard.keyboard-key.view
102102
quo.components.numbered-keyboard.numbered-keyboard.view
103103
quo.components.onboarding.small-option-card.view
104+
quo.components.overlay.view
104105
quo.components.password.tips.view
105106
quo.components.profile.collectible.view
106107
quo.components.profile.profile-card.view
@@ -316,6 +317,9 @@
316317
(def notification quo.components.notifications.notification.view/notification)
317318
(def toast quo.components.notifications.toast.view/toast)
318319

320+
;;;; Overlay
321+
(def overlay quo.components.overlay.view/view)
322+
319323
;;;; Password
320324
(def tips quo.components.password.tips.view/view)
321325

src/quo/foundations/colors.cljs

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@
148148
(def black-opa-30 (alpha black 0.3))
149149
(def black-opa-60 (alpha black 0.6))
150150
(def onboarding-header-black "#000716")
151-
151+
(def border-avatar-light
152+
"Simulates a blurred, transparent border for avatars in light mode"
153+
"#475060")
152154
;;;;Primary
153155

154156
;;Solid
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(ns status-im2.contexts.profile.settings.header.avatar
2+
(:require [quo.core :as quo]
3+
[quo.theme :as quo.theme]
4+
[react-native.reanimated :as reanimated]
5+
[status-im2.contexts.profile.settings.header.style :as style]))
6+
7+
(def scroll-animation-input-range [0 50])
8+
(def header-extrapolation-option
9+
{:extrapolateLeft "clamp"
10+
:extrapolateRight "clamp"})
11+
12+
(defn f-avatar
13+
[{:keys [scroll-y full-name online? profile-picture customization-color]}]
14+
(let [image-scale-animation (reanimated/interpolate scroll-y
15+
scroll-animation-input-range
16+
[1 0.5]
17+
header-extrapolation-option)
18+
image-top-margin-animation (reanimated/interpolate scroll-y
19+
scroll-animation-input-range
20+
[0 20]
21+
header-extrapolation-option)
22+
image-side-margin-animation (reanimated/interpolate scroll-y
23+
scroll-animation-input-range
24+
[0 -20]
25+
header-extrapolation-option)
26+
theme (quo.theme/get-theme)]
27+
[reanimated/view
28+
{:style (style/avatar-container theme
29+
image-scale-animation
30+
image-top-margin-animation
31+
image-side-margin-animation)}
32+
[quo/user-avatar
33+
{:full-name full-name
34+
:online? online?
35+
:profile-picture profile-picture
36+
:status-indicator? true
37+
:ring? true
38+
:customization-color customization-color
39+
:size :big}]]))
40+
41+
(defn view
42+
[props]
43+
[:f> f-avatar props])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(ns status-im2.contexts.profile.settings.header.header-shape
2+
(:require [quo.foundations.colors :as colors]
3+
[react-native.core :as rn]
4+
[react-native.reanimated :as reanimated]
5+
[react-native.svg :as svg]
6+
[status-im2.contexts.profile.settings.header.style :as style]))
7+
8+
(defn left-radius
9+
[background-color]
10+
[svg/svg {:width "20" :height "20" :viewBox "0 0 20 20" :fill "none"}
11+
[svg/path
12+
{:d "M20 0C7 2 0 10 0 20V0H15Z"
13+
:fill background-color}]])
14+
15+
(defn right-radius
16+
[background-color]
17+
[svg/svg {:width "20" :height "21" :viewBox "0 0 20 21" :fill "none"}
18+
[svg/path
19+
{:d "M20 20V0H0C11 0 20 9 20 20Z"
20+
:fill background-color}]])
21+
22+
(defn f-view
23+
[{:keys [scroll-y customization-color theme]}]
24+
(let [background-color (colors/resolve-color customization-color theme 40)
25+
opacity-animation (reanimated/interpolate scroll-y
26+
[0 45 50]
27+
[1 1 0])]
28+
[:<>
29+
[rn/view {:style (style/header-middle-shape background-color)}]
30+
[reanimated/view {:style (style/radius-container opacity-animation)}
31+
[left-radius background-color]
32+
[right-radius background-color]]]))
33+
34+
(defn view
35+
[props]
36+
[:f> f-view props])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
(ns status-im2.contexts.profile.settings.header.style
2+
(:require [quo.foundations.colors :as colors]
3+
[react-native.reanimated :as reanimated]))
4+
5+
(defn header-view
6+
[customization-color theme]
7+
{:background-color (colors/resolve-color customization-color theme 40)
8+
:min-height 100
9+
:flex 1})
10+
11+
(def avatar-row-wrapper
12+
{:display :flex
13+
:padding-left 16
14+
:padding-right 12
15+
:margin-top -60
16+
:margin-bottom -4
17+
:align-items :flex-end
18+
:justify-content :space-between
19+
:flex-direction :row})
20+
21+
(def title-container
22+
{:padding-horizontal 20
23+
:padding-vertical 12})
24+
25+
(defn header-middle-shape
26+
[background-color]
27+
{:background-color background-color
28+
:height 48
29+
:flex-grow 1})
30+
31+
(defn radius-container
32+
[opacity-animation]
33+
(reanimated/apply-animations-to-style
34+
{:opacity opacity-animation}
35+
{:flex-direction :row
36+
:justify-content :space-between}))
37+
38+
(defn avatar-container
39+
[theme scale-animation top-margin-animation side-margin-animation]
40+
(reanimated/apply-animations-to-style
41+
{:transform [{:scale scale-animation}]
42+
:margin-top top-margin-animation
43+
:margin-left side-margin-animation
44+
:margin-bottom side-margin-animation}
45+
{:align-items :flex-start
46+
:border-width 4
47+
:border-color (colors/theme-colors colors/border-avatar-light colors/neutral-80-opa-80 theme)
48+
:border-radius 100}))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
(ns status-im2.contexts.profile.settings.header.view
2+
(:require [clojure.string :as string]
3+
[quo.core :as quo]
4+
[quo.theme :as quo.theme]
5+
[react-native.core :as rn]
6+
[status-im2.common.not-implemented :as not-implemented]
7+
[status-im2.contexts.profile.settings.header.avatar :as header.avatar]
8+
[status-im2.contexts.profile.settings.header.header-shape :as header.shape]
9+
[status-im2.contexts.profile.settings.header.style :as style]
10+
[status-im2.contexts.profile.utils :as profile.utils]
11+
[utils.i18n :as i18n]
12+
[utils.re-frame :as rf]))
13+
14+
(defn- f-view
15+
[{:keys [theme scroll-y]}]
16+
(let [{:keys [public-key emoji-hash] :as profile} (rf/sub [:profile/profile-with-image])
17+
online? (rf/sub [:visibility-status-updates/online?
18+
public-key])
19+
customization-color (rf/sub [:profile/customization-color])
20+
full-name (profile.utils/displayed-name profile)
21+
profile-picture (profile.utils/photo profile)
22+
emoji-string (string/join emoji-hash)]
23+
[:<>
24+
[header.shape/view
25+
{:scroll-y scroll-y
26+
:customization-color customization-color
27+
:theme theme}]
28+
[rn/view {:style style/avatar-row-wrapper}
29+
[header.avatar/view
30+
{:scroll-y scroll-y
31+
:display-name full-name
32+
:online? online?
33+
:customization-color customization-color
34+
:profile-picture profile-picture}]
35+
[rn/view {:style {:margin-bottom 4}}
36+
[quo/dropdown
37+
{:background :blur
38+
:size :size-32
39+
:type :outline
40+
:icon? true
41+
:icon-name :i/online
42+
:on-press not-implemented/alert}
43+
(i18n/label :t/online)]]]
44+
[quo/text-combinations
45+
{:container-style style/title-container
46+
:emoji-hash emoji-string
47+
:title full-name}]]))
48+
49+
(def view (quo.theme/with-theme f-view))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
(ns status-im2.contexts.profile.settings.list-items
2+
(:require [status-im2.common.not-implemented :as not-implemented]
3+
[utils.i18n :as i18n]
4+
[utils.re-frame :as rf]))
5+
6+
(def items
7+
[[{:title (i18n/label :t/edit-profile)
8+
:on-press not-implemented/alert
9+
:image-props :i/edit
10+
:image :icon
11+
:action :arrow}
12+
{:title (i18n/label :t/password)
13+
:on-press not-implemented/alert
14+
:image-props :i/password
15+
:image :icon
16+
:action :arrow}]
17+
[{:title (i18n/label :t/messages)
18+
:on-press not-implemented/alert
19+
:image-props :i/messages
20+
:image :icon
21+
:action :arrow}
22+
{:title (i18n/label :t/wallet)
23+
:on-press not-implemented/alert
24+
:image-props :i/wallet
25+
:image :icon
26+
:action :arrow}
27+
{:title (i18n/label :t/dapps)
28+
:on-press not-implemented/alert
29+
:image-props :i/placeholder
30+
:image :icon
31+
:action :arrow}
32+
{:title "Browser"
33+
:on-press not-implemented/alert
34+
:image-props :i/browser
35+
:image :icon
36+
:action :arrow}
37+
{:title (i18n/label :t/keycard)
38+
:on-press not-implemented/alert
39+
:image-props :i/keycard
40+
:image :icon
41+
:action :arrow}]
42+
[{:title (i18n/label :t/syncing)
43+
:on-press not-implemented/alert
44+
:image-props :i/syncing
45+
:image :icon
46+
:action :arrow}
47+
{:title (i18n/label :t/notifications)
48+
:on-press not-implemented/alert
49+
:image-props :i/notifications
50+
:image :icon
51+
:action :arrow}
52+
{:title (i18n/label :t/appearance)
53+
:on-press not-implemented/alert
54+
:image-props :i/light
55+
:image :icon
56+
:action :arrow}
57+
{:title (i18n/label :t/language-and-currency)
58+
:on-press not-implemented/alert
59+
:image-props :i/globe
60+
:image :icon
61+
:action :arrow}]
62+
[{:title (i18n/label :t/data-usage)
63+
:on-press not-implemented/alert
64+
:image-props :i/mobile
65+
:image :icon
66+
:action :arrow}
67+
{:title (i18n/label :t/advanced)
68+
:on-press not-implemented/alert
69+
:image-props :i/settings
70+
:image :icon
71+
:action :arrow}]
72+
;; temporary link to legacy settings
73+
[{:title "Legacy settings"
74+
:on-press #(rf/dispatch [:navigate-to :my-profile])
75+
:action :arrow
76+
:image :icon
77+
:image-props :i/toggle}]
78+
[{:title (i18n/label :t/about)
79+
:on-press not-implemented/alert
80+
:action :arrow}
81+
{:title (i18n/label :t/status-help)
82+
:on-press not-implemented/alert
83+
:action :arrow}]])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns status-im2.contexts.profile.settings.style
2+
(:require [quo.foundations.colors :as colors]))
3+
4+
(defn navigation-wrapper
5+
[{:keys [customization-color inset theme]}]
6+
{:padding-top inset
7+
:background-color (colors/resolve-color customization-color theme 40)})
8+
9+
(def footer-container
10+
{:padding-horizontal 20
11+
:padding-vertical 12})

0 commit comments

Comments
 (0)