feat: add very basic sendModal content

This commit is contained in:
Jonathan Rainville 2020-05-29 11:43:37 -04:00 committed by Iuri Matias
parent 24505c9b0f
commit 77966c8f6c
8 changed files with 179 additions and 62 deletions

View File

@ -6,20 +6,20 @@ import "../../../../shared"
import "./" import "./"
Item { Item {
function open(){ function open() {
popup.open() popup.open()
chatKey.text = ""; chatKey.text = "";
chatKey.forceActiveFocus(Qt.MouseFocusReason) chatKey.forceActiveFocus(Qt.MouseFocusReason)
} }
function close(){ function close() {
popup.close() popup.close()
} }
Popup { Popup {
id: popup id: popup
modal: true modal: true
closePolicy: Popup.NoAutoClose closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Overlay.modal: Rectangle { Overlay.modal: Rectangle {
color: "#60000000" color: "#60000000"
} }

View File

@ -19,7 +19,7 @@ Item {
Popup { Popup {
id: popup id: popup
modal: true modal: true
closePolicy: Popup.NoAutoClose closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
Overlay.modal: Rectangle { Overlay.modal: Rectangle {
color: "#60000000" color: "#60000000"
} }

View File

@ -0,0 +1,129 @@
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1
import "../../../../imports"
import "../../../../shared"
Item {
property alias txtValue: txtValue
Text {
id: modalDialogTitle
text: "Send"
anchors.top: parent.top
anchors.left: parent.left
font.bold: true
font.pixelSize: 17
anchors.leftMargin: 16
anchors.topMargin: 16
}
Image {
id: closeModalImg
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 16
anchors.topMargin: 16
source: "../../img/close.svg"
MouseArea {
id: closeModalMouseArea
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
popup.close()
}
}
}
Separator {
id: headerSeparator
anchors.top: modalDialogTitle.bottom
}
Item {
id: modalBody
anchors.right: parent.right
anchors.rightMargin: 32
anchors.top: headerSeparator.bottom
anchors.topMargin: Theme.padding
anchors.bottom: footerSeparator.top
anchors.bottomMargin: 16
anchors.left: parent.left
anchors.leftMargin: 32
TextField {
id: txtValue
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")
}
TextField {
id: txtFrom
text: assetsModel.getDefaultAccount()
placeholderText: qsTr("Send from (account)")
anchors.top: txtValue.bottom
anchors.topMargin: Theme.padding
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
}
TextField {
id: txtTo
text: assetsModel.getDefaultAccount()
placeholderText: qsTr("Send to")
anchors.top: txtFrom.bottom
anchors.topMargin: Theme.padding
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
}
TextField {
id: txtPassword
text: "qwerty"
placeholderText: "Enter Password"
anchors.top: txtTo.bottom
anchors.topMargin: Theme.padding
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
}
}
Separator {
id: footerSeparator
anchors.bottom: parent.bottom
anchors.bottomMargin: 76
}
Button {
text: "Send"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 16
onClicked: {
let result = assetsModel.onSendTransaction(txtFrom.text,
txtTo.text,
txtValue.text,
txtPassword.text)
console.log(result)
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -0,0 +1 @@
SendModalContent 1.0 SendModalContent.qml

View File

@ -4,67 +4,38 @@ import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import "../../../imports" import "../../../imports"
import "../../../shared" import "../../../shared"
import "./Components"
Item { Item {
TextField { function open() {
id: txtValue popup.open()
x: 19 sendModalContent.txtValue.text = ""
y: 41 sendModalContent.txtValue.forceActiveFocus(Qt.MouseFocusReason)
placeholderText: qsTr("Enter ETH")
anchors.leftMargin: 24
anchors.topMargin: 32
width: 239
height: 40
} }
TextField { function close() {
id: txtFrom popup.close()
x: 340
y: 41
width: 239
height: 40
text: assetsModel.getDefaultAccount()
placeholderText: qsTr("Send from (account)")
anchors.topMargin: 32
anchors.leftMargin: 24
} }
TextField { Popup {
id: txtTo id: popup
x: 340 modal: true
y: 99 closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
width: 239 Overlay.modal: Rectangle {
height: 40 color: "#60000000"
text: assetsModel.getDefaultAccount() }
placeholderText: qsTr("Send to") parent: Overlay.overlay
anchors.topMargin: 32 x: Math.round((parent.width - width) / 2)
anchors.leftMargin: 24 y: Math.round((parent.height - height) / 2)
} width: 480
height: 510
TextField { background: Rectangle {
id: txtPassword color: Theme.white
x: 19 radius: Theme.radius
y: 99 }
width: 239 padding: 0
height: 40 contentItem: SendModalContent {
text: "qwerty" id: sendModalContent
placeholderText: "Enter Password"
anchors.topMargin: 32
anchors.leftMargin: 24
}
Button {
x: 19
y: 159
text: "Send"
onClicked: {
let result = assetsModel.onSendTransaction(
txtFrom.text,
txtTo.text,
txtValue.text,
txtPassword.text
);
console.log(result);
} }
} }
} }
@ -74,3 +45,4 @@ Designer {
D{i:0;autoSize:true;height:480;width:640} D{i:0;autoSize:true;height:480;width:640}
} }
##^##*/ ##^##*/

View File

@ -63,11 +63,14 @@ Item {
color: Theme.darkGrey color: Theme.darkGrey
} }
SendModal{
id: sendModal
}
Item { Item {
property int btnMargin: 8 property int btnMargin: 8
property int btnOuterMargin: 32 property int btnOuterMargin: 32
id: walletMenu id: walletMenu
// TODO unhardcode this
width: sendBtn.width + receiveBtn.width + settingsBtn.width width: sendBtn.width + receiveBtn.width + settingsBtn.width
+ walletMenu.btnOuterMargin * 2 + walletMenu.btnOuterMargin * 2
anchors.top: parent.top anchors.top: parent.top
@ -78,6 +81,7 @@ Item {
Item { Item {
id: sendBtn id: sendBtn
width: sendImg.width + sendText.width + walletMenu.btnMargin width: sendImg.width + sendText.width + walletMenu.btnMargin
height: sendText.height
Image { Image {
id: sendImg id: sendImg
@ -95,6 +99,15 @@ Item {
font.pixelSize: 13 font.pixelSize: 13
color: Theme.blue color: Theme.blue
} }
MouseArea {
anchors.rightMargin: -Theme.smallPadding
anchors.leftMargin: -Theme.smallPadding
anchors.bottomMargin: -Theme.smallPadding
anchors.topMargin: -Theme.smallPadding
anchors.fill: parent
onClicked: sendModal.open()
cursorShape: Qt.PointingHandCursor
}
} }
Item { Item {
id: receiveBtn id: receiveBtn

View File

@ -79,6 +79,8 @@ DISTFILES += \
app/AppLayouts/Profile/ProfileLayout.qml \ app/AppLayouts/Profile/ProfileLayout.qml \
app/AppLayouts/Wallet/AssetsTab.qml \ app/AppLayouts/Wallet/AssetsTab.qml \
app/AppLayouts/Wallet/CollectiblesTab.qml \ app/AppLayouts/Wallet/CollectiblesTab.qml \
app/AppLayouts/Wallet/Components/SendModalContent.qml \
app/AppLayouts/Wallet/Components/qmldir \
app/AppLayouts/Wallet/HistoryTab.qml \ app/AppLayouts/Wallet/HistoryTab.qml \
app/AppLayouts/Profile/Sections/AboutContainer.qml \ app/AppLayouts/Profile/Sections/AboutContainer.qml \
app/AppLayouts/Profile/Sections/AdvancedContainer.qml \ app/AppLayouts/Profile/Sections/AdvancedContainer.qml \

View File

@ -6,5 +6,5 @@ Rectangle {
width: parent.width width: parent.width
height: 1 height: 1
color: Theme.grey color: Theme.grey
anchors.topMargin: 16 anchors.topMargin: Theme.padding
} }