qml: check max comment length for lnurl-pay, characters remaining indicator, styling.
This commit is contained in:
@@ -23,55 +23,76 @@ ElDialog {
|
|||||||
color: "#aa000000"
|
color: "#aa000000"
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
padding: 0
|
||||||
columns: 2
|
|
||||||
|
|
||||||
|
property bool valid: comment.text.length <= invoiceParser.lnurlData['comment_allowed']
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
columns: 2
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr('Provider')
|
|
||||||
color: Material.accentColor
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: invoiceParser.lnurlData['domain']
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: qsTr('Description')
|
|
||||||
color: Material.accentColor
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: invoiceParser.lnurlData['metadata_plaintext']
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.Wrap
|
Layout.leftMargin: constants.paddingLarge
|
||||||
}
|
Layout.rightMargin: constants.paddingLarge
|
||||||
Label {
|
|
||||||
text: invoiceParser.lnurlData['min_sendable_sat'] == invoiceParser.lnurlData['max_sendable_sat']
|
Label {
|
||||||
? qsTr('Amount')
|
text: qsTr('Provider')
|
||||||
: qsTr('Amount range')
|
color: Material.accentColor
|
||||||
color: Material.accentColor
|
}
|
||||||
}
|
Label {
|
||||||
Label {
|
text: invoiceParser.lnurlData['domain']
|
||||||
text: invoiceParser.lnurlData['min_sendable_sat'] == invoiceParser.lnurlData['max_sendable_sat']
|
}
|
||||||
? invoiceParser.lnurlData['min_sendable_sat'] == 0
|
Label {
|
||||||
? qsTr('Unspecified')
|
text: qsTr('Description')
|
||||||
: invoiceParser.lnurlData['min_sendable_sat']
|
color: Material.accentColor
|
||||||
: invoiceParser.lnurlData['min_sendable_sat'] + ' < amount < ' + invoiceParser.lnurlData['max_sendable_sat']
|
}
|
||||||
|
Label {
|
||||||
|
text: invoiceParser.lnurlData['metadata_plaintext']
|
||||||
|
Layout.fillWidth: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: invoiceParser.lnurlData['min_sendable_sat'] == invoiceParser.lnurlData['max_sendable_sat']
|
||||||
|
? qsTr('Amount')
|
||||||
|
: qsTr('Amount range')
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: invoiceParser.lnurlData['min_sendable_sat'] == invoiceParser.lnurlData['max_sendable_sat']
|
||||||
|
? invoiceParser.lnurlData['min_sendable_sat'] == 0
|
||||||
|
? qsTr('Unspecified')
|
||||||
|
: invoiceParser.lnurlData['min_sendable_sat']
|
||||||
|
: invoiceParser.lnurlData['min_sendable_sat'] + ' < amount < ' + invoiceParser.lnurlData['max_sendable_sat']
|
||||||
|
}
|
||||||
|
|
||||||
|
TextArea {
|
||||||
|
id: comment
|
||||||
|
visible: invoiceParser.lnurlData['comment_allowed'] > 0
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
Layout.minimumHeight: 80
|
||||||
|
wrapMode: TextEdit.Wrap
|
||||||
|
placeholderText: qsTr('Enter an (optional) message for the receiver')
|
||||||
|
color: text.length > invoiceParser.lnurlData['comment_allowed'] ? constants.colorError : Material.foreground
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
visible: invoiceParser.lnurlData['comment_allowed'] > 0
|
||||||
|
text: qsTr('%1 characters remaining').arg(Math.max(0, (invoiceParser.lnurlData['comment_allowed'] - comment.text.length) ))
|
||||||
|
color: constants.mutedForeground
|
||||||
|
font.pixelSize: constants.fontSizeSmall
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextArea {
|
FlatButton {
|
||||||
id: comment
|
Layout.topMargin: constants.paddingLarge
|
||||||
visible: invoiceParser.lnurlData['comment_allowed'] > 0
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.preferredWidth: parent.width
|
|
||||||
Layout.minimumHeight: 80
|
|
||||||
wrapMode: TextEdit.Wrap
|
|
||||||
placeholderText: qsTr('Enter an (optional) message for the receiver')
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: qsTr('Proceed')
|
text: qsTr('Proceed')
|
||||||
|
icon.source: '../../icons/confirmed.png'
|
||||||
|
enabled: valid
|
||||||
onClicked: {
|
onClicked: {
|
||||||
invoiceParser.lnurlGetInvoice(invoiceParser.lnurlData['min_sendable_sat'], comment.text)
|
invoiceParser.lnurlGetInvoice(invoiceParser.lnurlData['min_sendable_sat'], comment.text)
|
||||||
dialog.close()
|
dialog.close()
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ ElDialog {
|
|||||||
|
|
||||||
function dispatch(data) {
|
function dispatch(data) {
|
||||||
if (bitcoin.isRawTx(data)) {
|
if (bitcoin.isRawTx(data)) {
|
||||||
// app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { rawtx: text })
|
|
||||||
txFound(data)
|
txFound(data)
|
||||||
} else {
|
} else {
|
||||||
invoiceParser.recipient = data
|
invoiceParser.recipient = data
|
||||||
|
|||||||
Reference in New Issue
Block a user