diff --git a/ui/app/AppLayouts/Chat/CommunityColumn.qml b/ui/app/AppLayouts/Chat/CommunityColumn.qml index d5e1b38bb7..2fd84e9425 100644 --- a/ui/app/AppLayouts/Chat/CommunityColumn.qml +++ b/ui/app/AppLayouts/Chat/CommunityColumn.qml @@ -26,6 +26,11 @@ Rectangle { } } + Component { + id: transferOwnershipPopup + TransferOwnershipPopup {} + } + Item { id: communityHeader width: parent.width @@ -119,7 +124,7 @@ Rectangle { leftPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - contentHeight: channelList.height + emptyViewAndSuggestions.height + 2 * Style.current.padding + contentHeight: channelList.height + emptyViewAndSuggestionsLoader.height + backUpBannerLoader.height + 2 * Style.current.padding clip: true ChannelList { @@ -128,12 +133,27 @@ Rectangle { channelModel: chatsModel.communities.activeCommunity.chats } - CommunityWelcomeBanner { - id: emptyViewAndSuggestions - visible: !appSettings.hiddenCommunityWelcomeBanners.includes(chatsModel.communities.activeCommunity.id) && chatsModel.communities.activeCommunity.admin + Loader { + id: emptyViewAndSuggestionsLoader + active: !appSettings.hiddenCommunityWelcomeBanners.includes(chatsModel.communities.activeCommunity.id) && chatsModel.communities.activeCommunity.admin width: parent.width + height: active ? item.height : 0 anchors.top: channelList.bottom - anchors.topMargin: Style.current.padding + anchors.topMargin: active ? Style.current.padding : 0 + sourceComponent: Component { + CommunityWelcomeBanner {} + } + } + Loader { + id: backUpBannerLoader + active: chatsModel.communities.activeCommunity.admin + width: parent.width + height: active ? item.height : 0 + anchors.top: emptyViewAndSuggestionsLoader.bottom + anchors.topMargin: active ? Style.current.padding : 0 + sourceComponent: Component { + BackUpCommuntyBanner {} + } } CommunityProfilePopup { diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/BackUpCommuntyBanner.qml b/ui/app/AppLayouts/Chat/CommunityComponents/BackUpCommuntyBanner.qml new file mode 100644 index 0000000000..7d46225e11 --- /dev/null +++ b/ui/app/AppLayouts/Chat/CommunityComponents/BackUpCommuntyBanner.qml @@ -0,0 +1,59 @@ +import QtQuick 2.13 +import "../../../../shared" +import "../../../../shared/status" +import "../../../../imports" +import "." + +Rectangle { + id: root + height: childrenRect.height + Style.current.padding + anchors.left: parent.left + anchors.leftMargin: Style.current.padding + anchors.right: parent.right + anchors.rightMargin: Style.current.padding + border.color: Style.current.border + radius: 16 + color: Style.current.transparent + + Rectangle { + width: 66 + height: 4 + color: Style.current.secondaryMenuBackground + anchors.top: parent.top + anchors.topMargin: -2 + anchors.horizontalCenter: parent.horizontalCenter + } + + SVGImage { + anchors.top: parent.top + anchors.topMargin: -6 + anchors.horizontalCenter: parent.horizontalCenter + source: "../../../img/key.svg" + width: 40 + height: 40 + } + + StyledText { + id: backUpText + text: qsTr("Back up community key") + anchors.top: parent.top + anchors.topMargin: 48 + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 15 + wrapMode: Text.WordWrap + anchors.right: parent.right + anchors.rightMargin: Style.current.xlPadding + anchors.left: parent.left + anchors.leftMargin: Style.current.xlPadding + } + + StatusButton { + id: backUpBtn + text: qsTr("Back up") + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: backUpText.bottom + anchors.topMargin: Style.current.padding + onClicked: openPopup(transferOwnershipPopup, {privateKey: chatsModel.communities.exportComumnity()}) + } +} + diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopupOverview.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopupOverview.qml index 8deb313328..44bbcdb674 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopupOverview.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopupOverview.qml @@ -220,15 +220,7 @@ Item { label: qsTr("Transfer ownership") iconName: "../transfer" type: globalSettings.theme === Universal.Dark ? "secondary" : "primary" - onClicked: { - const exportResult = chatsModel.communities.exportComumnity() - openPopup(transferOwnershipPopup, {privateKey: exportResult}) - } - - Component { - id: transferOwnershipPopup - TransferOwnershipPopup {} - } + onClicked: openPopup(transferOwnershipPopup, {privateKey: chatsModel.communities.exportComumnity()}) } } diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml index 7d564ad4f1..8df0279250 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml @@ -8,7 +8,7 @@ import "." Rectangle { id: root - height: visible ? 220 : 0 + height: 220 anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.right: parent.right diff --git a/ui/app/img/key.svg b/ui/app/img/key.svg new file mode 100644 index 0000000000..ab6559c692 --- /dev/null +++ b/ui/app/img/key.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index ebac89064f..08c39fa749 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -130,6 +130,7 @@ DISTFILES += \ app/AppLayouts/Chat/ChatColumn/MessageComponents/qmldir \ app/AppLayouts/Chat/CommunityColumn.qml \ app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml \ + app/AppLayouts/Chat/CommunityComponents/BackUpCommuntyBanner.qml \ app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml \ app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml \ app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml \