chore: remove colors/dark? method from colors file and update uses (#17202)

This commit is contained in:
Jamie Caprani 2023-09-19 17:16:18 +02:00 committed by GitHub
parent cb9ae21cf2
commit 6279264ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 205 additions and 134 deletions

View File

@ -25,7 +25,7 @@
(colors/alpha (if blur? (colors/alpha (if blur?
(colors/theme-colors colors/neutral-100 colors/white theme) (colors/theme-colors colors/neutral-100 colors/white theme)
(colors/custom-color customization-color (colors/custom-color customization-color
(if (or (= :dark theme) colors/dark?) 60 50))) (if (= :dark theme) 60 50)))
(if platform/ios? 1 0.2))) (if platform/ios? 1 0.2)))
(def text-input-container {:flex 1}) (def text-input-container {:flex 1})

View File

@ -5,7 +5,7 @@
(def keycard-chip-height 28) (def keycard-chip-height 28)
(defn card-container (defn card-container
[locked?] [locked? theme]
{:overflow :hidden {:overflow :hidden
:height keycard-height :height keycard-height
:align-items :flex-start :align-items :flex-start
@ -13,22 +13,26 @@
:border-width 1 :border-width 1
:border-color (if locked? :border-color (if locked?
colors/white-opa-5 colors/white-opa-5
(colors/theme-colors colors/neutral-20 colors/neutral-80)) (colors/theme-colors colors/neutral-20 colors/neutral-80 theme))
:border-style :solid :border-style :solid
:border-radius 16 :border-radius 16
:padding 16 :padding 16
:background-color (if locked? :background-color (if locked?
(colors/theme-colors colors/danger colors/danger-opa-40) (colors/theme-colors colors/danger colors/danger-opa-40 theme)
(colors/theme-colors colors/neutral-5 colors/neutral-90))}) (colors/theme-colors colors/neutral-5 colors/neutral-90 theme))})
(defn keycard-logo (defn keycard-logo
[locked?] [locked? theme]
{:tint-color (if locked? colors/white (colors/theme-colors colors/neutral-100 colors/white))}) {:tint-color (if locked?
colors/white
(colors/theme-colors colors/neutral-100 colors/white theme))})
(defn keycard-watermark (defn keycard-watermark
[locked?] [locked? theme]
{:position :absolute {:position :absolute
:tint-color (if locked? colors/white-opa-5 (colors/theme-colors colors/neutral-100 colors/white)) :tint-color (if locked?
colors/white-opa-5
(colors/theme-colors colors/neutral-100 colors/white theme))
:align-self :center :align-self :center
:height 280.48 :height 280.48
:transform [{:rotate "-30deg"} {:translateY -30}] :transform [{:rotate "-30deg"} {:translateY -30}]

View File

@ -4,28 +4,30 @@
[quo2.components.tags.tag :as tag] [quo2.components.tags.tag :as tag]
[quo2.foundations.colors :as colors] [quo2.foundations.colors :as colors]
[quo2.foundations.resources :as resources] [quo2.foundations.resources :as resources]
[utils.i18n :as i18n])) [utils.i18n :as i18n]
[quo2.theme :as quo.theme]))
(defn keycard (defn- view-internal
"This component based on the following properties: "This component based on the following properties:
- :holder-name - Can be owner's name. Default is Empty - :holder-name - Can be owner's name. Default is Empty
- :locked? - Boolean to specify whether the keycard is locked or not - :locked? - Boolean to specify whether the keycard is locked or not
- :theme :light/:dark
" "
[{:keys [holder-name locked?]}] [{:keys [holder-name locked? theme]}]
(let [label (if (boolean holder-name) (let [label (if (boolean holder-name)
(i18n/label :t/user-keycard {:name holder-name}) (i18n/label :t/user-keycard {:name holder-name})
(i18n/label :t/empty-keycard))] (i18n/label :t/empty-keycard))]
[rn/view {:style (style/card-container locked?)} [rn/view {:style (style/card-container locked? theme)}
[rn/image [rn/image
{:source (resources/get-image :keycard-logo) {:source (resources/get-image :keycard-logo)
:style (style/keycard-logo locked?)}] :style (style/keycard-logo locked? theme)}]
[rn/image [rn/image
{:source (resources/get-image {:source (resources/get-image
(if (or locked? (colors/dark?)) :keycard-chip-dark :keycard-chip-light)) (if (or locked? (= :dark theme)) :keycard-chip-dark :keycard-chip-light))
:style style/keycard-chip}] :style style/keycard-chip}]
[rn/image [rn/image
{:source (resources/get-image :keycard-watermark) {:source (resources/get-image :keycard-watermark)
:style (style/keycard-watermark locked?)}] :style (style/keycard-watermark locked? theme)}]
[tag/tag [tag/tag
{:size 32 {:size 32
:type (when locked? :icon) :type (when locked? :icon)
@ -36,3 +38,5 @@
:accessibility-label :holder-name :accessibility-label :holder-name
:icon-color colors/white-70-blur :icon-color colors/white-70-blur
:override-theme (when locked? :dark)}]])) :override-theme (when locked? :dark)}]]))
(def keycard (quo.theme/with-theme view-internal))

View File

@ -28,9 +28,9 @@
[reanimated/view {:style (style/animated-circle scale opacity color)}])))))) [reanimated/view {:style (style/animated-circle scale opacity color)}]))))))
(defn f-record-button-big (defn f-record-button-big
[recording? ready-to-send? ready-to-lock? ready-to-delete? record-button-is-animating? [{:keys [recording? ready-to-send? ready-to-lock? ready-to-delete? record-button-is-animating?
record-button-at-initial-position? locked? reviewing-audio? recording-length-ms record-button-at-initial-position? locked? reviewing-audio? recording-length-ms
clear-timeout touch-active? recorder-ref reload-recorder-fn idle? on-send on-cancel] clear-timeout touch-active? recorder-ref reload-recorder-fn idle? on-send on-cancel theme]}]
(let [scale (reanimated/use-shared-value 1) (let [scale (reanimated/use-shared-value 1)
opacity (reanimated/use-shared-value 0) opacity (reanimated/use-shared-value 0)
opacity-from (if @ready-to-lock? opacity-from-lock opacity-from-default) opacity-from (if @ready-to-lock? opacity-from-lock opacity-from-default)
@ -46,13 +46,14 @@
(range 0 5)) (range 0 5))
rings-color (cond rings-color (cond
@ready-to-lock? (colors/theme-colors colors/neutral-80-opa-5-opaque @ready-to-lock? (colors/theme-colors colors/neutral-80-opa-5-opaque
colors/neutral-80) colors/neutral-80
theme)
@ready-to-delete? colors/danger-50 @ready-to-delete? colors/danger-50
:else colors/primary-50) :else colors/primary-50)
translate-y (reanimated/use-shared-value 0) translate-y (reanimated/use-shared-value 0)
translate-x (reanimated/use-shared-value 0) translate-x (reanimated/use-shared-value 0)
button-color colors/primary-50 button-color colors/primary-50
icon-color (if (and (not (colors/dark?)) @ready-to-lock?) colors/black colors/white) icon-color (if (and (not (= :dark theme)) @ready-to-lock?) colors/black colors/white)
icon-opacity (reanimated/use-shared-value 1) icon-opacity (reanimated/use-shared-value 1)
red-overlay-opacity (reanimated/use-shared-value 0) red-overlay-opacity (reanimated/use-shared-value 0)
gray-overlay-opacity (reanimated/use-shared-value 0) gray-overlay-opacity (reanimated/use-shared-value 0)

View File

@ -17,7 +17,8 @@
[quo2.components.record-audio.record-audio.buttons.record-button :as record-button] [quo2.components.record-audio.record-audio.buttons.record-button :as record-button]
[clojure.string :as string] [clojure.string :as string]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[react-native.platform :as platform])) [react-native.platform :as platform]
[quo2.theme :as quo.theme]))
(def ^:private min-audio-duration-ms 1000) (def ^:private min-audio-duration-ms 1000)
(def ^:private max-audio-duration-ms (if platform/ios? 120800 120500)) (def ^:private max-audio-duration-ms (if platform/ios? 120800 120500))
@ -155,11 +156,11 @@
(if @playing-audio? :i/pause :i/play) (if @playing-audio? :i/pause :i/play)
{:color (colors/theme-colors colors/neutral-100 colors/white)}]])) {:color (colors/theme-colors colors/neutral-100 colors/white)}]]))
(defn record-audio (defn- record-audio-internal
[{:keys [on-init on-start-recording on-send on-cancel on-reviewing-audio [{:keys [on-init on-start-recording on-send on-cancel on-reviewing-audio
record-audio-permission-granted record-audio-permission-granted
on-request-record-audio-permission on-check-audio-permissions on-request-record-audio-permission on-check-audio-permissions
audio-file on-lock max-duration-ms]}] audio-file on-lock max-duration-ms theme]}]
[:f> [:f>
;; TODO we need to refactor this, and use :f> with defined function, currenly state is reseted each ;; TODO we need to refactor this, and use :f> with defined function, currenly state is reseted each
;; time parent component ;; time parent component
@ -574,20 +575,23 @@
[:f> send-button/f-send-button recording? ready-to-send? reviewing-audio? [:f> send-button/f-send-button recording? ready-to-send? reviewing-audio?
@force-show-controls?] @force-show-controls?]
[:f> record-button-big/f-record-button-big [:f> record-button-big/f-record-button-big
recording? {:recording? recording?
ready-to-send? :ready-to-send? ready-to-send?
ready-to-lock? :ready-to-lock? ready-to-lock?
ready-to-delete? :ready-to-delete? ready-to-delete?
record-button-is-animating? :record-button-is-animating? record-button-is-animating?
record-button-at-initial-position? :record-button-at-initial-position? record-button-at-initial-position?
locked? :locked? locked?
reviewing-audio? :reviewing-audio? reviewing-audio?
recording-length-ms :recording-length-ms recording-length-ms
clear-timeout :clear-timeout clear-timeout
touch-active? :touch-active? touch-active?
recorder-ref :recorder-ref recorder-ref
reload-recorder :reload-recorder-fn reload-recorder
idle? :idle? idle?
on-send :on-send on-send
on-cancel] :on-cancel on-cancel
:theme theme}]
[:f> record-button/f-record-button recording? reviewing-audio?]]])))]) [:f> record-button/f-record-button recording? reviewing-audio?]]])))])
(def record-audio (quo.theme/with-theme record-audio-internal))

