From 284572898a2688e5cbce785c0c56a4ee555e4813 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 8 Jul 2020 15:59:10 -0400 Subject: [PATCH] feat: add view when clicking the X on the EmptyView --- ui/app/AppLayouts/Chat/ContactsColumn.qml | 23 +++++++++---- .../Chat/ContactsColumn/ClosedEmptyView.qml | 33 +++++++++++++++++++ .../Chat/ContactsColumn/EmptyView.qml | 14 ++++++-- ui/app/AppLayouts/Chat/ContactsColumn/qmldir | 1 + ui/nim-status-client.pro | 1 + 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 ui/app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index c3571a002b..83476778a6 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -57,23 +57,34 @@ Item { } StackLayout { + id: contactsStackView anchors.bottom: parent.bottom - anchors.bottomMargin: 0 anchors.left: parent.left - anchors.leftMargin: 0 anchors.right: parent.right - anchors.rightMargin: 0 anchors.top: searchBox.bottom - anchors.topMargin: 16 + anchors.topMargin: Style.current.padding - currentIndex: channelList.channelListCount > 0 ? 1 : 0 + function getCurrentIndex() { + return channelList.channelListCount > 0 ? 1 : 0 + } - EmptyView {} + currentIndex: getCurrentIndex() + + EmptyView { + onCloseButtonPressed: function () { + contactsStackView.currentIndex = 2 + } + } ChannelList { id: channelList searchStr: contactsColumn.searchStr + onChannelListCountChanged: { + contactsStackView.currentIndex = contactsStackView.getCurrentIndex() + } } + + ClosedEmptyView {} } } diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml b/ui/app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml new file mode 100644 index 0000000000..9776399ed8 --- /dev/null +++ b/ui/app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml @@ -0,0 +1,33 @@ +import QtQuick 2.13 +import QtQuick.Controls 2.13 +import QtQuick.Layouts 1.13 +import QtGraphicalEffects 1.13 +import "../components" +import "../../../../shared" +import "../../../../imports" + +Item { + id: closedEmptyView + Layout.fillHeight: true + Layout.fillWidth: true + + StyledText { + text: qsTr("Your chats will appear here. To start new chats press the  button at the top") + anchors.verticalCenterOffset: -80 + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + anchors.right: parent.right + anchors.rightMargin: 56 + anchors.left: parent.left + anchors.leftMargin: 56 + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 15 + color: Style.current.darkGrey + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;formeditorColor:"#ffffff";formeditorZoom:1.25;height:500;width:300} +} +##^##*/ diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml index cd60cd156b..51de1ba6c3 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml @@ -7,11 +7,14 @@ import "../../../../shared" import "../../../../imports" Item { + property var onCloseButtonPressed: function () {} + + id: emptyView Layout.fillHeight: true Layout.fillWidth: true Rectangle { - id: emptyView + id: emptyViewContent border.color: Style.current.grey radius: 16 anchors.right: parent.right @@ -54,8 +57,15 @@ Item { source: closeImg color: Style.current.darkGrey } + MouseArea { + anchors.fill: closeImg + cursorShape: Qt.PointingHandCursor + onClicked: { + emptyView.onCloseButtonPressed() + } + } - Text { + StyledText { id: chatAndTransactText text: qsTr("Chat and transact privately with your friends") anchors.top: parent.top diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/qmldir b/ui/app/AppLayouts/Chat/ContactsColumn/qmldir index 9fcb33c21c..75d30150e0 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/qmldir +++ b/ui/app/AppLayouts/Chat/ContactsColumn/qmldir @@ -1,2 +1,3 @@ EmptyView 1.0 EmptyView.qml +ClosedEmptyView 1.0 ClosedEmptyView.qml ChannelList 1.0 ChannelList.qml diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index fed3652cb4..4254989b90 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -55,6 +55,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += \ + app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml \ app/AppLayouts/Chat/components/EmojiPopup.qml \ fonts/InterStatus/InterStatus-Black.otf \ fonts/InterStatus/InterStatus-BlackItalic.otf \