feat(GODT-2960): replaced the account list with a button and label when no account is configured.

This commit is contained in:
Xavier Michelon
2023-09-29 17:35:36 +02:00
parent 742d9eeef3
commit 52addb2582

View File

@ -54,6 +54,10 @@ Item {
rightContent.showGeneralSettings(); rightContent.showGeneralSettings();
} }
function hasAccount() {
return Backend.users.count > 0
}
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
@ -190,6 +194,41 @@ Item {
Layout.minimumHeight: 1 Layout.minimumHeight: 1
color: leftBar.colorScheme.border_weak color: leftBar.colorScheme.border_weak
} }
Item {
id: noAccountBox
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: 24
visible: !hasAccount()
ColumnLayout {
anchors.fill: parent
spacing: 8
Label {
colorScheme: leftBar.colorScheme
color: colorScheme.text_weak
Layout.alignment: Qt.AlignHCenter
text: qsTr("No accounts")
}
Button {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
colorScheme: leftBar.colorScheme
text: qsTr("Add an account")
secondary: true
onClicked: root.showLogin("")
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
ListView { ListView {
id: accounts id: accounts
@ -206,7 +245,7 @@ Item {
clip: true clip: true
model: Backend.users model: Backend.users
spacing: 12 spacing: 12
visible: hasAccount()
delegate: Item { delegate: Item {
implicitHeight: children[0].implicitHeight + children[0].anchors.topMargin + children[0].anchors.bottomMargin implicitHeight: children[0].implicitHeight + children[0].anchors.topMargin + children[0].anchors.bottomMargin
implicitWidth: children[0].implicitWidth + children[0].anchors.leftMargin + children[0].anchors.rightMargin implicitWidth: children[0].implicitWidth + children[0].anchors.leftMargin + children[0].anchors.rightMargin
@ -326,7 +365,7 @@ Item {
StackLayout { StackLayout {
// 0 // 0
currentIndex: (Backend.users.count > 0 ? 1 : 0) currentIndex: hasAccount() ? 1 : 0
NoAccountView { NoAccountView {
colorScheme: root.colorScheme colorScheme: root.colorScheme
onLinkClicked: function() { onLinkClicked: function() {