View File

@ -4,14 +4,16 @@
[react-native.audio-toolkit :as audio] [react-native.audio-toolkit :as audio]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.slider :as slider])) [react-native.slider :as slider]
[quo2.theme :as quo.theme]))
(def ^:private thumb-light (js/require "../resources/images/icons2/12x12/thumb-light.png")) (def ^:private thumb-light (js/require "../resources/images/icons2/12x12/thumb-light.png"))
(def ^:private thumb-dark (js/require "../resources/images/icons2/12x12/thumb-dark.png")) (def ^:private thumb-dark (js/require "../resources/images/icons2/12x12/thumb-dark.png"))
(defn f-soundtrack (defn f-soundtrack
[{:keys [audio-current-time-ms player-ref style seeking-audio? max-audio-duration-ms]}] [{:keys [audio-current-time-ms player-ref style seeking-audio? max-audio-duration-ms]}]
(let [audio-duration-ms (min max-audio-duration-ms (audio/get-player-duration player-ref))] (let [audio-duration-ms (min max-audio-duration-ms (audio/get-player-duration player-ref))
theme (quo.theme/use-theme-value)]
[:<> [:<>
[slider/slider [slider/slider
{:test-ID "soundtrack" {:test-ID "soundtrack"
@ -31,8 +33,9 @@
#(log/error "[record-audio] on seek - error: " %))) #(log/error "[record-audio] on seek - error: " %)))
:on-value-change #(when @seeking-audio? :on-value-change #(when @seeking-audio?
(reset! audio-current-time-ms %)) (reset! audio-current-time-ms %))
:thumb-image (if (colors/dark?) thumb-dark thumb-light) :thumb-image (quo.theme/theme-value thumb-light thumb-dark theme)
:minimum-track-tint-color (colors/theme-colors colors/primary-50 colors/primary-60) :minimum-track-tint-color (colors/theme-colors colors/primary-50 colors/primary-60 theme)
:maximum-track-tint-color (colors/theme-colors :maximum-track-tint-color (colors/theme-colors
(if platform/ios? colors/neutral-20 colors/neutral-40) (if platform/ios? colors/neutral-20 colors/neutral-40)
(if platform/ios? colors/neutral-80 colors/neutral-60))}]])) (if platform/ios? colors/neutral-80 colors/neutral-60)
theme)}]]))

