2022-08-10 08:27:45 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import "../controls"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property alias displayName: displayNameInput
|
|
|
|
property alias bio: bioInput
|
|
|
|
|
|
|
|
property var socialLinksModel
|
|
|
|
|
|
|
|
signal socialLinkChanged(string uuid, string text, string url)
|
|
|
|
signal addSocialLinksClicked
|
|
|
|
|
|
|
|
implicitHeight: layout.implicitHeight
|
|
|
|
implicitWidth: layout.implicitWidth
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
spacing: 19 // by design
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: displayNameInput
|
2022-08-12 15:51:33 +00:00
|
|
|
objectName: "displayNameInput"
|
2022-08-10 08:27:45 +00:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
label: qsTr("Display name")
|
|
|
|
placeholderText: qsTr("Display Name")
|
|
|
|
charLimit: 24
|
|
|
|
validators: Constants.validators.displayName
|
2022-08-16 17:22:19 +00:00
|
|
|
|
|
|
|
input.tabNavItem: bioInput.input.edit
|
2022-08-10 08:27:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: bioInput
|
2022-08-12 15:51:33 +00:00
|
|
|
objectName: "bioInput"
|
2022-08-10 08:27:45 +00:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: 5 // by design
|
|
|
|
|
|
|
|
label: qsTr("Bio")
|
|
|
|
placeholderText: qsTr("Tell us about yourself")
|
|
|
|
charLimit: 240
|
|
|
|
multiline: true
|
|
|
|
minimumHeight: 108
|
|
|
|
maximumHeight: 108
|
|
|
|
input.verticalAlignment: TextEdit.AlignTop
|
2022-08-16 17:22:19 +00:00
|
|
|
|
|
|
|
input.tabNavItem: socialLinksRepeater.count ? socialLinksRepeater.itemAt(0).input.edit : null
|
2022-08-10 08:27:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Repeater {
|
2022-08-16 17:22:19 +00:00
|
|
|
id: socialLinksRepeater
|
|
|
|
|
2022-08-10 08:27:45 +00:00
|
|
|
model: root.socialLinksModel
|
|
|
|
delegate: StaticSocialLinkInput {
|
2022-08-12 15:51:33 +00:00
|
|
|
objectName: model.text + "-socialLinkInput"
|
|
|
|
|
2022-08-10 08:27:45 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
linkType: model.linkType
|
2022-12-05 14:21:20 +00:00
|
|
|
text: Utils.stripSocialLinkPrefix(model.url, model.linkType)
|
|
|
|
icon: model.icon
|
2022-08-10 08:27:45 +00:00
|
|
|
|
2022-12-05 14:21:20 +00:00
|
|
|
onTextChanged: root.socialLinkChanged(model.uuid, model.text, Utils.addSocialLinkPrefix(text, model.linkType))
|
2022-08-16 17:22:19 +00:00
|
|
|
|
|
|
|
input.tabNavItem: {
|
|
|
|
if (index < socialLinksRepeater.count - 1) {
|
|
|
|
return socialLinksRepeater.itemAt(index + 1).input.edit
|
|
|
|
}
|
|
|
|
return addMoreSocialLinksButton
|
|
|
|
}
|
2022-08-10 08:27:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconTextButton {
|
2022-08-16 17:22:19 +00:00
|
|
|
id: addMoreSocialLinksButton
|
|
|
|
|
2022-08-12 15:51:33 +00:00
|
|
|
objectName: "addMoreSocialLinksButton"
|
2022-08-10 08:27:45 +00:00
|
|
|
Layout.topMargin: -8 // by design
|
|
|
|
text: qsTr("Add more social links")
|
|
|
|
onClicked: root.addSocialLinksClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|