feat: add new import community popup

This commit is contained in:
Jonathan Rainville 2021-02-12 13:19:31 -05:00 committed by Iuri Matias
parent a47847b40f
commit 534cb23e18
6 changed files with 112 additions and 58 deletions

View File

@ -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 dont share the key with people you dont 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
}
}
}

View File

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

View File

@ -14,6 +14,10 @@ ModalPopup {
title: qsTr("Transfer ownership")
onClosed: {
popup.destroy();
}
Item {
anchors.fill: parent

View File

@ -73,7 +73,7 @@ Item {
Component {
id: importCommunitiesPopupComponent
ImportCommunityPopup {
AccessExistingCommunityPopup {
onClosed: {
destroy()
}

4
ui/app/img/import.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.6667 8.83331C10.6667 8.55717 10.8922 8.33768 11.1646 8.29218C12.5845 8.05501 13.6667 6.82054 13.6667 5.33331C13.6667 3.67646 12.3235 2.33331 10.6667 2.33331L5.33333 2.33331C3.67648 2.33331 2.33333 3.67646 2.33333 5.33331C2.33333 6.82054 3.41554 8.05501 4.83543 8.29218C5.1078 8.33768 5.33333 8.55717 5.33333 8.83331C5.33333 9.10946 5.10836 9.33659 4.83433 9.30249C2.86069 9.05688 1.33333 7.37347 1.33333 5.33331C1.33333 3.12418 3.12419 1.33331 5.33333 1.33331L10.6667 1.33331C12.8758 1.33331 14.6667 3.12417 14.6667 5.33331C14.6667 7.37347 13.1393 9.05688 11.1657 9.30249C10.8916 9.33659 10.6667 9.10946 10.6667 8.83331Z" fill="#4360DF"/>
<path d="M8 4.83331C8.27614 4.83331 8.5 5.05717 8.5 5.33331V11.9881C8.5 12.2851 8.85905 12.4338 9.06904 12.2238L10.3131 10.9798C10.5084 10.7845 10.825 10.7845 11.0202 10.9798C11.2155 11.175 11.2155 11.4916 11.0202 11.6869L8.35355 14.3535C8.15829 14.5488 7.84171 14.5488 7.64645 14.3535L4.97978 11.6869C4.78452 11.4916 4.78452 11.175 4.97978 10.9798C5.17504 10.7845 5.49163 10.7845 5.68689 10.9798L6.93096 12.2238C7.14095 12.4338 7.5 12.2851 7.5 11.9881V5.33331C7.5 5.05717 7.72386 4.83331 8 4.83331Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

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