From fa4a5cb932187139cbf3116bc2430559f41c0df1 Mon Sep 17 00:00:00 2001 From: Mohsen Date: Wed, 13 Dec 2023 14:08:47 +0300 Subject: [PATCH] [#17393] fix: resolve review comments --- .../buttons/logout_button/component_spec.cljs | 16 +++++++-------- .../buttons/logout_button/view.cljs | 4 ++-- .../drawers/action_drawers/style.cljs | 18 ++++++++--------- .../drawers/action_drawers/view.cljs | 5 +---- .../profile/settings/header/utils.cljs | 20 +++++++++---------- .../profile/settings/header/view.cljs | 7 ++++--- .../contexts/profile/settings/list_items.cljs | 8 +++++++- 7 files changed, 41 insertions(+), 37 deletions(-) diff --git a/src/quo/components/buttons/logout_button/component_spec.cljs b/src/quo/components/buttons/logout_button/component_spec.cljs index 1f5050100f08..6e6acedabefe 100644 --- a/src/quo/components/buttons/logout_button/component_spec.cljs +++ b/src/quo/components/buttons/logout_button/component_spec.cljs @@ -6,30 +6,30 @@ (h/describe "button tests" (h/test "default render of logout button component" (h/render [logout-button/view - {:accessibility-label "test-button"}]) - (h/is-truthy (h/get-by-label-text "test-button"))) + {:accessibility-label :test-logout-button}]) + (h/is-truthy (h/get-by-label-text :test-logout-button))) (h/test "button on-press works" (let [event (h/mock-fn)] (h/render [logout-button/view {:on-press event - :accessibility-label "test-button"}]) - (h/fire-event :press (h/get-by-label-text "test-button")) + :accessibility-label :test-logout-button}]) + (h/fire-event :press (h/get-by-label-text :test-logout-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 - :accessibility-label "test-button" + :accessibility-label :test-logout-button :disabled? true}]) - (h/fire-event :press (h/get-by-label-text "test-button")) + (h/fire-event :press (h/get-by-label-text :test-logout-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 - :accessibility-label "test-button"}]) - (h/fire-event :long-press (h/get-by-label-text "test-button")) + :accessibility-label :test-logout-button}]) + (h/fire-event :long-press (h/get-by-label-text :test-logout-button)) (h/was-called event)))) diff --git a/src/quo/components/buttons/logout_button/view.cljs b/src/quo/components/buttons/logout_button/view.cljs index 7838f0df066f..5732f7ca8950 100644 --- a/src/quo/components/buttons/logout_button/view.cljs +++ b/src/quo/components/buttons/logout_button/view.cljs @@ -4,7 +4,7 @@ [quo.components.icon :as icon] [quo.components.markdown.text :as text] [quo.foundations.colors :as colors] - [quo.theme :as theme] + [quo.theme :as quo.theme] [react-native.core :as rn] [reagent.core :as reagent] [utils.i18n :as i18n])) @@ -29,4 +29,4 @@ [text/text {:weight :medium :size :paragraph-1} (i18n/label :t/logout)]]))) -(def view (theme/with-theme view-internal)) +(def view (quo.theme/with-theme view-internal)) diff --git a/src/quo/components/drawers/action_drawers/style.cljs b/src/quo/components/drawers/action_drawers/style.cljs index 49338a26ed37..7a16637197f9 100644 --- a/src/quo/components/drawers/action_drawers/style.cljs +++ b/src/quo/components/drawers/action_drawers/style.cljs @@ -13,15 +13,15 @@ (defn container [{:keys [sub-label disabled? state customization-color blur? theme]}] - (merge - {:border-radius 12 - :height (if sub-label 56 48) - :opacity (when disabled? 0.3) - :margin-horizontal 8} - (when (= state :selected) - {:background-color (if blur? - colors/white-opa-5 - (colors/resolve-color customization-color theme 5))}))) + (cond-> {:border-radius 12 + :height (if sub-label 56 48) + :opacity (when disabled? 0.3) + :margin-horizontal 8} + (= state :selected) + (assoc :background-color + (if blur? + colors/white-opa-5 + (colors/resolve-color customization-color theme 5))))) (defn row-container [sub-label] diff --git a/src/quo/components/drawers/action_drawers/view.cljs b/src/quo/components/drawers/action_drawers/view.cljs index 729375422757..0b27585c5da2 100644 --- a/src/quo/components/drawers/action_drawers/view.cljs +++ b/src/quo/components/drawers/action_drawers/view.cljs @@ -99,10 +99,7 @@ {:color (get-icon-color danger? theme) :size 20}]]) (when (= state :selected) - [rn/view - {:style style/right-icon - :accessible true - :accessibility-label :right-icon-for-action} + [rn/view {:style style/right-icon} [icon/icon :i/check {:color (if blur? colors/white diff --git a/src/status_im/contexts/profile/settings/header/utils.cljs b/src/status_im/contexts/profile/settings/header/utils.cljs index 2deae2ba42f9..9b0c9f293fdd 100644 --- a/src/status_im/contexts/profile/settings/header/utils.cljs +++ b/src/status_im/contexts/profile/settings/header/utils.cljs @@ -3,19 +3,19 @@ [utils.i18n :as i18n])) (defn visibility-status-type-data - [status] - (case (:status-type status) + [{:keys [status-type]}] + (case status-type (constants/visibility-status-automatic) - {:title (i18n/label :t/status-automatic) - :icon :i/automatic} + {:status-title (i18n/label :t/status-automatic) + :status-icon :i/automatic} (constants/visibility-status-always-online) - {:title (i18n/label :t/online) - :icon :i/online} + {:status-title (i18n/label :t/online) + :status-icon :i/online} (constants/visibility-status-inactive) - {:title (i18n/label :t/offline) - :icon :i/offline} + {:status-title (i18n/label :t/offline) + :status-icon :i/offline} - {:title (i18n/label :t/offline) - :icon :i/offline})) + {:status-title (i18n/label :t/offline) + :status-icon :i/offline})) diff --git a/src/status_im/contexts/profile/settings/header/view.cljs b/src/status_im/contexts/profile/settings/header/view.cljs index b5f481ef61d9..7391af2ca24d 100644 --- a/src/status_im/contexts/profile/settings/header/view.cljs +++ b/src/status_im/contexts/profile/settings/header/view.cljs @@ -22,7 +22,8 @@ customization-color (rf/sub [:profile/customization-color]) full-name (profile.utils/displayed-name 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 {:scroll-y scroll-y @@ -42,7 +43,7 @@ :type :outline :icon? true :no-icon-color? true - :icon-name (:icon (header.utils/visibility-status-type-data status)) + :icon-name status-icon :on-press #(rf/dispatch [:show-bottom-sheet {:shell? true :theme :dark @@ -50,7 +51,7 @@ {:customization-color customization-color :status-type (:status-type status)}])}])} - (:title (header.utils/visibility-status-type-data status))]]] + status-title]]] [quo/text-combinations {:container-style style/title-container :emoji-hash emoji-string diff --git a/src/status_im/contexts/profile/settings/list_items.cljs b/src/status_im/contexts/profile/settings/list_items.cljs index daa98943bf41..771600be5302 100644 --- a/src/status_im/contexts/profile/settings/list_items.cljs +++ b/src/status_im/contexts/profile/settings/list_items.cljs @@ -88,7 +88,13 @@ :action :arrow :image :icon :blur? true - :image-props :i/toggle}] + :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) :on-press not-implemented/alert :action :arrow}