From 6213e020a0e64d103a341fedbd2e238554decc87 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 12 Feb 2021 10:26:57 -0500 Subject: [PATCH] feat: new design for export popup --- .../CommunityMembersPopup.qml | 12 ++-- .../CommunityProfilePopup.qml | 42 +++---------- .../MembershipRequestsPopup.qml | 4 +- .../TransferOwnershipPopup.qml | 62 +++++++++++++++++++ ui/app/img/transfer.svg | 4 ++ ui/nim-status-client.pro | 1 + ui/shared/ModalPopup.qml | 4 +- 7 files changed, 87 insertions(+), 42 deletions(-) create mode 100644 ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml create mode 100644 ui/app/img/transfer.svg diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityMembersPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityMembersPopup.qml index 08e7d40673..10fbee78f5 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityMembersPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityMembersPopup.qml @@ -67,8 +67,8 @@ ModalPopup { anchors.right: parent.right anchors.top: inviteBtn.bottom anchors.topMargin: Style.current.smallPadding - anchors.leftMargin: -Style.current.xlPadding - anchors.rightMargin: -Style.current.xlPadding + anchors.leftMargin: -Style.current.padding + anchors.rightMargin: -Style.current.padding } MembershipRequestsButton { @@ -77,8 +77,8 @@ ModalPopup { anchors.topMargin: visible ? Style.current.smallPadding : 0 anchors.left: parent.left anchors.right: parent.right - anchors.leftMargin: -Style.current.xlPadding - anchors.rightMargin: -Style.current.xlPadding + anchors.leftMargin: -Style.current.padding + anchors.rightMargin: -Style.current.padding } Separator { @@ -88,8 +88,8 @@ ModalPopup { anchors.right: parent.right anchors.top: membershipRequestsBtn.bottom anchors.topMargin: Style.current.smallPadding - anchors.leftMargin: -Style.current.xlPadding - anchors.rightMargin: -Style.current.xlPadding + anchors.leftMargin: -Style.current.padding + anchors.rightMargin: -Style.current.padding } diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml index 5d3bb3b6ad..5d5b62edf4 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml @@ -246,6 +246,7 @@ ModalPopup { label: qsTrId("edit-community") iconName: "edit" onClicked: openPopup(editCommunityPopup) + Component { id: editCommunityPopup CreateCommunityPopup { @@ -256,42 +257,19 @@ ModalPopup { } Loader { - property string exportResult: "" - active: isAdmin width: parent.width - sourceComponent: !exportResult ? exportBtn : resultComponent - - Component { - id: exportBtn - CommunityPopupButton { - //% "Export community" - label: qsTrId("export-community") - iconName: "../fetch" - onClicked: exportResult = chatsModel.communities.exportComumnity() + sourceComponent: CommunityPopupButton { + label: qsTr("Transfer ownership") + iconName: "../transfer" + onClicked: { + const exportResult = chatsModel.communities.exportComumnity() + openPopup(transferOwnershipPopup, {privateKey: exportResult}) } - } - Component { - id: resultComponent - StyledText { - property bool isError: !exportResult.startsWith("0x") - - text: exportResult - color: isError ? Style.current.danger : Style.current.textColor - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: Style.current.smallPadding + copyToClipboardBtn.width - wrapMode: TextEdit.WrapAnywhere - - CopyToClipBoardButton { - id: copyToClipboardBtn - visible: !isError - textToCopy: exportResult - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.right - anchors.leftMargin: Style.current.smallPadding - } + Component { + id: transferOwnershipPopup + TransferOwnershipPopup {} } } } diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/MembershipRequestsPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/MembershipRequestsPopup.qml index eb4e2ac728..1948fb16a4 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/MembershipRequestsPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/MembershipRequestsPopup.qml @@ -69,8 +69,8 @@ ModalPopup { anchors.topMargin: Style.current.smallPadding anchors.left: parent.left anchors.right: parent.right - anchors.rightMargin: -Style.current.xlPadding - anchors.leftMargin: -Style.current.xlPadding + anchors.rightMargin: -Style.current.padding + anchors.leftMargin: -Style.current.padding height: parent.height delegate: Item { diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml new file mode 100644 index 0000000000..f329c4d804 --- /dev/null +++ b/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml @@ -0,0 +1,62 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.13 +import QtQuick.Dialogs 1.3 +import "../../../../imports" +import "../../../../shared" +import "../../../../shared/status" + +ModalPopup { + property string privateKey + + id: popup + height: 504 + + title: qsTr("Transfer ownership") + + Item { + anchors.fill: parent + + Input { + id: pKeyInput + label: qsTr("Community private key") + text: popup.privateKey + copyToClipboard: popup.privateKey + } + + StyledText { + id: infoText1 + text: qsTr("You should keep it safe and only share it with people you trust to take ownership of your community") + anchors.top: pKeyInput.bottom + wrapMode: Text.WordWrap + anchors.topMargin: Style.current.padding + width: parent.width + font.pixelSize: 13 + color: Style.current.secondaryText + } + + StyledText { + id: infoText2 + text: qsTr("You can also use this key to import your community on another device") + anchors.top: infoText1.bottom + wrapMode: Text.WordWrap + anchors.topMargin: Style.current.bigPadding + width: parent.width + font.pixelSize: 13 + color: Style.current.secondaryText + } + } + + footer: StatusRoundButton { + id: btnBack + anchors.left: parent.left + icon.name: "arrow-right" + icon.width: 20 + icon.height: 16 + rotation: 180 + onClicked: { + popup.close() + } + } +} + diff --git a/ui/app/img/transfer.svg b/ui/app/img/transfer.svg new file mode 100644 index 0000000000..9469f57474 --- /dev/null +++ b/ui/app/img/transfer.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 8f6b843720..3582dcac9a 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -141,6 +141,7 @@ DISTFILES += \ app/AppLayouts/Chat/CommunityComponents/MembershipRequestsButton.qml \ app/AppLayouts/Chat/CommunityComponents/MembershipRequestsPopup.qml \ app/AppLayouts/Chat/CommunityComponents/MembershipRequirementPopup.qml \ + app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml \ app/AppLayouts/Chat/ContactsColumn/AddChat.qml \ app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml \ app/AppLayouts/Chat/components/ChooseBrowserPopup.qml \ diff --git a/ui/shared/ModalPopup.qml b/ui/shared/ModalPopup.qml index 971ba4965b..d001d47cc1 100644 --- a/ui/shared/ModalPopup.qml +++ b/ui/shared/ModalPopup.qml @@ -119,9 +119,9 @@ Popup { anchors.bottom: separator2.top anchors.bottomMargin: Style.current.padding anchors.left: parent.left - anchors.leftMargin: Style.current.xlPadding + anchors.leftMargin: Style.current.padding anchors.right: parent.right - anchors.rightMargin: Style.current.xlPadding + anchors.rightMargin: Style.current.padding } Separator {