feat(Communities): add Back up community rectangle for admins

Fixes #2417
This commit is contained in:
Jonathan Rainville 2021-04-28 15:03:41 -04:00 committed by Iuri Matias
parent 0850835b34
commit f353a29c3f
6 changed files with 92 additions and 15 deletions

View File

@ -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 {

View File

@ -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()})
}
}

View File

@ -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()})
}
}

View File

@ -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

5
ui/app/img/key.svg Normal file
View File

@ -0,0 +1,5 @@
<svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="0.5" width="40" height="40" rx="20" fill="#4360DF" fill-opacity="0.1"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.8561 24.8391C17.8561 26.0317 16.8846 26.9985 15.6861 26.9985C14.4877 26.9985 13.5161 26.0317 13.5161 24.8391C13.5161 23.6465 14.4877 22.6797 15.6861 22.6797C16.8846 22.6797 17.8561 23.6465 17.8561 24.8391ZM16.3481 24.8391C16.3481 25.2029 16.0517 25.4978 15.6861 25.4978C15.3206 25.4978 15.0242 25.2029 15.0242 24.8391C15.0242 24.4753 15.3206 24.1804 15.6861 24.1804C16.0517 24.1804 16.3481 24.4753 16.3481 24.8391Z" fill="#4360DF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M25.6478 19.0812C25.6005 19.273 25.4442 19.4192 25.2489 19.4543L24.2802 19.6282C24.0611 19.6675 23.8941 19.8456 23.8698 20.0658L23.7137 21.4777C23.7007 21.5955 23.6461 21.7049 23.5596 21.7863L22.652 22.6412C22.5267 22.7592 22.4725 22.9326 22.498 23.1023C22.5419 23.3942 22.5646 23.693 22.5646 23.9971C22.5646 27.3124 19.8638 30 16.5323 30C13.2007 30 10.5 27.3124 10.5 23.9971C10.5 20.6817 13.2007 17.9941 16.5323 17.9941C17.2283 17.9941 17.8967 18.1114 18.5188 18.3272C18.709 18.3932 18.9224 18.3534 19.0661 18.2129L27.3142 10.1435C27.4083 10.0515 27.5348 10 27.6667 10H29.9971C30.3164 10 30.5547 10.2923 30.4891 10.6032L29.6655 14.5006C29.6295 14.6711 29.5069 14.8107 29.3419 14.869L28.4524 15.1836C28.3038 15.2362 28.1886 15.3551 28.1413 15.5048L27.7408 16.7717C27.6902 16.9316 27.5624 17.0557 27.4005 17.1022L26.3191 17.4125C26.1462 17.4621 26.0131 17.6 25.9702 17.7739L25.6478 19.0812ZM21.0565 23.9971C21.0565 23.6498 21.017 23.3117 20.9422 22.9871L20.9329 22.9595C20.8759 22.7914 20.8116 22.6264 20.7404 22.4649C20.7279 22.4366 20.7343 22.4035 20.7567 22.382L22.2095 20.9916C22.2389 20.9639 22.2574 20.9268 22.2618 20.8868L22.4939 18.7878C22.5182 18.5676 22.6852 18.3896 22.9043 18.3502L24.0176 18.1504C24.2129 18.1153 24.3693 17.9691 24.4166 17.7773L24.7137 16.5726C24.7566 16.3986 24.8896 16.2608 25.0626 16.2112L26.2049 15.8834C26.3668 15.8369 26.4946 15.7128 26.5451 15.5529L26.9282 14.3412C26.9755 14.1914 27.0908 14.0725 27.2394 14.0199L28.0401 13.7367C28.2051 13.6784 28.3277 13.5388 28.3637 13.3683L28.6533 11.998C28.7074 11.7417 28.5109 11.5007 28.2477 11.5007C28.139 11.5007 28.0347 11.5432 27.9572 11.6191L20.1873 19.2212L19.0987 20.2834C19.0968 20.2852 19.0938 20.2855 19.0916 20.284C18.3637 19.7862 17.4822 19.4949 16.5323 19.4949C14.0336 19.4949 12.0081 21.5106 12.0081 23.9971C12.0081 26.4836 14.0336 28.4993 16.5323 28.4993C19.0309 28.4993 21.0565 26.4836 21.0565 23.9971Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -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 \