[#17393] feat: add new setting ui (#18118)

This commit is contained in:
Mohsen 2023-12-20 17:03:49 +03:00 committed by GitHub
parent 32cfd214ca
commit f631e1fe9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 309 additions and 76 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

View File

@ -2,6 +2,7 @@
(:require (:require
[cljs.test :refer-macros [deftest is testing]] [cljs.test :refer-macros [deftest is testing]]
[legacy.status-im.browser.core :as browser] [legacy.status-im.browser.core :as browser]
[utils.i18n :as i18n]
[utils.url :as url])) [utils.url :as url]))
(defn has-wrong-properties? (defn has-wrong-properties?
@ -35,7 +36,7 @@
:history-index 0 :history-index 0
:history ["https://cryptokitties.co"] :history ["https://cryptokitties.co"]
:dapp? false :dapp? false
:name "Browser"})) :name (i18n/label :t/browser)}))
"some properties of the browser are not correct") "some properties of the browser are not correct")
(testing "then a second dapp" (testing "then a second dapp"
@ -70,7 +71,7 @@
:history-index 0 :history-index 0
:history ["https://cryptokitties.co"] :history ["https://cryptokitties.co"]
:dapp? false :dapp? false
:name "Browser"})) :name (i18n/label :t/browser)}))
"some properties of the browser are not correct") "some properties of the browser are not correct")
(is (nil? (browser/navigate-to-next-page result-open-existing)) (is (nil? (browser/navigate-to-next-page result-open-existing))
"nothing should happen if user tries to navigate to next page") "nothing should happen if user tries to navigate to next page")
@ -90,7 +91,7 @@
:history-index 1 :history-index 1
:history ["https://cryptokitties.co" dapp1-url2] :history ["https://cryptokitties.co" dapp1-url2]
:dapp? false :dapp? false
:name "Browser"})) :name (i18n/label :t/browser)}))
"some properties of the browser are not correct") "some properties of the browser are not correct")
(testing "then navigates to previous page" (testing "then navigates to previous page"
@ -103,7 +104,7 @@
:history-index 0 :history-index 0
:history ["https://cryptokitties.co" dapp1-url2] :history ["https://cryptokitties.co" dapp1-url2]
:dapp? false :dapp? false
:name "Browser"})) :name (i18n/label :t/browser)}))
"some properties of the browser are not correct") "some properties of the browser are not correct")
(testing "then navigates to next page") (testing "then navigates to next page")
@ -116,5 +117,5 @@
:history-index 1 :history-index 1
:history ["https://cryptokitties.co" dapp1-url2] :history ["https://cryptokitties.co" dapp1-url2]
:dapp? false :dapp? false
:name "Browser"})) :name (i18n/label :t/browser)}))
"some properties of the browser are not correct")))))))))))) "some properties of the browser are not correct"))))))))))))

View File

@ -0,0 +1,31 @@
(ns quo.components.buttons.logout-button.component-spec
(:require
[quo.components.buttons.logout-button.view :as logout-button]
[test-helpers.component :as h]))
(h/describe "button tests"
(h/test "default render of logout button component"
(h/render [logout-button/view])
(h/is-truthy (h/get-by-label-text :log-out-button)))
(h/test "button on-press works"
(let [event (h/mock-fn)]
(h/render [logout-button/view
{:on-press event}])
(h/fire-event :press (h/get-by-label-text :log-out-button))
(h/was-called event)))
(h/test "button on-press disabled when disabled"
(let [event (h/mock-fn)]
(h/render [logout-button/view
{:on-press event
:disabled? true}])
(h/fire-event :press (h/get-by-label-text :log-out-button))
(h/was-not-called event)))
(h/test "button on-long-press works"
(let [event (h/mock-fn)]
(h/render [logout-button/view
{:on-long-press event}])
(h/fire-event :long-press (h/get-by-label-text :log-out-button))
(h/was-called event))))

View File

@ -0,0 +1,15 @@
(ns quo.components.buttons.logout-button.style
(:require
[quo.foundations.colors :as colors]))
(defn main
[{:keys [pressed? disabled?]}]
{:background-color (if pressed? colors/danger-50-opa-40 colors/danger-50-opa-30)
:border-radius 12
:height 40
:gap 4
:padding-right 3
:flex-direction :row
:justify-content :center
:align-items :center
:opacity (when disabled? 0.2)})

View File

@ -0,0 +1,34 @@
(ns quo.components.buttons.logout-button.view
(:require
[quo.components.buttons.logout-button.style :as style]
[quo.components.icon :as icon]
[quo.components.markdown.text :as text]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]
[utils.i18n :as i18n]))
(defn- view-internal
[_]
(let [pressed? (reagent/atom false)
on-press-in #(reset! pressed? true)
on-press-out #(reset! pressed? nil)]
(fn
[{:keys [on-press on-long-press disabled? theme container-style]}]
[rn/pressable
{:accessibility-label :log-out-button
:on-press on-press
:on-press-in on-press-in
:on-press-out on-press-out
:on-long-press on-long-press
:disabled disabled?
:style (merge (style/main {:pressed? @pressed?
:theme theme
:disabled? disabled?})
container-style)}
[icon/icon :i/log-out {:color (if pressed? colors/white-opa-40 colors/white-opa-70)}]
[text/text {:weight :medium :size :paragraph-1}
(i18n/label :t/logout)]])))
(def view (quo.theme/with-theme view-internal))

View File

@ -12,11 +12,24 @@
:flex-direction :row}) :flex-direction :row})
(defn container (defn container
[sub-label disabled?] [{:keys [sub-label disabled? state customization-color blur? theme]}]
{:border-radius 12 (cond-> {:border-radius 12
:height (if sub-label 56 48) :margin-horizontal 8}
:opacity (when disabled? 0.3)
:margin-horizontal 8}) sub-label
(assoc :height 56)
(not sub-label)
(assoc :height 48)
disabled?
(assoc :opacity 0.3)
(= state :selected)
(assoc :background-color
(if blur?
colors/white-opa-5
(colors/resolve-color customization-color theme 5)))))
(defn row-container (defn row-container
[sub-label] [sub-label]

View File

@ -38,13 +38,22 @@
add-divider? add-divider?
theme theme
accessibility-label accessibility-label
icon-color]}] icon-color
no-icon-color?
state
customization-color
blur?]}]
[:<> [:<>
(when add-divider? (when add-divider?
[divider theme]) [divider theme])
[maybe-pressable disabled? [maybe-pressable disabled?
{:accessibility-label accessibility-label {:accessibility-label accessibility-label
:style (style/container sub-label disabled?) :style (style/container {:sub-label sub-label
:disabled? disabled?
:state state
:customization-color customization-color
:blur? blur?
:theme theme})
:underlay-color (colors/theme-colors colors/neutral-5 colors/neutral-90 theme) :underlay-color (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)
:on-press on-press} :on-press on-press}
[rn/view [rn/view
@ -54,8 +63,9 @@
:accessible true :accessible true
:style (style/left-icon sub-label)} :style (style/left-icon sub-label)}
[icon/icon icon [icon/icon icon
{:color (or icon-color (get-icon-color danger? theme)) {:color (or icon-color (get-icon-color danger? theme))
:size 20}]] :no-color no-icon-color?
:size 20}]]
[rn/view [rn/view
{:style style/text-container} {:style style/text-container}
[text/text [text/text
@ -72,7 +82,7 @@
:style {:color :style {:color
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
sub-label])] sub-label])]
(when (or right-text right-icon) (when (or right-text right-icon (= state :selected))
[rn/view {:style style/right-side-container} [rn/view {:style style/right-side-container}
(when right-text (when right-text
[text/text [text/text
@ -87,6 +97,13 @@
:accessibility-label :right-icon-for-action} :accessibility-label :right-icon-for-action}
[icon/icon right-icon [icon/icon right-icon
{:color (get-icon-color danger? theme) {:color (get-icon-color danger? theme)
:size 20}]])
(when (= state :selected)
[rn/view {:style style/right-icon}
[icon/icon :i/check
{:color (if blur?
colors/white
(colors/resolve-color customization-color theme))
:size 20}]])])]]]) :size 20}]])])]]])
(def ^:private action (quo.theme/with-theme action-internal)) (def ^:private action (quo.theme/with-theme action-internal))