View File

@ -314,7 +314,3 @@
([light dark override-theme] ([light dark override-theme]
(let [theme (or override-theme (theme/get-theme))] (let [theme (or override-theme (theme/get-theme))]
(if (= theme :light) light dark)))) (if (= theme :light) light dark))))
(defn dark?
[]
(theme/dark?))

View File

@ -43,6 +43,10 @@
[] []
(utils.transforms/js->clj (rn/use-context theme-context))) (utils.transforms/js->clj (rn/use-context theme-context)))
(defn use-theme-value
[]
(keyword (:theme (use-theme))))
(defn ^:private f-with-theme (defn ^:private f-with-theme
[component props & args] [component props & args]
(let [theme (-> (use-theme) :theme keyword)] (let [theme (-> (use-theme) :theme keyword)]

View File

@ -1,5 +1,4 @@
(ns status-im2.common.resources (ns status-im2.common.resources)
(:require [quo2.foundations.colors :as colors]))
(def ui (def ui
{:add-new-contact (js/require "../resources/images/ui2/add-contact.png") {:add-new-contact (js/require "../resources/images/ui2/add-contact.png")
@ -49,6 +48,38 @@
:no-notifications-light (js/require "../resources/images/ui2/no-notifications-light.png") :no-notifications-light (js/require "../resources/images/ui2/no-notifications-light.png")
:no-notifications-dark (js/require "../resources/images/ui2/no-notifications-dark.png")}) :no-notifications-dark (js/require "../resources/images/ui2/no-notifications-dark.png")})
(def ui-themed
{:no-messages
{:light (js/require "../resources/images/ui2/no-messages-light.png")
:dark (js/require "../resources/images/ui2/no-messages-dark.png")}
:no-group-chats
{:light (js/require "../resources/images/ui2/no-group-chats-light.png")
:dark (js/require "../resources/images/ui2/no-group-chats-dark.png")}
:no-contacts
{:light (js/require "../resources/images/ui2/no-contacts-light.png")
:dark (js/require "../resources/images/ui2/no-contacts-dark.png")}
:no-sent-requests
{:light (js/require "../resources/images/ui2/no-sent-requests-light.png")
:dark (js/require "../resources/images/ui2/no-sent-requests-dark.png")}
:no-received-requests
{:light (js/require "../resources/images/ui2/no-received-requests-light.png")
:dark (js/require "../resources/images/ui2/no-received-requests-dark.png")}
:no-communities
{:light (js/require "../resources/images/ui2/no-communities-light.png")
:dark (js/require "../resources/images/ui2/no-communities-dark.png")}
:no-pending-communities
{:light (js/require "../resources/images/ui2/no-pending-communities-light.png")
:dark (js/require "../resources/images/ui2/no-pending-communities-dark.png")}
:no-opened-communities
{:light (js/require "../resources/images/ui2/no-opened-communities-light.png")
:dark (js/require "../resources/images/ui2/no-opened-communities-dark.png")}
:no-contacts-to-invite
{:light (js/require "../resources/images/ui2/no-contacts-to-invite-light.png")
:dark (js/require "../resources/images/ui2/no-contacts-to-invite-dark.png")}
:no-notifications
{:light (js/require "../resources/images/ui2/no-notifications-light.png")
:dark (js/require "../resources/images/ui2/no-notifications-dark.png")}})
(def mock-images (def mock-images
{:diamond (js/require "../resources/images/mock2/diamond.png") {:diamond (js/require "../resources/images/mock2/diamond.png")
:coinbase (js/require "../resources/images/mock2/coinbase.png") :coinbase (js/require "../resources/images/mock2/coinbase.png")
@ -97,5 +128,5 @@
(get ui k)) (get ui k))
(defn get-themed-image (defn get-themed-image
[k k2] [k theme]
(get ui (if (colors/dark?) k k2))) (get-in ui-themed [k theme]))

View File

@ -3,7 +3,8 @@
[quo2.core :as quo] [quo2.core :as quo]
[react-native.core :as rn] [react-native.core :as rn]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im2.contexts.chat.messages.drawers.view :as drawers])) [status-im2.contexts.chat.messages.drawers.view :as drawers]
[quo2.theme :as quo.theme]))
(defn- on-press (defn- on-press
[own message-id emoji-id emoji-reaction-id] [own message-id emoji-id emoji-reaction-id]
@ -17,26 +18,29 @@
:emoji-id emoji-id}]))) :emoji-id emoji-id}])))
(defn- on-long-press (defn- on-long-press
[message-id emoji-id user-message-content reactions] [{:keys [message-id emoji-id user-message-content reactions theme]}]
(rf/dispatch [:chat.ui/emoji-reactions-by-message-id (rf/dispatch
{:message-id message-id [:chat.ui/emoji-reactions-by-message-id
:on-success (fn [response] {:message-id message-id
(rf/dispatch [:chat/save-emoji-reaction-details :on-success (fn [response]
{:reaction-authors-list response (rf/dispatch [:chat/save-emoji-reaction-details
:selected-reaction emoji-id}]) {:reaction-authors-list response
(rf/dispatch [:dismiss-keyboard]) :selected-reaction emoji-id}])
(rf/dispatch [:show-bottom-sheet (rf/dispatch [:dismiss-keyboard])
{:on-close (fn [] (rf/dispatch [:show-bottom-sheet
(rf/dispatch {:on-close (fn []
[:chat/clear-emoji-reaction-author-details])) (rf/dispatch
:content (fn [] [:chat/clear-emoji-reaction-author-details]))
[drawers/reaction-authors reactions]) :content (fn []
:selected-item (fn [] [drawers/reaction-authors
user-message-content) {:reactions-order reactions
:padding-bottom-override 0}]))}])) :theme theme}])
:selected-item (fn []
user-message-content)
:padding-bottom-override 0}]))}]))
(defn message-reactions-row (defn- view-internal
[{:keys [message-id chat-id]} user-message-content] [{:keys [message-id chat-id theme]} user-message-content]
(let [reactions (rf/sub [:chats/message-reactions message-id chat-id])] (let [reactions (rf/sub [:chats/message-reactions message-id chat-id])]
[:<> [:<>
(when (seq reactions) (when (seq reactions)
@ -55,10 +59,12 @@
:neutral? own :neutral? own
:clicks quantity :clicks quantity
:on-press #(on-press own message-id emoji-id emoji-reaction-id) :on-press #(on-press own message-id emoji-id emoji-reaction-id)
:on-long-press #(on-long-press message-id :on-long-press #(on-long-press
emoji-id {:message-id message-id
user-message-content :emoji-id emoji-id
(map :emoji-id reactions)) :user-message-content user-message-content
:reactions (map :emoji-id reactions)
:theme theme})
:accessibility-label (str "emoji-reaction-" emoji-id)}]]) :accessibility-label (str "emoji-reaction-" emoji-id)}]])
[quo/add-reaction [quo/add-reaction
{:on-press (fn [] {:on-press (fn []
@ -70,3 +76,5 @@
:message-id message-id}]) :message-id message-id}])
:selected-item (fn [] :selected-item (fn []
user-message-content)}]))}]])])) user-message-content)}]))}]])]))
(def message-reactions-row (quo.theme/with-theme view-internal))

