From f12c7401d167d7adb81f97bdf9c0902b39ee37bc Mon Sep 17 00:00:00 2001 From: Flavio Fraschetti Date: Mon, 25 Sep 2023 19:04:03 +0100 Subject: [PATCH] WIP: refactor notifications (#17413) to accomplish #17288 migrated : notifications Issue Opened: A bug has been identified within the activity-logs component and is currently under investigation. --- .../components/notifications/toast/view.cljs | 4 +-- src/status_im2/contexts/quo_preview/main.cljs | 4 +-- .../notifications/notification.cljs | 2 +- .../quo_preview/notifications/toast.cljs | 31 ++++++++----------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/quo2/components/notifications/toast/view.cljs b/src/quo2/components/notifications/toast/view.cljs index 2b9e192c5d..2999f17d32 100644 --- a/src/quo2/components/notifications/toast/view.cljs +++ b/src/quo2/components/notifications/toast/view.cljs @@ -68,8 +68,7 @@ (def ^:private toast-container (quo.theme/with-theme toast-container-internal)) (defn toast - [{:keys [icon icon-color title text action undo-duration undo-on-press container-style - theme user]}] + [{:keys [icon icon-color title text action undo-duration undo-on-press container-style theme user]}] (let [context-theme (or theme (quo.theme/get-theme))] [quo.theme/provider {:theme context-theme} [toast-container @@ -78,7 +77,6 @@ (cond-> (style/icon context-theme) icon-color (assoc :color icon-color))] - user [user-avatar/user-avatar user]) :title title diff --git a/src/status_im2/contexts/quo_preview/main.cljs b/src/status_im2/contexts/quo_preview/main.cljs index 6f0d6f4a27..6a45f320e9 100644 --- a/src/status_im2/contexts/quo_preview/main.cljs +++ b/src/status_im2/contexts/quo_preview/main.cljs @@ -305,9 +305,9 @@ {:name :activity-logs-photos :component activity-logs-photos/preview-activity-logs-photos} {:name :toast - :component toast/preview-toasts} + :component toast/view} {:name :notification - :component notification/preview-notification}] + :component notification/view}] :onboarding [{:name :small-option-card :component small-option-card/preview-small-option-card}] :password [{:name :tips diff --git a/src/status_im2/contexts/quo_preview/notifications/notification.cljs b/src/status_im2/contexts/quo_preview/notifications/notification.cljs index 62deaf635d..9ec0e40b98 100644 --- a/src/status_im2/contexts/quo_preview/notifications/notification.cljs +++ b/src/status_im2/contexts/quo_preview/notifications/notification.cljs @@ -76,7 +76,7 @@ :duration 3000 :type :notification}]) -(defn preview-notification +(defn view [] (fn [] [preview/preview-container diff --git a/src/status_im2/contexts/quo_preview/notifications/toast.cljs b/src/status_im2/contexts/quo_preview/notifications/toast.cljs index 1ae5fd233a..3844a4dc05 100644 --- a/src/status_im2/contexts/quo_preview/notifications/toast.cljs +++ b/src/status_im2/contexts/quo_preview/notifications/toast.cljs @@ -86,22 +86,17 @@ :duration 3000}])} "update above toast"]]))))) -(defn preview-toasts +(defn view [] - (fn [] - [preview/preview-container - [rn/view - {:background-color "#508485" - :flex-direction :column - :justify-content :flex-start - :height 300}] - [into - [rn/view - {:flex 1 - :padding 16}] - [^{:key :basic} [toast-button-basic] - ^{:key :with-undo-action} [toast-button-with-undo-action] - ^{:key :with-multiline} [toast-button-multiline] - ^{:key :30s-duration} [toast-button-30s-duration] - ^{:key :upsert} - [update-toast-button]]]])) + [preview/preview-container + {:component-container-style + {:flex-direction :column + :justify-content :flex-start}} + [into + [rn/view {:style {:flex 1 :padding 16}} + [toast-button-basic] + [toast-button-with-undo-action] + [toast-button-multiline] + [toast-button-30s-duration] + [update-toast-button] + [update-toast-button]]]])