2022-08-30 16:27:00 +00:00
|
|
|
import QtQuick 2.14
|
2022-08-31 12:35:28 +00:00
|
|
|
import QtQuick.Layouts 1.14
|
2022-08-30 16:27:00 +00:00
|
|
|
|
2022-08-31 12:35:28 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
2022-08-30 16:27:00 +00:00
|
|
|
|
2022-08-31 12:35:28 +00:00
|
|
|
|
2023-01-17 23:03:08 +00:00
|
|
|
ColumnLayout {
|
2022-08-31 12:35:28 +00:00
|
|
|
property alias domainName: domainNameInput.text
|
|
|
|
property alias domainNameValid: domainNameInput.valid
|
|
|
|
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: domainNameInput
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2023-01-17 23:03:08 +00:00
|
|
|
Layout.topMargin: 23
|
2022-08-31 12:35:28 +00:00
|
|
|
|
|
|
|
minimumHeight: 36
|
|
|
|
maximumHeight: 36
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
font.pixelSize: 13
|
|
|
|
input.placeholderText: "name.eth"
|
|
|
|
|
|
|
|
validators: StatusRegularExpressionValidator {
|
|
|
|
// TODO: check ens domain validator
|
2023-01-17 23:03:08 +00:00
|
|
|
regularExpression: /^(\*\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?$/i
|
2022-08-31 12:35:28 +00:00
|
|
|
errorMessage: qsTr("Subdomain not recognized")
|
2023-01-17 23:03:08 +00:00
|
|
|
|
|
|
|
validate: function (value) {
|
|
|
|
return value === "*.eth" || regularExpression.test(value)
|
|
|
|
}
|
2022-08-31 12:35:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
if (text) {
|
|
|
|
input.dirty = true
|
|
|
|
validate()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-17 23:03:08 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: 17
|
|
|
|
|
|
|
|
text: qsTr("Put *. before ENS name to include all subdomains in permission")
|
|
|
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: 13
|
|
|
|
lineHeight: 18
|
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
}
|
2022-08-30 16:27:00 +00:00
|
|
|
}
|