View File

@ -12,8 +12,8 @@
:height 20}) :height 20})
(defn tab-count (defn tab-count
[active?] [active? theme]
{:color (if (or active? (colors/dark?)) colors/white colors/neutral-100)}) {:color (if (or active? (= :dark theme)) colors/white colors/neutral-100)})
(def tabs-container (def tabs-container
{:flex 1 {:flex 1

View File

@ -27,8 +27,8 @@
:ens-verified ens-verified :ens-verified ens-verified
:added? added?}])) :added? added?}]))
(defn get-tabs-data (defn- get-tabs-data
[reaction-authors selected-tab reactions-order] [{:keys [reaction-authors selected-tab reactions-order theme]}]
(map (fn [reaction-type-int] (map (fn [reaction-type-int]
(let [author-details (get reaction-authors reaction-type-int)] (let [author-details (get reaction-authors reaction-type-int)]
{:id reaction-type-int {:id reaction-type-int
@ -42,12 +42,13 @@
{:weight :medium {:weight :medium
:size :paragraph-1 :size :paragraph-1
:style (style/tab-count (= selected-tab :style (style/tab-count (= selected-tab
reaction-type-int))} reaction-type-int)
theme)}
(count author-details)]]})) (count author-details)]]}))
reactions-order)) reactions-order))
(defn reaction-authors-comp (defn- reaction-authors-comp
[selected-tab reaction-authors reactions-order] [{:keys [selected-tab reaction-authors reactions-order theme]}]
[:<> [:<>
[rn/view style/tabs-container [rn/view style/tabs-container
[quo/tabs [quo/tabs
@ -56,7 +57,10 @@
:in-scroll-view? true :in-scroll-view? true
:on-change #(reset! selected-tab %) :on-change #(reset! selected-tab %)
:default-active @selected-tab :default-active @selected-tab
:data (get-tabs-data reaction-authors @selected-tab reactions-order)}]] :data (get-tabs-data {:reaction-authors reaction-authors
:selected-tab @selected-tab
:reactions-order reactions-order
:theme theme})}]]
[gesture/flat-list [gesture/flat-list
{:data (for [contact (get reaction-authors @selected-tab)] {:data (for [contact (get reaction-authors @selected-tab)]
contact) contact)
@ -65,13 +69,17 @@
:style style/authors-list}]]) :style style/authors-list}]])
(defn reaction-authors (defn reaction-authors
[reactions-order] [{:keys [reactions-order theme]}]
(let [{:keys [reaction-authors-list (let [{:keys [reaction-authors-list
selected-reaction]} (rf/sub [:chat/reactions-authors]) selected-reaction]} (rf/sub [:chat/reactions-authors])
selected-tab (reagent/atom (or selected-reaction selected-tab (reagent/atom (or selected-reaction
(first (keys reaction-authors-list))))] (first (keys reaction-authors-list))))]
(fn [] (fn []
[reaction-authors-comp selected-tab reaction-authors-list reactions-order]))) [reaction-authors-comp
{:selected-tab selected-tab
:reaction-authors reaction-authors-list
:reactions-order reactions-order
:theme theme}])))
(defn pin-message (defn pin-message
[{:keys [chat-id pinned pinned-by] :as message-data}] [{:keys [chat-id pinned pinned-by] :as message-data}]

View File

@ -10,13 +10,14 @@
[status-im2.common.contact-list.view :as contact-list] [status-im2.common.contact-list.view :as contact-list]
[status-im2.common.resources :as resources] [status-im2.common.resources :as resources]
[status-im2.common.contact-list-item.view :as contact-list-item] [status-im2.common.contact-list-item.view :as contact-list-item]
[status-im2.contexts.chat.new-chat.styles :as style])) [status-im2.contexts.chat.new-chat.styles :as style]
[quo2.theme :as quo.theme]))
(defn- no-contacts-view (defn- no-contacts-view
[] [{:keys [theme]}]
[rn/view [rn/view
{:style (style/no-contacts)} {:style (style/no-contacts)}
[rn/image {:source (resources/get-themed-image :no-contacts-dark :no-contacts-light)}] [rn/image {:source (resources/get-themed-image :no-contacts theme)}]
[quo/text [quo/text
{:weight :semi-bold {:weight :semi-bold
:size :paragraph-1 :size :paragraph-1
@ -56,8 +57,8 @@
:on-check on-toggle}} :on-check on-toggle}}
item]))) item])))
(defn view (defn- view-internal
[{:keys [scroll-enabled on-scroll close]}] [{:keys [scroll-enabled on-scroll close theme]}]
(let [contacts (rf/sub [:contacts/sorted-and-grouped-by-first-letter]) (let [contacts (rf/sub [:contacts/sorted-and-grouped-by-first-letter])
selected-contacts-count (rf/sub [:selected-contacts-count]) selected-contacts-count (rf/sub [:selected-contacts-count])
selected-contacts (rf/sub [:group/selected-contacts]) selected-contacts (rf/sub [:group/selected-contacts])
@ -77,19 +78,19 @@
[quo/text [quo/text
{:weight :semi-bold {:weight :semi-bold
:size :heading-1 :size :heading-1
:style {:color (colors/theme-colors colors/neutral-100 colors/white)}} :style {:color (colors/theme-colors colors/neutral-100 colors/white theme)}}
(i18n/label :t/new-chat)] (i18n/label :t/new-chat)]
(when (seq contacts) (when (seq contacts)
[quo/text [quo/text
{:size :paragraph-2 {:size :paragraph-2
:weight :regular :weight :regular
:style {:margin-bottom 2 :style {:margin-bottom 2
:color (colors/theme-colors colors/neutral-40 colors/neutral-50)}} :color (colors/theme-colors colors/neutral-40 colors/neutral-50 theme)}}
(i18n/label :t/selected-count-from-max (i18n/label :t/selected-count-from-max
{:selected selected-contacts-count {:selected selected-contacts-count
:max constants/max-group-chat-participants})])]] :max constants/max-group-chat-participants})])]]
(if (empty? contacts) (if (empty? contacts)
[no-contacts-view] [no-contacts-view {:theme theme}]
[gesture/section-list [gesture/section-list
{:key-fn :title {:key-fn :title
:sticky-section-headers-enabled false :sticky-section-headers-enabled false
@ -111,3 +112,5 @@
(if one-contact-selected? (if one-contact-selected?
(i18n/label :t/chat-with {:selected-user primary-name}) (i18n/label :t/chat-with {:selected-user primary-name})
(i18n/label :t/setup-group-chat))])])) (i18n/label :t/setup-group-chat))])]))
(def view (quo.theme/with-theme view-internal))

