From 52addb2582aabaf01640e0d58e36703c61c2a0d3 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Fri, 29 Sep 2023 17:35:36 +0200 Subject: [PATCH] feat(GODT-2960): replaced the account list with a button and label when no account is configured. --- .../bridge-gui/qml/ContentWrapper.qml | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml index 31cbe99e..e37e2596 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml @@ -54,6 +54,10 @@ Item { rightContent.showGeneralSettings(); } + function hasAccount() { + return Backend.users.count > 0 + } + RowLayout { anchors.fill: parent spacing: 0 @@ -190,6 +194,41 @@ Item { Layout.minimumHeight: 1 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 { id: accounts @@ -206,7 +245,7 @@ Item { clip: true model: Backend.users spacing: 12 - + visible: hasAccount() delegate: Item { implicitHeight: children[0].implicitHeight + children[0].anchors.topMargin + children[0].anchors.bottomMargin implicitWidth: children[0].implicitWidth + children[0].anchors.leftMargin + children[0].anchors.rightMargin @@ -326,7 +365,7 @@ Item { StackLayout { // 0 - currentIndex: (Backend.users.count > 0 ? 1 : 0) + currentIndex: hasAccount() ? 1 : 0 NoAccountView { colorScheme: root.colorScheme onLinkClicked: function() {