Skip to content

Commit a492595

Browse files
[#17986] feat: implement new settings ui, header section
1 parent ca6180f commit a492595

File tree

8 files changed

+215
-2
lines changed

8 files changed

+215
-2
lines changed

Diff for: src/status_im2/common/home/top_nav/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
:unread-indicator/new :mention
3434
nil)]
3535
[quo/top-nav
36-
{:avatar-on-press #(rf/dispatch [:navigate-to :my-profile])
36+
{:avatar-on-press #(rf/dispatch [:open-modal :settings])
3737
:scan-on-press #(js/alert "to be implemented")
3838
:activity-center-on-press #(rf/dispatch [:activity-center/open])
3939
:qr-code-on-press #(dispatch-and-chill [:open-modal :share-shell] 1000)
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
(ns status-im2.contexts.profile.settings.constants
2+
(:require [status-im2.common.not-implemented :as not-implemented]
3+
[utils.i18n :as i18n]
4+
[utils.re-frame :as rf]))
5+
6+
(defn create-setting-item
7+
[{:keys [title on-press icon]}]
8+
(merge {:title (i18n/label title)
9+
:on-press on-press
10+
:action :arrow}
11+
(when icon
12+
{:image :icon
13+
:image-props icon})))
14+
15+
(def settings-items
16+
[[{:title "Legacy Settings"
17+
:on-press #(rf/dispatch [:navigate-to :my-profile])
18+
:action :arrow
19+
:image :icon
20+
:image-props :i/settings}]
21+
[(create-setting-item {:title :t/edit-profile
22+
:on-press not-implemented/alert
23+
:icon :i/edit})
24+
(create-setting-item {:title :t/password
25+
:on-press not-implemented/alert
26+
:icon :i/password})]
27+
[(create-setting-item {:title :t/messages
28+
:on-press not-implemented/alert
29+
:icon :i/messages})
30+
(create-setting-item {:title :t/wallet
31+
:on-press not-implemented/alert
32+
:icon :i/wallet})
33+
(create-setting-item {:title :t/dapps
34+
:on-press not-implemented/alert
35+
:icon :i/placeholder})
36+
(create-setting-item {:title :t/browser
37+
:on-press not-implemented/alert
38+
:icon :i/browser})
39+
(create-setting-item {:title :t/keycard
40+
:on-press not-implemented/alert
41+
:icon :i/keycard})]
42+
[(create-setting-item {:title :t/syncing
43+
:on-press not-implemented/alert
44+
:icon :i/syncing})
45+
(create-setting-item {:title :t/notifications
46+
:on-press not-implemented/alert
47+
:icon :i/notifications})
48+
(create-setting-item {:title :t/appearance
49+
:on-press not-implemented/alert
50+
:icon :i/light})
51+
(create-setting-item {:title :t/language-and-currency
52+
:on-press not-implemented/alert
53+
:icon :i/globe})]
54+
[(create-setting-item {:title :t/data-usage
55+
:on-press not-implemented/alert
56+
:icon :i/mobile})
57+
(create-setting-item {:title :t/advanced
58+
:on-press not-implemented/alert
59+
:icon :i/settings})]
60+
[(create-setting-item {:title :t/about
61+
:on-press not-implemented/alert})
62+
(create-setting-item {:title :t/status-help
63+
:on-press not-implemented/alert})]])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(ns status-im2.contexts.profile.settings.header.style
2+
(:require [quo.foundations.colors :as colors]))
3+
(defonce ^:const navigation-bar-height 100)
4+
(defonce ^:const header-offset 56)
5+
6+
(defn header-view
7+
[customization-color theme]
8+
{:background-color (colors/resolve-color customization-color theme 40)
9+
:min-height 100
10+
:flex 1})
11+
12+
(def avatar-container
13+
{:display :flex
14+
:padding-left 20
15+
:padding-right 12
16+
:margin-top -56
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})
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
(ns status-im2.contexts.profile.settings.header.view
2+
(:require [clojure.string :as string]
3+
[quo.core :as quo]
4+
[quo.foundations.colors :as colors]
5+
[quo.theme :as quo.theme]
6+
[react-native.core :as rn]
7+
[react-native.svg :as svg]
8+
[status-im2.contexts.profile.settings.header.style :as style]
9+
[status-im2.contexts.profile.utils :as profile.utils]
10+
[utils.i18n :as i18n]
11+
[utils.re-frame :as rf]))
12+
13+
(defn svg-view
14+
[customization-color theme]
15+
(let [background-color (colors/resolve-color customization-color theme 40)]
16+
[svg/svg {:width "390" :height "68" :viewBox "0 0 390 68" :fill "none"}
17+
[svg/path
18+
{:d
19+
"M0 0H390V68C390 56.9543 381.046 48 370 48H103.821C101.8 25.574 82.9522 8 60 8C36.9215 8 17.993 25.768 16.1475 48.3707C6.94517 50.1664 0 58.2721 0 68V0Z"
20+
:fill background-color}]]))
21+
22+
(defn- f-view
23+
[theme]
24+
(let [{:keys [public-key emoji-hash] :as profile} (rf/sub [:profile/profile-with-image])
25+
online? (rf/sub [:visibility-status-updates/online?
26+
public-key])
27+
customization-color (rf/sub [:profile/customization-color])
28+
full-name (profile.utils/displayed-name profile)
29+
profile-picture (profile.utils/photo profile)
30+
emoji-string (string/join emoji-hash)]
31+
[rn/view
32+
[svg-view customization-color theme]
33+
[rn/view {:style style/avatar-container}
34+
[quo/user-avatar
35+
{:full-name full-name
36+
:online? online?
37+
:profile-picture profile-picture
38+
:status-indicator? true
39+
:ring? true
40+
:customization-color customization-color
41+
:size :big}]
42+
[quo/dropdown
43+
{:background :blur
44+
:size :size-32
45+
:type :outline
46+
:icon? true
47+
:icon-name :i/online}
48+
(i18n/label :t/status-always-online)]]
49+
[quo/text-combinations
50+
{:container-style style/title-container
51+
:emoji-hash emoji-string
52+
:title full-name}]]))
53+
54+
(defn- internal-header-view
55+
[params]
56+
[:f> f-view params])
57+
(def view (quo.theme/with-theme internal-header-view))

Diff for: src/status_im2/contexts/profile/settings/style.cljs

+11
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})

Diff for: src/status_im2/contexts/profile/settings/view.cljs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
(ns status-im2.contexts.profile.settings.view
2+
(:require [quo.core :as quo]
3+
[quo.theme :as quo.theme]
4+
[react-native.core :as rn]
5+
[react-native.safe-area :as safe-area]
6+
[status-im2.common.not-implemented :as not-implemented]
7+
[status-im2.contexts.profile.settings.constants :as settings.constants]
8+
[status-im2.contexts.profile.settings.header.view :as settings.header]
9+
[status-im2.contexts.profile.settings.style :as style]
10+
[utils.debounce :as debounce]
11+
[utils.i18n :as i18n]
12+
[utils.re-frame :as rf]))
13+
14+
(defn- f-settings-item-view
15+
[data]
16+
(println data)
17+
[quo/category
18+
{:list-type :settings
19+
:blur? true
20+
:data data}])
21+
22+
(defn- settings-view
23+
[theme]
24+
(let [insets (safe-area/get-insets)
25+
customization-color (rf/sub [:profile/customization-color])]
26+
[quo/overlay {:type :shell}
27+
[:<>
28+
[rn/view
29+
{:style (style/navigation-wrapper {:customization-color customization-color
30+
:inset (:top insets)
31+
:theme theme})}
32+
[quo/page-nav
33+
{:background :blur
34+
:icon-name :i/close
35+
:on-press #(rf/dispatch [:navigate-back])
36+
:right-side [{:icon-name :i/multi-profile :on-press #(rf/dispatch [:open-modal :sign-in])}
37+
{:icon-name :i/qr-code :on-press not-implemented/alert}
38+
{:icon-name :i/share
39+
:on-press #(debounce/dispatch-and-chill [:open-modal :share-shell] 1000)}]}]]
40+
[rn/flat-list
41+
{:header [settings.header/view]
42+
:data settings.constants/settings-items
43+
:key-fn str
44+
:shows-vertical-scroll-indicator false
45+
:render-fn f-settings-item-view
46+
:footer [rn/view {:style style/footer-container}
47+
[quo/button {:type :danger :icon-left :i/log-out}
48+
(i18n/label :t/logout)]]
49+
:bounces false}]]]))
50+
51+
(def view (quo.theme/with-theme settings-view))

Diff for: src/status_im2/navigation/screens.cljs

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
[status-im2.contexts.onboarding.syncing.results.view :as syncing-results]
2828
[status-im2.contexts.onboarding.welcome.view :as welcome]
2929
[status-im2.contexts.profile.profiles.view :as profiles]
30+
[status-im2.contexts.profile.settings.view :as settings]
3031
[status-im2.contexts.quo-preview.component-preview.view :as component-preview]
3132
[status-im2.contexts.quo-preview.main :as quo.preview]
3233
[status-im2.contexts.shell.activity-center.view :as activity-center]
@@ -116,6 +117,10 @@
116117
{:name :community-overview
117118
:component communities.overview/overview}
118119

120+
{:name :settings
121+
:options options/transparent-screen-options
122+
:component settings/view}
123+
119124
{:name :settings-syncing
120125
:options (merge options/dark-screen {:insets {:top? true}})
121126
:component settings-syncing/view}

Diff for: translations/en.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@
480480
"done": "Done",
481481
"edit": "Edit",
482482
"edit-group": "Edit group",
483-
"edit-profile": "Edit profile",
483+
"edit-profile": "Edit Profile",
484484
"emojihash": "Emojihash",
485485
"emojihash-description": "A visual representation of your chat key. It will help other users recognize your profile.",
486486
"emojis": "Emojis",
@@ -1005,6 +1005,8 @@
10051005
"buy-crypto": "Buy crypto",
10061006
"buy-crypto-choose-a-service": "Choose a service you'd like to use to buy crypto",
10071007
"buy-crypto-leaving": "You are leaving Status and entering a third party website to complete your purchase",
1008+
"data-usage": "Data usage",
1009+
"language-and-currency": "Language and currency",
10081010
"opening-buy-crypto": "Opening {{site}}...",
10091011
"network": "Network",
10101012
"network-chain": "Network chain",
@@ -1313,6 +1315,7 @@
13131315
"status-pending": "Pending",
13141316
"status-tx-not-found": "TX not found",
13151317
"status-sent": "Sent",
1318+
"status-help": "Status Help",
13161319
"status-not-sent-tap": "Not confirmed. Tap for options",
13171320
"status-not-sent-click": "Not confirmed. Click for options",
13181321
"step-i-of-n": "Step {{step}} of {{number}}",

0 commit comments

Comments
 (0)