View File

@ -11,7 +11,7 @@
(defn- view-internal (defn- view-internal
[{:keys [type size state background customization-color theme on-press icon-name icon? emoji? [{:keys [type size state background customization-color theme on-press icon-name icon? emoji?
accessibility-label] accessibility-label no-icon-color?]
:or {type :grey :or {type :grey
size :size-40 size :size-40
state :default state :default
@ -58,6 +58,7 @@
icon-name icon-name
{:accessibility-label :left-icon {:accessibility-label :left-icon
:color left-icon-color :color left-icon-color
:no-color no-icon-color?
:size icon-size :size icon-size
:container-style style/left-icon}]) :container-style style/left-icon}])
[text/text [text/text
@ -75,14 +76,15 @@
(def view (def view
"Props: "Props:
- type: :outline |:grey (default) | :ghost | :customization - type: :outline |:grey (default) | :ghost | :customization
- size: :size-40 (default) | :size-32 | :size-24 - size: :size-40 (default) | :size-32 | :size-24
- state: :default (default) | :active | :disabled - state: :default (default) | :active | :disabled
- emoji?: boolean - emoji?: boolean
- icon?: boolean - icon?: boolean
- background: :blur | :photo (optional) - no-icon-color?: boolean
- icon-name: keyword - background: :blur | :photo (optional)
- on-press: function - icon-name: keyword
- on-press: function
Child: string - used as label or emoji (for emoji only)" Child: string - used as label or emoji (for emoji only)"
(theme/with-theme view-internal)) (theme/with-theme view-internal))

View File

@ -8,8 +8,8 @@
[react-native.core :as rn])) [react-native.core :as rn]))
(defn- category-internal (defn- category-internal
[{:keys [label data blur? theme]}] [{:keys [label data blur? container-style theme]}]
[rn/view {:style (style/container label)} [rn/view {:style (merge (style/container label) container-style)}
(when label (when label
[text/text [text/text
{:weight :medium {:weight :medium

View File

@ -17,7 +17,7 @@
:background-color (if blur? :background-color (if blur?
colors/white-opa-5 colors/white-opa-5
(colors/theme-colors colors/white colors/neutral-95 theme)) (colors/theme-colors colors/white colors/neutral-95 theme))
:border-width 1 :border-width (if blur? 0 1)
:border-color (if blur? :border-color (if blur?
colors/white-opa-5 colors/white-opa-5
(colors/theme-colors colors/neutral-10 colors/neutral-80 theme))}) (colors/theme-colors colors/neutral-10 colors/neutral-80 theme))})

View File

@ -2,12 +2,12 @@
(:require (:require
[quo.foundations.colors :as colors])) [quo.foundations.colors :as colors]))
(defn container (def container
[{:keys [container-style]}] {:padding-horizontal 12
(merge {:padding 12 :padding-top 12
:flex-direction :row :padding-bottom 14
:justify-content :space-between} :flex-direction :row
container-style)) :justify-content :space-between})
(defn left-sub-container (defn left-sub-container
[{:keys [tag description]}] [{:keys [tag description]}]

View File

@ -101,9 +101,9 @@
nil)]) nil)])
(defn- internal-view (defn- internal-view
[{:keys [title on-press action-props accessibility-label] :as props}] [{:keys [title on-press action-props accessibility-label container-style] :as props}]
[rn/pressable [rn/pressable
{:style (style/container props) {:style (merge style/container container-style)
:on-press on-press :on-press on-press
:accessibility-label accessibility-label} :accessibility-label accessibility-label}
[rn/view {:style (style/left-sub-container props)} [rn/view {:style (style/left-sub-container props)}

View File

@ -12,5 +12,6 @@
(def emoji-hash (def emoji-hash
{:margin-top 8 {:margin-top 8
:letter-spacing 0.5 :letter-spacing 2
:font-size 13
:line-height 20.5}) :line-height 20.5})

View File

@ -59,8 +59,9 @@
description]) description])
(when emoji-hash (when emoji-hash
[text/text [text/text
{:number-of-lines 1 {:number-of-lines 1
:style style/emoji-hash} :accessibility-label :emoji-hash
:style style/emoji-hash}
emoji-hash])]) emoji-hash])])
(def view (theme/with-theme view-internal)) (def view (theme/with-theme view-internal))

