From bf5f0b6dda758e16743a19aa887d53d28c0a624f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 4 Jun 2020 10:53:10 -0400 Subject: [PATCH] feat: add basic generate account popup --- .../Chat/components/PrivateChatPopup.qml | 3 - .../Chat/components/PublicChatPopup.qml | 5 +- .../Wallet/Components/AddAccount.qml | 8 ++- .../Components/GenerateAccountModal.qml | 57 +++++++++++++++++++ .../Wallet/Components/SendModalContent.qml | 5 -- ui/app/AppLayouts/Wallet/Components/qmldir | 1 + ui/nim-status-client.pro | 1 + ui/onboarding/Login.qml | 5 +- ui/shared/Input.qml | 6 +- ui/shared/ModalPopup.qml | 9 ++- ui/shared/PopupMenu.qml | 10 +++- 11 files changed, 84 insertions(+), 26 deletions(-) create mode 100644 ui/app/AppLayouts/Wallet/Components/GenerateAccountModal.qml diff --git a/ui/app/AppLayouts/Chat/components/PrivateChatPopup.qml b/ui/app/AppLayouts/Chat/components/PrivateChatPopup.qml index 44b59694bb..b04b26e4d0 100644 --- a/ui/app/AppLayouts/Chat/components/PrivateChatPopup.qml +++ b/ui/app/AppLayouts/Chat/components/PrivateChatPopup.qml @@ -19,12 +19,9 @@ ModalPopup { height: 44 color: Theme.grey anchors.top: parent.top - anchors.topMargin: 16 radius: 8 anchors.right: parent.right - anchors.rightMargin: 16 anchors.left: parent.left - anchors.leftMargin: 16 TextField { id: chatKey diff --git a/ui/app/AppLayouts/Chat/components/PublicChatPopup.qml b/ui/app/AppLayouts/Chat/components/PublicChatPopup.qml index 8e70833d57..60da181c4b 100644 --- a/ui/app/AppLayouts/Chat/components/PublicChatPopup.qml +++ b/ui/app/AppLayouts/Chat/components/PublicChatPopup.qml @@ -20,10 +20,9 @@ ModalPopup { Layout.fillHeight: false Layout.fillWidth: true width: parent.width - padding: 20 Text { - width: parent.width - 20 + width: parent.width font.pixelSize: 15 text: qsTr("A public chat is where you get to hang out with others, make friends and talk about subjects of your interest.") wrapMode: Text.WordWrap @@ -38,9 +37,7 @@ ModalPopup { anchors.top: description.bottom radius: 8 anchors.right: parent.right - anchors.rightMargin: 16 anchors.left: parent.left - anchors.leftMargin: 16 TextField { id: channelName diff --git a/ui/app/AppLayouts/Wallet/Components/AddAccount.qml b/ui/app/AppLayouts/Wallet/Components/AddAccount.qml index 0eaa686ce6..8a42d1d29d 100644 --- a/ui/app/AppLayouts/Wallet/Components/AddAccount.qml +++ b/ui/app/AppLayouts/Wallet/Components/AddAccount.qml @@ -77,6 +77,10 @@ Rectangle { newAccountMenu.popup(x, addAccountLbl.height + 10) } + GenerateAccountModal { + id: generateAccountModal + } + PopupMenu { id: newAccountMenu width: 280 @@ -84,7 +88,7 @@ Rectangle { text: qsTr("Generate an account") icon.source: "../../../img/generate_account.svg" onTriggered: { - console.log("TODO: Generate an account") + generateAccountModal.open() } } QQC2.Action { @@ -117,6 +121,6 @@ Rectangle { /*##^## Designer { - D{i:0;formeditorZoom:3} + D{i:0;height:36;width:36} } ##^##*/ diff --git a/ui/app/AppLayouts/Wallet/Components/GenerateAccountModal.qml b/ui/app/AppLayouts/Wallet/Components/GenerateAccountModal.qml new file mode 100644 index 0000000000..cbf17f2bbd --- /dev/null +++ b/ui/app/AppLayouts/Wallet/Components/GenerateAccountModal.qml @@ -0,0 +1,57 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 +import "../../../../imports" +import "../../../../shared" + +ModalPopup { + id: popup + title: qsTr("Generate an account") + + property int marginBetweenInputs: 38 + + onOpened: { + passwordInput.text = ""; + passwordInput.forceActiveFocus(Qt.MouseFocusReason) + } + + Input { + id: passwordInput + placeholderText: qsTr("Enter your password…") + label: qsTr("Password") + textField.echoMode: TextInput.Password + } + + Input { + id: accountNameInput + anchors.top: passwordInput.bottom + anchors.topMargin: marginBetweenInputs + placeholderText: qsTr("Enter an account name...") + label: qsTr("Account name") + } + + Input { + id: accountColorInput + anchors.top: accountNameInput.bottom + anchors.topMargin: marginBetweenInputs + label: qsTr("Account color") + } + + footer: StyledButton { + label: "Add account >" + + disabled: passwordInput.text === "" && accountNameInput === "" + + onClicked : { + if(chatKey.text === "") return; + chatsModel.joinChat(chatKey.text, Constants.chatTypeOneToOne); + popup.close(); + } + } +} + +/*##^## +Designer { + D{i:0;formeditorColor:"#ffffff";height:500;width:400} +} +##^##*/ diff --git a/ui/app/AppLayouts/Wallet/Components/SendModalContent.qml b/ui/app/AppLayouts/Wallet/Components/SendModalContent.qml index 22f57e6e44..e8eea9918a 100644 --- a/ui/app/AppLayouts/Wallet/Components/SendModalContent.qml +++ b/ui/app/AppLayouts/Wallet/Components/SendModalContent.qml @@ -59,11 +59,6 @@ Item { label: "Amount" icon: "../../../img/token-icons/eth.svg" anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 placeholderText: qsTr("Enter ETH") } diff --git a/ui/app/AppLayouts/Wallet/Components/qmldir b/ui/app/AppLayouts/Wallet/Components/qmldir index 094f99577b..192fefb667 100644 --- a/ui/app/AppLayouts/Wallet/Components/qmldir +++ b/ui/app/AppLayouts/Wallet/Components/qmldir @@ -2,3 +2,4 @@ SendModalContent 1.0 SendModalContent.qml SetCurrencyModalContent 1.0 SetCurrencyModalContent.qml TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml AddAccount 1.0 AddAccount.qml +GenerateAccountModal 1.0 GenerateAccountModal.qml diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index f649480ffb..f7213bcb4d 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -80,6 +80,7 @@ DISTFILES += \ app/AppLayouts/Wallet/AssetsTab.qml \ app/AppLayouts/Wallet/CollectiblesTab.qml \ app/AppLayouts/Wallet/Components/AddAccount.qml \ + app/AppLayouts/Wallet/Components/GenerateAccountModal.qml \ app/AppLayouts/Wallet/Components/SendModalContent.qml \ app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml \ app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml \ diff --git a/ui/onboarding/Login.qml b/ui/onboarding/Login.qml index b2909d5cea..36aa120d1b 100644 --- a/ui/onboarding/Login.qml +++ b/ui/onboarding/Login.qml @@ -66,10 +66,7 @@ SwipeView { anchors.left: parent.left anchors.right: parent.right placeholderText: "Enter password" - - Component.onCompleted: { - this.textField.echoMode = TextInput.Password - } + textField.echoMode: TextInput.Password Keys.onReturnPressed: { submitBtn.clicked() } diff --git a/ui/shared/Input.qml b/ui/shared/Input.qml index 5840c39912..128efc9a05 100644 --- a/ui/shared/Input.qml +++ b/ui/shared/Input.qml @@ -6,7 +6,7 @@ import "../imports" Item { property alias textField: inputValue property string placeholderText: "My placeholder" - property string text: "" + property alias text: inputValue.text property string label: "" // property string label: "My Label" @@ -21,6 +21,8 @@ Item { id: inputBox height: inputRectangle.height + (hasLabel ? inputLabel.height + labelMargin : 0) + anchors.right: parent.right + anchors.left: parent.left Text { id: inputLabel @@ -42,9 +44,7 @@ Item { anchors.top: inputBox.hasLabel ? inputLabel.bottom : parent.top anchors.topMargin: inputBox.hasLabel ? inputBox.labelMargin : 0 anchors.right: parent.right - anchors.rightMargin: 0 anchors.left: parent.left - anchors.leftMargin: 0 TextField { id: inputValue diff --git a/ui/shared/ModalPopup.qml b/ui/shared/ModalPopup.qml index a9631d5780..3a12e4b2ee 100644 --- a/ui/shared/ModalPopup.qml +++ b/ui/shared/ModalPopup.qml @@ -80,10 +80,13 @@ Popup { Item { id: popupContent anchors.top: separator.bottom + anchors.topMargin: Theme.padding anchors.bottom: separator2.top - anchors.left: popup.left - anchors.right: popup.right - width: popup.width + anchors.bottomMargin: Theme.padding + anchors.left: parent.left + anchors.leftMargin: Theme.padding + anchors.right: parent.right + anchors.rightMargin: Theme.padding } Separator { diff --git a/ui/shared/PopupMenu.qml b/ui/shared/PopupMenu.qml index 31eaabdc4e..d44226b224 100644 --- a/ui/shared/PopupMenu.qml +++ b/ui/shared/PopupMenu.qml @@ -7,8 +7,8 @@ Menu { property alias arrowX: bgPopupMenuTopArrow.x closePolicy: Popup.CloseOnPressOutsideParent id: popupMenu - topPadding: 16 - bottomPadding: 16 + topPadding: Theme.padding + bottomPadding: Theme.padding delegate: MenuItem { id: popupMenuItem implicitWidth: 200 @@ -107,3 +107,9 @@ Menu { } } } + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/