From 84da3128bf88f8490c1372df4ef2700bd11868be Mon Sep 17 00:00:00 2001 From: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:45:49 +0530 Subject: [PATCH] [Fix] Activity Centre UI bug (#14398) * [Fix] Activity Centre UI bug * [Fix] Namespace update for config * [Chore] Moved navigation to Activity Center as reframe event * [Chore] Code Format --- src/status_im/activity_center/core.cljs | 12 ++++++++++++ src/status_im/ui/screens/activity_center/style.cljs | 2 +- src/status_im/ui/screens/home/views.cljs | 7 +------ src/status_im/ui2/screens/chat/home.cljs | 6 +++--- src/status_im2/contexts/communities/home/view.cljs | 10 +++++++++- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/status_im/activity_center/core.cljs b/src/status_im/activity_center/core.cljs index a793c4731c..d31200de9b 100644 --- a/src/status_im/activity_center/core.cljs +++ b/src/status_im/activity_center/core.cljs @@ -6,6 +6,18 @@ [status-im.utils.fx :as fx] [taoensso.timbre :as log])) +;;;; Navigation + +(fx/defn open-activity-center + {:events [:activity-center/open]} + [_] + (rf/dispatch [:show-popover {:view :activity-center + :style {:margin 0} + :disable-touchable-overlay? true + :blur-view? true + :blur-view-props {:blur-amount 20 + :blur-type :dark}}])) + ;;;; Misc (fx/defn process-notification-failure diff --git a/src/status_im/ui/screens/activity_center/style.cljs b/src/status_im/ui/screens/activity_center/style.cljs index 3fb6a8454c..670b6302d0 100644 --- a/src/status_im/ui/screens/activity_center/style.cljs +++ b/src/status_im/ui/screens/activity_center/style.cljs @@ -16,7 +16,7 @@ [window-width top bottom] {:flex 1 :width window-width - :padding-top (if (pos? 0) (+ top 12) 12) + :padding-top (if (pos? top) (+ top 12) 12) :padding-bottom bottom}) (def notifications-container diff --git a/src/status_im/ui/screens/home/views.cljs b/src/status_im/ui/screens/home/views.cljs index 78589171b4..ea4ee6bc74 100644 --- a/src/status_im/ui/screens/home/views.cljs +++ b/src/status_im/ui/screens/home/views.cljs @@ -259,12 +259,7 @@ :on-press #(do (re-frame/dispatch [:mark-all-activity-center-notifications-as-read]) (if config/new-activity-center-enabled? - (re-frame/dispatch [:show-popover {:view :activity-center - :style {:margin 0} - :disable-touchable-overlay? true - :blur-view? true - :blur-view-props {:blur-amount 20 - :blur-type :dark}}]) + (re-frame/dispatch [:activity-center/open]) (re-frame/dispatch [:navigate-to :notifications-center])))} [icons/icon :main-icons/notification2 {:color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}]] (when (pos? notif-count) diff --git a/src/status_im/ui2/screens/chat/home.cljs b/src/status_im/ui2/screens/chat/home.cljs index 8c07649c8a..bd50a9a7de 100644 --- a/src/status_im/ui2/screens/chat/home.cljs +++ b/src/status_im/ui2/screens/chat/home.cljs @@ -18,7 +18,6 @@ [status-im.ui.components.topbar :as topbar] [status-im.ui.components.invite.views :as invite] [status-im.utils.handlers :refer [evt]] - [status-im.utils.config :as config] [quo2.components.markdown.text :as quo2.text] [status-im.qr-scanner.core :as qr-scanner] [status-im.ui.components.chat-icon.styles :as chat-icon.styles] @@ -37,7 +36,8 @@ [status-im.ui2.screens.chat.components.message-home-item.view :refer [messages-home-item]] [status-im.ui2.screens.chat.components.contact-item.view :refer [contact-item]] [clojure.string :as str] - [status-im2.common.plus-button.view :as components.plus-button]) + [status-im2.common.plus-button.view :as components.plus-button] + [status-im2.setup.config :as config]) (:require-macros [status-im.utils.views :as views])) (defn home-tooltip-view [] @@ -314,7 +314,7 @@ :on-press #(do (re-frame/dispatch [:mark-all-activity-center-notifications-as-read]) (if config/new-activity-center-enabled? - (re-frame/dispatch [:navigate-to :activity-center]) + (re-frame/dispatch [:activity-center/open]) (re-frame/dispatch [:navigate-to :notifications-center])))} [icons/icon :main-icons/notification2 {:color (colors/theme-colors colors/neutral-100 colors/white)}]] (when (pos? notif-count) diff --git a/src/status_im2/contexts/communities/home/view.cljs b/src/status_im2/contexts/communities/home/view.cljs index fec9a5b8b1..3562a52543 100644 --- a/src/status_im2/contexts/communities/home/view.cljs +++ b/src/status_im2/contexts/communities/home/view.cljs @@ -9,10 +9,17 @@ [quo2.foundations.colors :as colors] [quo2.components.community.discover-card :as discover-card] [quo2.components.navigation.top-nav :as topnav] + [status-im2.setup.config :as config] [status-im2.common.plus-button.view :as components.plus-button] [status-im2.contexts.communities.home.actions.view :as home.actions] [status-im2.contexts.communities.home.style :as style])) +(defn navigate-to-activity-center [] + (rf/dispatch [:mark-all-activity-center-notifications-as-read]) + (if config/new-activity-center-enabled? + (rf/dispatch [:activity-center/open]) + (rf/dispatch [:navigate-to :notifications-center]))) + (defn plus-button [] [components.plus-button/plus-button {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :add-new {}]) @@ -88,7 +95,8 @@ :background-color (colors/theme-colors colors/neutral-5 colors/neutral-95)}} - [topnav/top-nav {:type :default}] + [topnav/top-nav {:type :default + :open-activity-center navigate-to-activity-center}] [title-column] [discover-card/discover-card {:on-press #(rf/dispatch [:navigate-to :discover-communities]) :title (i18n/label :t/discover)