View File

@ -14,6 +14,7 @@
quo.components.buttons.button.view quo.components.buttons.button.view
quo.components.buttons.composer-button.view quo.components.buttons.composer-button.view
quo.components.buttons.dynamic-button.view quo.components.buttons.dynamic-button.view
quo.components.buttons.logout-button.view
quo.components.buttons.predictive-keyboard.view quo.components.buttons.predictive-keyboard.view
quo.components.buttons.slide-button.view quo.components.buttons.slide-button.view
quo.components.buttons.wallet-button.view quo.components.buttons.wallet-button.view
@ -182,6 +183,7 @@
(def button quo.components.buttons.button.view/button) (def button quo.components.buttons.button.view/button)
(def composer-button quo.components.buttons.composer-button.view/view) (def composer-button quo.components.buttons.composer-button.view/view)
(def dynamic-button quo.components.buttons.dynamic-button.view/view) (def dynamic-button quo.components.buttons.dynamic-button.view/view)
(def logout-button quo.components.buttons.logout-button.view/view)
(def predictive-keyboard quo.components.buttons.predictive-keyboard.view/view) (def predictive-keyboard quo.components.buttons.predictive-keyboard.view/view)
(def slide-button quo.components.buttons.slide-button.view/view) (def slide-button quo.components.buttons.slide-button.view/view)
(def wallet-button quo.components.buttons.wallet-button.view/view) (def wallet-button quo.components.buttons.wallet-button.view/view)

View File

@ -6,6 +6,7 @@
[quo.components.browser.browser-input.component-spec] [quo.components.browser.browser-input.component-spec]
[quo.components.buttons.button.component-spec] [quo.components.buttons.button.component-spec]
[quo.components.buttons.composer-button.component-spec] [quo.components.buttons.composer-button.component-spec]
[quo.components.buttons.logout-button.component-spec]
[quo.components.buttons.predictive-keyboard.component-spec] [quo.components.buttons.predictive-keyboard.component-spec]
[quo.components.buttons.slide-button.component-spec] [quo.components.buttons.slide-button.component-spec]
[quo.components.buttons.wallet-button.component-spec] [quo.components.buttons.wallet-button.component-spec]

View File