View File

@ -2,13 +2,13 @@
(:require [utils.re-frame :as rf] (:require [utils.re-frame :as rf]
[react-native.core :as rn] [react-native.core :as rn]
[status-im2.config :as config] [status-im2.config :as config]
[quo2.foundations.colors :as colors]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.safe-area :as safe-area] [react-native.safe-area :as safe-area]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[status-im.async-storage.core :as async-storage] [status-im.async-storage.core :as async-storage]
[status-im2.contexts.shell.jump-to.state :as state] [status-im2.contexts.shell.jump-to.state :as state]
[status-im2.contexts.shell.jump-to.constants :as shell.constants])) [status-im2.contexts.shell.jump-to.constants :as shell.constants]
[quo2.theme :as quo.theme]))
;;;; Helper Functions ;;;; Helper Functions
@ -126,7 +126,7 @@
(defn change-shell-status-bar-style (defn change-shell-status-bar-style
[] []
(rf/dispatch [:change-shell-status-bar-style (rf/dispatch [:change-shell-status-bar-style
(if (or (colors/dark?) (if (or (quo.theme/get-theme)
(not (home-stack-open?))) (not (home-stack-open?)))
:light :light
:dark)])) :dark)]))

View File

@ -1,6 +1,7 @@
(ns status-im2.navigation.options (ns status-im2.navigation.options
(:require [quo2.foundations.colors :as colors] (:require [quo2.foundations.colors :as colors]
[react-native.platform :as platform])) [react-native.platform :as platform]
[quo2.theme :as quo.theme]))
(defn default-options (defn default-options
[] []
@ -44,12 +45,14 @@
(defn navbar (defn navbar
([dark?] ([dark?]
{:navigationBar {:backgroundColor (if (or dark? (colors/dark?)) colors/neutral-100 colors/white)}}) {:navigationBar {:backgroundColor (if (or dark? (= :dark (quo.theme/get-theme)))
colors/neutral-100
colors/white)}})
([] (navbar nil))) ([] (navbar nil)))
(defn statusbar (defn statusbar
([dark?] ([dark?]
(let [style (if (or dark? (colors/dark?)) :light :dark)] (let [style (if (or dark? (= :dark (quo.theme/get-theme))) :light :dark)]
(if platform/android? (if platform/android?
{:statusBar {:translucent true {:statusBar {:translucent true
:backgroundColor :transparent :backgroundColor :transparent

View File

@ -2,7 +2,8 @@
(:require [status-im2.navigation.view :as views] (:require [status-im2.navigation.view :as views]
[quo2.foundations.colors :as colors] [quo2.foundations.colors :as colors]
[status-im2.navigation.options :as options] [status-im2.navigation.options :as options]
[status-im2.constants :as constants])) [status-im2.constants :as constants]
[quo2.theme :as quo.theme]))
(defn get-screen-options (defn get-screen-options
[screen] [screen]
@ -80,38 +81,39 @@
(defn roots (defn roots
[] []
(merge (old-roots) (merge
(old-roots)
{:intro {:intro
{:root {:root
{:stack {:id :intro {:stack {:id :intro
:children [{:component {:name :intro :children [{:component {:name :intro
:id :intro :id :intro
:options (options/default-root nil colors/neutral-100)}}]}}} :options (options/default-root nil colors/neutral-100)}}]}}}
:shell-stack :shell-stack
{:root {:root
{:stack {:id :shell-stack {:stack {:id :shell-stack
:children [{:component {:name :shell-stack :children [{:component {:name :shell-stack
:id :shell-stack :id :shell-stack
:options (options/default-root :options (options/default-root
(if (colors/dark?) :light :dark))}}]}}} (if (= :dark (quo.theme/get-theme)) :light :dark))}}]}}}
:profiles :profiles
{:root {:root
{:stack {:id :profiles {:stack {:id :profiles
:children [{:component {:name :profiles :children [{:component {:name :profiles
:id :profiles :id :profiles
:options (options/default-root)}}]}}}
:enable-notifications
{:root {:stack {:children [{:component {:name :enable-notifications
:id :enable-notifications
:options (options/default-root)}}]}}} :options (options/default-root)}}]}}}
:enable-notifications :welcome
{:root {:stack {:children [{:component {:name :enable-notifications {:root {:stack {:children [{:component {:name :welcome
:id :enable-notifications :id :welcome
:options (options/default-root)}}]}}} :options (options/default-root)}}]}}}
:syncing-results
:welcome {:root {:stack {:children [{:component {:name :syncing-results
{:root {:stack {:children [{:component {:name :welcome :id :syncing-results
:id :welcome :options (options/default-root)}}]}}}}))
:options (options/default-root)}}]}}}
:syncing-results
{:root {:stack {:children [{:component {:name :syncing-results
:id :syncing-results
:options (options/default-root)}}]}}}}))