status-desktop/ui/app/AppLayouts/Onboarding/popups/GenKeyModal.qml

89 lines
3.0 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import StatusQ.Controls 0.1
import utils 1.0
2021-10-28 10:01:10 +00:00
import shared 1.0
2022-03-02 00:14:20 +00:00
import shared.panels 1.0
2021-10-28 10:01:10 +00:00
import shared.popups 1.0
2022-03-02 00:14:20 +00:00
import shared.controls 1.0
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import "../panels"1
import "../stores"
// TODO: replace with StatusModal
2020-06-13 15:17:54 +00:00
ModalPopup {
property int selectedIndex: 0
2020-06-13 15:17:54 +00:00
property var onClosed: function () {}
property var onNextClick: function () {}
id: popup
//% "Choose a chat name"
title: qsTrId("intro-wizard-title2")
height: 504
2020-06-13 15:17:54 +00:00
2022-03-02 00:14:20 +00:00
property string displayNameValidationError: ""
Input {
id: displayNameInput
placeholderText: "DisplayName"
validationError: displayNameValidationError
onTextChanged: {
if(displayNameInput.text === ""){
displayNameValidationError = qsTr("Display name is required")
} else if (!displayNameInput.text.match(/^[a-zA-Z0-9\- ]+$/)){
displayNameValidationError = qsTr("Only letters, numbers, underscores and hyphens allowed")
} else if (displayNameInput.text.length > 24) {
displayNameValidationError = qsTr("24 character username limit")
} else if (displayNameInput.text.length < 5) {
displayNameValidationError = qsTr("Username must be at least 5 characters")
} else if (displayNameInput.text.endsWith(".eth")) {
displayNameValidationError = qsTr(`Usernames ending with ".eth" are not allowed`)
} else if (displayNameInput.text.endsWith("-eth")) {
displayNameValidationError = qsTr(`Usernames ending with "-eth" are not allowed`)
} else if (displayNameInput.text.endsWith("_eth")) {
displayNameValidationError = qsTr(`Usernames ending with "_eth" are not allowed`)
} else if (globalUtils.isAlias(displayNameInput.text)){
displayNameValidationError = qsTr("Sorry, the name you have chosen is not allowed, try picking another username")
}
}
}
AccountListPanel {
2020-06-13 15:17:54 +00:00
id: accountList
2022-03-02 00:14:20 +00:00
anchors.top: displayNameInput.bottom
anchors.topMargin: 100
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
2020-06-15 13:37:16 +00:00
interactive: false
2020-06-13 15:17:54 +00:00
model: OnboardingStore.onBoardingModul.accountsModel
isSelected: function (index) {
return index === selectedIndex
2020-06-13 15:17:54 +00:00
}
onAccountSelect: function(index) {
selectedIndex = index
2020-06-13 15:17:54 +00:00
}
}
2022-03-02 00:14:20 +00:00
footer: StatusRoundButton {
objectName: "submitButton"
2020-06-13 15:17:54 +00:00
id: submitBtn
2022-03-02 00:14:20 +00:00
enabled: displayNameInput.text !== ""
2020-06-13 15:17:54 +00:00
anchors.bottom: parent.bottom
anchors.topMargin: Style.current.padding
2020-06-13 15:17:54 +00:00
anchors.right: parent.right
icon.name: "arrow-right"
icon.width: 20
icon.height: 16
2020-06-13 15:17:54 +00:00
onClicked : {
2022-03-02 00:14:20 +00:00
onNextClick(selectedIndex, displayNameInput.text);
2020-06-13 15:17:54 +00:00
popup.close()
}
}
}