From 4aeeee6d9c576b1f90b1410b998e10e1dfc10c20 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 5 Jan 2021 11:36:42 -0500 Subject: [PATCH] feat: hide community stuff by default and add a setting to show it --- ui/app/AppLayouts/Chat/ChatLayout.qml | 2 +- .../CommunityComponents/CommunityButton.qml | 2 +- .../CommunityComponents/CommunityList.qml | 22 --------------- ui/app/AppLayouts/Chat/ContactsColumn.qml | 27 ++++++++++++++----- .../Chat/ContactsColumn/AddChat.qml | 1 + .../Chat/ContactsColumn/ChannelList.qml | 1 + .../Profile/Sections/AdvancedContainer.qml | 23 +++++++++++++++- ui/main.qml | 2 ++ 8 files changed, 49 insertions(+), 31 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 7867abe2b5..e36060aac0 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -73,7 +73,7 @@ SplitView { SplitView.preferredWidth: Style.current.leftTabPrefferedSize SplitView.minimumWidth: Style.current.leftTabMinimumWidth SplitView.maximumWidth: Style.current.leftTabMaximumWidth - sourceComponent: chatsModel.activeCommunity.active ? communtiyColumnComponent : contactsColumnComponent + sourceComponent: appSettings.communitiesEnabled && chatsModel.activeCommunity.active ? communtiyColumnComponent : contactsColumnComponent } Component { diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml index 8b4686712e..da5f979d44 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml @@ -21,7 +21,7 @@ Rectangle { if (communityButton.hovered) { return Style.current.secondaryBackground } - return Style.current.transparent + return Style.current.background } anchors.right: parent.right anchors.top: applicationWindow.top diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityList.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityList.qml index 23aa865c7f..d3a230241a 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityList.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityList.qml @@ -24,7 +24,6 @@ Item { communityId: model.id name: model.name description: model.description - // TODO add other properties searchStr: root.searchStr } } @@ -44,27 +43,6 @@ Item { text: qsTr("No search results in Communities") } } - -// Connections { -// target: chatsModel.chats -// onDataChanged: { -// // If the current active channel receives messages and changes its position, -// // refresh the currentIndex accordingly -// if(chatsModel.activeChannelIndex !== communityListView.currentIndex){ -// communityListView.currentIndex = chatsModel.activeChannelIndex -// } -// } -// } - -// Connections { -// target: chatsModel -// onActiveChannelChanged: { -// chatsModel.hideLoadingIndicator() -// communityListView.currentIndex = chatsModel.activeChannelIndex -// SelectedMessage.reset(); -// chatColumn.isReply = false; -// } -// } } diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index 09d3757a13..3282528520 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -117,18 +117,33 @@ Item { leftPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - contentHeight: communityList.height + channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height + contentHeight: communitiesListLoader.height + channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height clip: true - CommunityList { - id: communityList - searchStr: contactsColumn.searchStr.toLowerCase() + Loader { + id: communitiesListLoader + active: appSettings.communitiesEnabled + width: parent.width + height: { + if (item && active) { + return item.height + } + + return 0 + } + sourceComponent: Component { + CommunityList { + id: communityList + visible: appSettings.communitiesEnabled + searchStr: contactsColumn.searchStr.toLowerCase() + } + } } Separator { id: communitySep - visible: communityList.visible - anchors.top: communityList.bottom + visible: communitiesListLoader.active + anchors.top: visible ? communitiesListLoader.bottom : 0 anchors.topMargin: Style.current.halfPadding } diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/AddChat.qml b/ui/app/AppLayouts/Chat/ContactsColumn/AddChat.qml index dddabbf90c..843f15786d 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/AddChat.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/AddChat.qml @@ -46,6 +46,7 @@ StatusRoundButton { onTriggered: openPopup(publicChatPopupComponent) } Action { + enabled: appSettings.communitiesEnabled text: qsTr("Communities") icon.source: "../../../img/communities.svg" icon.width: 20 diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml index f321707168..80995ac1df 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml @@ -13,6 +13,7 @@ Rectangle { id: channelListContent width: parent.width height: childrenRect.height + color: Style.current.transparent Timer { id: timer diff --git a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml index f1eb90a680..56fc997aa6 100644 --- a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml @@ -24,12 +24,33 @@ Item { } RowLayout { - id: walletTabSettings + id: communitiesTabSettings anchors.top: title.bottom anchors.topMargin: 20 anchors.left: parent.left anchors.leftMargin: 24 + StyledText { + text: qsTr("Enable Communities") + } + StatusSwitch { + checked: appSettings.communitiesEnabled + onCheckedChanged: function(value) { + appSettings.communitiesEnabled = this.checked + } + } + StyledText { + text: qsTr("Currently WIP") + } + } + + RowLayout { + id: walletTabSettings + anchors.top: communitiesTabSettings.bottom + anchors.topMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 24 + StyledText { //% "Wallet Tab" text: qsTrId("wallet-tab") diff --git a/ui/main.qml b/ui/main.qml index ac2b1098d7..da059300df 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -93,6 +93,7 @@ ApplicationWindow { Settings { id: defaultAppSettings + property bool communitiesEnabled: false property bool walletEnabled: false property bool browserEnabled: false property bool displayChatImages: false @@ -138,6 +139,7 @@ ApplicationWindow { property var chatSplitView property var walletSplitView property var profileSplitView + property bool communitiesEnabled: defaultAppSettings.communitiesEnabled property bool walletEnabled: defaultAppSettings.walletEnabled property bool browserEnabled: defaultAppSettings.browserEnabled property bool displayChatImages: defaultAppSettings.displayChatImages