Skip to content

Commit

Permalink
[#17393] fix: resolve review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen-ghafouri committed Dec 20, 2023
1 parent 83f2524 commit fa4a5cb
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 37 deletions.
16 changes: 8 additions & 8 deletions src/quo/components/buttons/logout_button/component_spec.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
4 changes: 2 additions & 2 deletions src/quo/components/buttons/logout_button/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand All @@ -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))
18 changes: 9 additions & 9 deletions src/quo/components/drawers/action_drawers/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 1 addition & 4 deletions src/quo/components/drawers/action_drawers/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/status_im/contexts/profile/settings/header/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
7 changes: 4 additions & 3 deletions src/status_im/contexts/profile/settings/header/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,15 +43,15 @@
: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
:content (fn [] [visibility-sheet/view
{: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
Expand Down
8 changes: 7 additions & 1 deletion src/status_im/contexts/profile/settings/list_items.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit fa4a5cb

Please sign in to comment.