@ -33,7 +33,7 @@
:unread-indicator/new :mention :unread-indicator/new :mention
nil)] nil)]
[quo/top-nav [quo/top-nav
{:avatar-on-press #(rf/dispatch [:navigate-to :my-profile]) {:avatar-on-press #(rf/dispatch [:open-modal :settings])
:scan-on-press #(js/alert "to be implemented") :scan-on-press #(js/alert "to be implemented")
:activity-center-on-press #(rf/dispatch [:activity-center/open]) :activity-center-on-press #(rf/dispatch [:activity-center/open])
:qr-code-on-press #(dispatch-and-chill [:open-modal :share-shell] 1000) :qr-code-on-press #(dispatch-and-chill [:open-modal :share-shell] 1000)

View File

@ -13,7 +13,7 @@
[{:keys [scroll-y full-name online? profile-picture customization-color]}] [{:keys [scroll-y full-name online? profile-picture customization-color]}]
(let [image-scale-animation (reanimated/interpolate scroll-y (let [image-scale-animation (reanimated/interpolate scroll-y
scroll-animation-input-range scroll-animation-input-range
[1 0.5] [1 0.4]
header-extrapolation-option) header-extrapolation-option)
image-top-margin-animation (reanimated/interpolate scroll-y image-top-margin-animation (reanimated/interpolate scroll-y
scroll-animation-input-range scroll-animation-input-range

View File

@ -0,0 +1,21 @@
(ns status-im.contexts.profile.settings.header.utils
(:require [status-im.constants :as constants]
[utils.i18n :as i18n]))
(defn visibility-status-type-data
[{:keys [status-type]}]
(condp = status-type
constants/visibility-status-automatic
{:status-title (i18n/label :t/status-automatic)
:status-icon :i/automatic}
constants/visibility-status-always-online
{:status-title (i18n/label :t/online)
:status-icon :i/online}
constants/visibility-status-inactive
{:status-title (i18n/label :t/offline)
:status-icon :i/offline}
{:status-title (i18n/label :t/offline)
:status-icon :i/offline}))

View File

@ -3,12 +3,12 @@
[quo.core :as quo] [quo.core :as quo]
[quo.theme :as quo.theme] [quo.theme :as quo.theme]
[react-native.core :as rn] [react-native.core :as rn]
[status-im.common.not-implemented :as not-implemented]
[status-im.contexts.profile.settings.header.avatar :as header.avatar] [status-im.contexts.profile.settings.header.avatar :as header.avatar]
[status-im.contexts.profile.settings.header.header-shape :as header.shape] [status-im.contexts.profile.settings.header.header-shape :as header.shape]
[status-im.contexts.profile.settings.header.style :as style] [status-im.contexts.profile.settings.header.style :as style]
[status-im.contexts.profile.settings.header.utils :as header.utils]
[status-im.contexts.profile.settings.visibility-sheet.view :as visibility-sheet]
[status-im.contexts.profile.utils :as profile.utils] [status-im.contexts.profile.utils :as profile.utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn- f-view (defn- f-view
@ -16,10 +16,14 @@
(let [{:keys [public-key emoji-hash] :as profile} (rf/sub [:profile/profile-with-image]) (let [{:keys [public-key emoji-hash] :as profile} (rf/sub [:profile/profile-with-image])
online? (rf/sub [:visibility-status-updates/online? online? (rf/sub [:visibility-status-updates/online?
public-key]) public-key])
status (rf/sub
[:visibility-status-updates/visibility-status-update
public-key])
customization-color (rf/sub [:profile/customization-color]) customization-color (rf/sub [:profile/customization-color])
full-name (profile.utils/displayed-name profile) full-name (profile.utils/displayed-name profile)
profile-picture (profile.utils/photo profile) profile-picture (profile.utils/photo profile)
emoji-string (string/join emoji-hash)] emoji-string (string/join emoji-hash)
{:keys [status-title status-icon]} (header.utils/visibility-status-type-data status)]
[:<> [:<>
[header.shape/view [header.shape/view
{:scroll-y scroll-y {:scroll-y scroll-y
@ -34,16 +38,21 @@
:profile-picture profile-picture}] :profile-picture profile-picture}]
[rn/view {:style {:margin-bottom 4}} [rn/view {:style {:margin-bottom 4}}
[quo/dropdown [quo/dropdown
{:background :blur {:background :blur
:size :size-32 :size :size-32
:type :outline :type :outline
:icon? true :icon? true
:icon-name :i/online :no-icon-color? true
:on-press not-implemented/alert} :icon-name status-icon
(i18n/label :t/online)]]] :on-press #(rf/dispatch [:show-bottom-sheet
{:shell? true
:theme :dark
:content (fn [] [visibility-sheet/view])}])}
status-title]]]
[quo/text-combinations [quo/text-combinations
{:container-style style/title-container {:title-accessibility-label :username
:emoji-hash emoji-string :container-style style/title-container
:title full-name}]])) :emoji-hash emoji-string
:title full-name}]]))
(def view (quo.theme/with-theme f-view)) (def view (quo.theme/with-theme f-view))

View File

@ -8,73 +8,93 @@
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/edit :image-props :i/edit
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/password) {:title (i18n/label :t/password)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/password :image-props :i/password
:image :icon :image :icon
:blur? true
:action :arrow}] :action :arrow}]
[{:title (i18n/label :t/messages) [{:title (i18n/label :t/messages)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/messages :image-props :i/messages
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/wallet) {:title (i18n/label :t/wallet)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/wallet :image-props :i/wallet
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/dapps) {:title (i18n/label :t/dapps)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/placeholder :image-props :i/placeholder
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title "Browser" {:title (i18n/label :t/browser)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/browser :image-props :i/browser
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/keycard) {:title (i18n/label :t/keycard)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/keycard :image-props :i/keycard
:image :icon :image :icon
:blur? true
:action :arrow}] :action :arrow}]
[{:title (i18n/label :t/syncing) [{:title (i18n/label :t/syncing)
:on-press not-implemented/alert :on-press #(rf/dispatch [:navigate-to :settings-syncing])
:image-props :i/syncing :image-props :i/syncing
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/notifications) {:title (i18n/label :t/notifications)
:on-press not-implemented/alert :on-press #(rf/dispatch [:navigate-to :notifications])
:image-props :i/notifications :image-props :i/activity-center
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/appearance) {:title (i18n/label :t/appearance)
:on-press not-implemented/alert :on-press #(rf/dispatch [:navigate-to :appearance])
:image-props :i/light :image-props :i/light
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/language-and-currency) {:title (i18n/label :t/language-and-currency)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/globe :image-props :i/globe
:image :icon :image :icon
:blur? true
:action :arrow}] :action :arrow}]
[{:title (i18n/label :t/data-usage) [{:title (i18n/label :t/data-usage)
:on-press not-implemented/alert :on-press not-implemented/alert
:image-props :i/mobile :image-props :i/mobile
:image :icon :image :icon
:blur? true
:action :arrow} :action :arrow}
{:title (i18n/label :t/advanced) {:title (i18n/label :t/advanced)
:on-press not-implemented/alert :on-press #(rf/dispatch [:navigate-to :advanced-settings])
:image-props :i/settings :image-props :i/settings
:image :icon :image :icon
:blur? true
:action :arrow}] :action :arrow}]
;; temporary link to legacy settings ;; temporary link to legacy settings
[{:title "Legacy settings" [{:title "Legacy settings"
:on-press #(rf/dispatch [:navigate-to :my-profile]) :on-press #(rf/dispatch [:navigate-to :my-profile])
:action :arrow :action :arrow
:image :icon :image :icon
:image-props :i/toggle}] :blur? true
:image-props :i/toggle}
{:title "Quo preview"
:on-press #(rf/dispatch [:navigate-to :quo-preview])
:action :arrow
:image :icon
:blur? true
:image-props :i/light}]
[{:title (i18n/label :t/about) [{:title (i18n/label :t/about)
:on-press not-implemented/alert :on-press not-implemented/alert
:action :arrow} :action :arrow}

View File

@ -7,5 +7,7 @@
:background-color (colors/resolve-color customization-color theme 40)}) :background-color (colors/resolve-color customization-color theme 40)})
(def footer-container (def footer-container
{:padding-horizontal 20 {:margin-top 8
:margin-bottom 50
:padding-horizontal 20
:padding-vertical 12}) :padding-vertical 12})

