From 9d103e5b0768e953acbe9165c921bcbc5ae0acd4 Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Sat, 1 Oct 2022 16:07:14 +0400 Subject: [PATCH] feat(ActivityCenter): Fix unreadNotificationsCount availability on every section Close #7674 --- ui/app/AppLayouts/Browser/BrowserLayout.qml | 3 +++ .../AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml | 2 ++ ui/app/AppLayouts/Node/stores/RootStore.qml | 3 +++ ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml | 4 ++++ ui/app/AppLayouts/Wallet/stores/RootStore.qml | 5 ++++- ui/app/AppLayouts/stores/RootStore.qml | 4 ++++ .../activitycenter/panels/ActivityCenterPopupTopBarPanel.qml | 2 +- .../mainui/activitycenter/views/ActivityNotificationBase.qml | 2 +- 8 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 28ec4456d4..db60f75eef 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -26,6 +26,7 @@ import "stores" StatusSectionLayout { id: root + property var globalStore property var sendTransactionModal @@ -34,7 +35,9 @@ StatusSectionLayout { tab.item.url = _internal.determineRealURL(url) } + notificationCount: root.globalStore.unreadNotificationsCount onNotificationButtonClicked: Global.openActivityCenterPopup() + QtObject { id: _internal diff --git a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml index 1561110318..0914d5d4be 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml @@ -21,6 +21,8 @@ QtObject { property var advancedModule: profileSectionModule.advancedModule property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel property int unreadNotificationsCount: activityCenterList.unreadCount // TODO: Could the backend provide directly 2 filtered models?? //property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities diff --git a/ui/app/AppLayouts/Node/stores/RootStore.qml b/ui/app/AppLayouts/Node/stores/RootStore.qml index 39da65b4cb..e57d32e62d 100644 --- a/ui/app/AppLayouts/Node/stores/RootStore.qml +++ b/ui/app/AppLayouts/Node/stores/RootStore.qml @@ -5,7 +5,10 @@ import utils 1.0 QtObject { id: root + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel property int unreadNotificationsCount: activityCenterList.unreadCount + property var nodeModelInst: nodeModel // property var profileModelInst: profileModel diff --git a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml index 5dd8c2cd42..badb0a2052 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml @@ -5,7 +5,11 @@ import AppLayouts.Chat.stores 1.0 QtObject { id: root + property string backButtonName + + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel property int unreadNotificationsCount: activityCenterList.unreadCount property var aboutModuleInst: aboutModule diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index ed51ad73b5..3f68652b3c 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -9,7 +9,6 @@ QtObject { id: root property string backButtonName: "" - property int unreadNotificationsCount: activityCenterList.unreadCount property var currentAccount: Constants.isCppApp ? walletSectionAccounts.currentAccount: walletSectionCurrent property var accounts: walletSectionAccounts.model property var generatedAccounts: walletSectionAccounts.generated @@ -24,6 +23,10 @@ QtObject { property string signingPhrase: walletSection.signingPhrase property string mnemonicBackedUp: walletSection.isMnemonicBackedUp + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel + property int unreadNotificationsCount: activityCenterList.unreadCount + property var walletTokensModule: walletSectionAllTokens property var tokens: walletSectionAllTokens.all diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index af6193c034..413e56c634 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -14,6 +14,10 @@ QtObject { property var communitiesModuleInst: communitiesModule property var observedCommunity: communitiesModuleInst.observedCommunity + property var activityCenterModuleInst: activityCenterModule + property var activityCenterList: activityCenterModuleInst.activityNotificationsModel + property int unreadNotificationsCount: activityCenterList.unreadCount + property bool newVersionAvailable: false property string latestVersion property string downloadURL diff --git a/ui/app/mainui/activitycenter/panels/ActivityCenterPopupTopBarPanel.qml b/ui/app/mainui/activitycenter/panels/ActivityCenterPopupTopBarPanel.qml index d890b7e58b..6b3f580f5e 100644 --- a/ui/app/mainui/activitycenter/panels/ActivityCenterPopupTopBarPanel.qml +++ b/ui/app/mainui/activitycenter/panels/ActivityCenterPopupTopBarPanel.qml @@ -88,7 +88,7 @@ Item { StatusToolTip { visible: hideReadNotificationsBtn.hovered - offset: hideReadNotificationsBtn.width + offset: width / 4 text: root.hideReadNotifications ? qsTr("Show read notifications") : qsTr("Hide read notifications") } } diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml index 2274f03c7f..9f6f4833c6 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationBase.qml @@ -30,7 +30,7 @@ Item { Loader { id: badgeLoader - anchors.top: bodyLoader.bottom + anchors.bottom: parent.bottom anchors.left: parent.left anchors.leftMargin: 61 // TODO find a way to align with the text of the message }