From 5108f6db2b6faf357368927204ff40ebb6e20c6a Mon Sep 17 00:00:00 2001 From: Boris Melnik Date: Wed, 12 Oct 2022 15:39:31 +0300 Subject: [PATCH] feat(Communities): Spectate futured communities Part of: #7072 --- .../CommunitiesPortal/CommunitiesPortalLayout.qml | 10 +++++++--- .../CommunitiesPortal/stores/CommunitiesStore.qml | 4 ++++ .../CommunitiesPortal/views/CommunitiesGridView.qml | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml index 32f4397e5d..ffec376149 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/CommunitiesPortalLayout.qml @@ -53,8 +53,12 @@ StatusSectionLayout { readonly property bool searchMode: searcher.text.length > 0 - function navigateToCommunity(communityId) { - root.communitiesStore.setActiveCommunity(communityId) + function navigateToCommunity(communityId: string, joined: bool) { + if (joined) { + root.communitiesStore.setActiveCommunity(communityId) + } else { + root.communitiesStore.spectateCommunity(communityId) + } } } @@ -161,7 +165,7 @@ StatusSectionLayout { model: searchModel searchLayout: d.searchMode - onCardClicked: d.navigateToCommunity(communityId) + onCardClicked: d.navigateToCommunity(communityId, joined) } StatusBaseText { diff --git a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml index 06448a2636..d3fe6d893e 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/stores/CommunitiesStore.qml @@ -90,6 +90,10 @@ QtObject { mainModule.setActiveSectionById(communityId); } + function spectateCommunity(communityId: string) { + communitiesModuleInst.spectateCommunity(communityId, userProfile.name) + } + function setFileListItems(filePaths) { root.communitiesModuleInst.setFileListItems(filePaths) } diff --git a/ui/app/AppLayouts/CommunitiesPortal/views/CommunitiesGridView.qml b/ui/app/AppLayouts/CommunitiesPortal/views/CommunitiesGridView.qml index f7c686a71a..a3e0fd05a5 100644 --- a/ui/app/AppLayouts/CommunitiesPortal/views/CommunitiesGridView.qml +++ b/ui/app/AppLayouts/CommunitiesPortal/views/CommunitiesGridView.qml @@ -16,7 +16,7 @@ StatusScrollView { property var model property bool searchLayout: false - signal cardClicked(string communityId) + signal cardClicked(communityId: string, joined: bool) clip: false @@ -65,7 +65,7 @@ StatusScrollView { popularity: model.popularity // categories: model.categories - onClicked: root.cardClicked(communityId) + onClicked: root.cardClicked(communityId, model.joined) } }