diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/ImportCommunityPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml similarity index 51% rename from ui/app/AppLayouts/Chat/CommunityComponents/ImportCommunityPopup.qml rename to ui/app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml index a0a9b8cde0..e8db4b8914 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/ImportCommunityPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml @@ -7,43 +7,41 @@ import "../../../../shared" import "../../../../shared/status" ModalPopup { - property string keyValidationError: "" - id: popup - height: 300 + width: 400 + height: 400 - onOpened: { - keyInput.forceActiveFocus(Qt.MouseFocusReason) + title: qsTr("Access existing community") + + onClosed: { + popup.destroy(); } - function validate() { - keyValidationError = "" + Item { + anchors.fill: parent - if (keyInput.text === "") { - //% "You need to enter a key" - keyValidationError = qsTrId("you-need-to-enter-a-key") + StyledTextArea { + id: pKeyTextArea + label: qsTr("Community private key") + placeholderText: "0x0..." + customHeight: 110 } - return !keyValidationError - } - - //% "Import a community" - title: qsTrId("import-community") - - - Input { - id: keyInput - //% "Community key" - label: qsTrId("community-key") - //% "0x..." - placeholderText: qsTrId("0x---") - validationError: popup.keyValidationError - pasteFromClipboard: true + StyledText { + id: infoText1 + text: qsTr("Entering a community key will grant you the ownership of that community. Please be responsible with it and don’t share the key with people you don’t trust.") + anchors.top: pKeyTextArea.bottom + wrapMode: Text.WordWrap + anchors.topMargin: Style.current.bigPadding + width: parent.width + font.pixelSize: 13 + color: Style.current.secondaryText + } } footer: StatusButton { - //% "Import" - text: qsTrId("import") + id: btnBack + text: qsTr("Import") anchors.right: parent.right onClicked: { if (!validate()) { @@ -67,11 +65,9 @@ ModalPopup { MessageDialog { id: creatingError - //% "Error importing the community" - title: qsTrId("error-importing-the-community") + title: qsTr("Error importing the community") icon: StandardIcon.Critical standardButtons: StandardButton.Ok } } } - diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml index c7de60a148..375d5e3b30 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml @@ -15,8 +15,75 @@ ModalPopup { searchBox.forceActiveFocus(Qt.MouseFocusReason) } - //% "Communities" - title: qsTrId("communities") + header: Item { + height: childrenRect.height + width: parent.width + + StyledText { + id: groupName + text: qsTr("Communities") + anchors.top: parent.top + anchors.left: parent.left + font.bold: true + font.pixelSize: 17 + } + + Rectangle { + id: moreActionsBtnContainer + width: 32 + height: 32 + radius: Style.current.radius + color: Style.current.transparent + anchors.right: parent.right + anchors.rightMargin: 40 + anchors.top: parent.top + anchors.topMargin: -5 + + StyledText { + id: moreActionsBtn + text: "..." + font.letterSpacing: 0.5 + font.bold: true + lineHeight: 1.4 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 25 + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + parent.color = Style.current.border + } + onExited: { + parent.color = Style.current.transparent + } + onClicked: contextMenu.popup(-contextMenu.width + moreActionsBtn.width, moreActionsBtn.height - Style.current.smallPadding) + } + + PopupMenu { + id: contextMenu + Action { + icon.source: "../../../img/import.svg" + icon.width: 16 + icon.height: 16 + text: qsTr("Access exisitng community") + onTriggered: openPopup(importCommunitiesPopupComponent) + } + } + } + + Separator { + anchors.top: groupName.bottom + anchors.topMargin: Style.current.padding + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: -Style.current.padding + anchors.leftMargin: -Style.current.padding + } + } SearchBox { id: searchBox @@ -138,31 +205,13 @@ ModalPopup { } } - footer: Item { - width: parent.width - height: importBtn.height - - StatusButton { - id: importBtn - //% "Import a community" - text: qsTrId("import-community") - anchors.right: createBtn.left - anchors.rightMargin: Style.current.smallPadding - onClicked: { - openPopup(importCommunitiesPopupComponent) - popup.close() - } - } - - StatusButton { - id: createBtn - //% "Create a community" - text: qsTrId("create-community") - anchors.right: parent.right - onClicked: { - openPopup(createCommunitiesPopupComponent) - popup.close() - } + footer: StatusButton { + id: createBtn + text: qsTr("Create a community") + anchors.right: parent.right + onClicked: { + openPopup(createCommunitiesPopupComponent) + popup.close() } } } diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml index f329c4d804..aae0ca4ce9 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/TransferOwnershipPopup.qml @@ -14,6 +14,10 @@ ModalPopup { title: qsTr("Transfer ownership") + onClosed: { + popup.destroy(); + } + Item { anchors.fill: parent diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index 371b302bf8..61f0f003cf 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -73,7 +73,7 @@ Item { Component { id: importCommunitiesPopupComponent - ImportCommunityPopup { + AccessExistingCommunityPopup { onClosed: { destroy() } diff --git a/ui/app/img/import.svg b/ui/app/img/import.svg new file mode 100644 index 0000000000..2bc196d548 --- /dev/null +++ b/ui/app/img/import.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 3582dcac9a..8ab535a387 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -126,6 +126,7 @@ DISTFILES += \ app/AppLayouts/Chat/ChatColumn/MessageComponents/UsernameLabel.qml \ app/AppLayouts/Chat/ChatColumn/MessageComponents/qmldir \ app/AppLayouts/Chat/CommunityColumn.qml \ + app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml \ app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml \ app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml \ app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml \