summaryrefslogtreecommitdiff
path: root/main.qml
blob: 6eb101c83071c12439ecb2694a2608f3beeb9e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import "larva/features"

ApplicationWindow {
	signal signUp(string brand)
	function push(view, arg) {
		busy.visible = false
		busy.running = false
		stack.push(view + ".qml", {
			"arg": arg
		})
		pushed()
	}
	signal pushed()
	id: window
	width: 360
	height: 640
	visible: true
	StackView {
		id: stack
		anchors.fill: parent
		initialItem : Column {
			EmailForm {
				anchors.bottom: parent.bottom
				width: parent.width
				backButton.visible: false
				instructionLabel {
					text: qsTr("Darapsa Shop Maker")
					font.pointSize: 18
				}
				emailTextField {
					placeholderText: "shopname"
					validator: RegularExpressionValidator {
						regularExpression: /[a-zA-Z0-9]+/
					}
					onTextChanged: if (!emailTextField.text || !loginButton.enabled)
						loginButton.enabled = !loginButton.enabled
				}
				loginButton {
					text: qsTr("Make shop")
					onClicked: {
						this.enabled = false
						busy.running = true
						busy.visible = true
						signUp(emailTextField.text)
					}
				}
			}
		}
	}

	BusyIndicator {
		id: busy
		anchors.centerIn: parent
		visible: false
		running: false
	}
}