View File

@ -9,6 +9,7 @@
[status-im.contexts.profile.settings.header.view :as settings.header] [status-im.contexts.profile.settings.header.view :as settings.header]
[status-im.contexts.profile.settings.list-items :as settings.items] [status-im.contexts.profile.settings.list-items :as settings.items]
[status-im.contexts.profile.settings.style :as style] [status-im.contexts.profile.settings.style :as style]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants]
[utils.debounce :as debounce] [utils.debounce :as debounce]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -16,9 +17,10 @@
(defn- settings-item-view (defn- settings-item-view
[data] [data]
[quo/category [quo/category
{:list-type :settings {:list-type :settings
:blur? true :container-style {:padding-bottom 0}
:data data}]) :blur? true
:data data}])
(defn scroll-handler (defn scroll-handler
[event scroll-y] [event scroll-y]
@ -28,11 +30,11 @@
(defn- footer (defn- footer
[logout-press] [logout-press]
[rn/view {:style style/footer-container} [rn/view {:style style/footer-container}
[quo/button [quo/logout-button {:on-press logout-press}]])
{:on-press logout-press
:type :danger (defn- get-item-layout
:icon-left :i/log-out} [_ index]
(i18n/label :t/logout)]]) #js {:length 48 :offset (* 48 index) :index index})
(defn- settings-view (defn- settings-view
[theme] [theme]
@ -42,7 +44,8 @@
logout-press #(rf/dispatch [:multiaccounts.logout.ui/logout-pressed])] logout-press #(rf/dispatch [:multiaccounts.logout.ui/logout-pressed])]
[quo/overlay {:type :shell} [quo/overlay {:type :shell}
[rn/view [rn/view
{:style (style/navigation-wrapper {:customization-color customization-color {:key :header
:style (style/navigation-wrapper {:customization-color customization-color
:inset (:top insets) :inset (:top insets)
:theme theme})} :theme theme})}
[quo/page-nav [quo/page-nav
@ -50,19 +53,33 @@
:icon-name :i/close :icon-name :i/close
:on-press #(rf/dispatch [:navigate-back]) :on-press #(rf/dispatch [:navigate-back])
:right-side [{:icon-name :i/multi-profile :on-press #(rf/dispatch [:open-modal :sign-in])} :right-side [{:icon-name :i/multi-profile :on-press #(rf/dispatch [:open-modal :sign-in])}
{:icon-name :i/qr-code :on-press not-implemented/alert} {:icon-name :i/qr-code
{:icon-name :i/share :on-press #(debounce/dispatch-and-chill [:open-modal :share-shell] 1000)}
:on-press #(debounce/dispatch-and-chill [:open-modal :share-shell] 1000)}]}]] {:icon-name :i/share :on-press not-implemented/alert}]}]]
[rn/flat-list [rn/flat-list
{:header [settings.header/view {:scroll-y scroll-y}] {:key :list
:header [settings.header/view {:scroll-y scroll-y}]
:data settings.items/items :data settings.items/items
:key-fn :title :key-fn :title
:get-item-layout get-item-layout
:initial-num-to-render 6
:max-to-render-per-batch 6
:shows-vertical-scroll-indicator false :shows-vertical-scroll-indicator false
:render-fn settings-item-view :render-fn settings-item-view
:footer [footer logout-press] :footer [footer logout-press]
:scroll-event-throttle 16 :scroll-event-throttle 16
:on-scroll #(scroll-handler % scroll-y) :on-scroll #(scroll-handler % scroll-y)
:bounces false}]])) :bounces false}]
[quo/floating-shell-button
{:key :shell
:jump-to
{:on-press (fn []
(rf/dispatch [:navigate-back])
(debounce/dispatch-and-chill [:shell/navigate-to-jump-to] 500))
:customization-color customization-color
:label (i18n/label :t/jump-to)}}
{:position :absolute
:bottom jump-to.constants/floating-shell-button-height}]]))
(defn- internal-view (defn- internal-view
[props] [props]

View File

@ -0,0 +1,46 @@
(ns status-im.contexts.profile.settings.visibility-sheet.view
(:require [quo.core :as quo]
[status-im.constants :as constants]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn change-visibility-status
[status-type]
(rf/dispatch
[:visibility-status-updates/delayed-visibility-status-update status-type])
(rf/dispatch [:hide-bottom-sheet]))
(defn view
[]
(let [{:keys [public-key]} (rf/sub [:profile/profile])
{:keys [status-type]} (rf/sub
[:visibility-status-updates/visibility-status-update
public-key])
customization-color (rf/sub [:profile/customization-color])]
[quo/action-drawer
[[{:icon :i/online
:no-icon-color? true
:blur? true
:state (when (= status-type constants/visibility-status-always-online) :selected)
:customization-color customization-color
:accessibility-label :online
:label (i18n/label :t/online)
:on-press #(change-visibility-status constants/visibility-status-always-online)}
{:icon :i/offline
:no-icon-color? true
:blur? true
:state (when (= status-type constants/visibility-status-inactive) :selected)
:accessibility-label :offline
:customization-color customization-color
:label (i18n/label :t/offline)
:sub-label (i18n/label :t/status-inactive-subtitle)
:on-press #(change-visibility-status constants/visibility-status-inactive)}
{:icon :i/automatic
:no-icon-color? true
:blur? true
:state (when (= status-type constants/visibility-status-automatic) :selected)
:accessibility-label :automatic
:customization-color customization-color
:label (i18n/label :t/status-automatic)
:sub-label (i18n/label :t/status-automatic-subtitle)
:on-press #(change-visibility-status constants/visibility-status-automatic)}]]]))