From b3b7047fe17968286aac2031618b7b6f2e73b916 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 9 Jul 2020 11:21:45 -0400 Subject: [PATCH] feat: add invite friends modal --- .../AppLayouts/Chat/ChatColumn/EmptyChat.qml | 12 +++++++-- .../Chat/ContactsColumn/EmptyView.qml | 7 ++++++ .../Chat/components/InviteFriendsPopup.qml | 25 +++++++++++++++++++ ui/app/AppLayouts/Chat/components/qmldir | 1 + ui/nim-status-client.pro | 1 + ui/shared/ModalPopup.qml | 2 ++ 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 ui/app/AppLayouts/Chat/components/InviteFriendsPopup.qml diff --git a/ui/app/AppLayouts/Chat/ChatColumn/EmptyChat.qml b/ui/app/AppLayouts/Chat/ChatColumn/EmptyChat.qml index ce32a3aa5d..19c4d315b4 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/EmptyChat.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/EmptyChat.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import "../../../../shared" import "../../../../imports" +import "../components" Item { id: element @@ -17,7 +18,10 @@ Item { } StyledText { - text: `Share your chat key or invite friends to start messaging in Status` + text: `${qsTr("Share your chat key")}` + + ` ${qsTr("or")} ` + + `${qsTr("invite")}`+ + ` ${qsTr("friends to start messaging in Status")}` textFormat: Text.RichText wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter @@ -29,11 +33,15 @@ Item { onLinkActivated: function (linkClicked) { switch (linkClicked) { case "shareKey": console.log('Go to share key'); break; - case "invite": console.log('Go to invite'); break; + case "invite": inviteFriendsPopup.open(); break; default: //no idea what was clicked } } } + + InviteFriendsPopup { + id: inviteFriendsPopup + } } /*##^## Designer { diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml index 51de1ba6c3..cc73be763f 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml @@ -84,6 +84,13 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: Style.current.xlPadding + onClicked: { + inviteFriendsPopup.open() + } + } + + InviteFriendsPopup { + id: inviteFriendsPopup } } diff --git a/ui/app/AppLayouts/Chat/components/InviteFriendsPopup.qml b/ui/app/AppLayouts/Chat/components/InviteFriendsPopup.qml new file mode 100644 index 0000000000..5fd9f12fdd --- /dev/null +++ b/ui/app/AppLayouts/Chat/components/InviteFriendsPopup.qml @@ -0,0 +1,25 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.3 +import "../../../../imports" +import "../../../../shared" + +ModalPopup { + id: popup + readonly property string getStatusText: qsTr("Get Status at https://status.im") + + title: qsTr("Download Status link") + height: 156 + + StyledText { + id: linkText + text: popup.getStatusText + } + + CopyToClipBoardButton { + anchors.left: linkText.right + anchors.leftMargin: Style.current.smallPadding + anchors.verticalCenter: linkText.verticalCenter + textToCopy: popup.getStatusText + } +} + diff --git a/ui/app/AppLayouts/Chat/components/qmldir b/ui/app/AppLayouts/Chat/components/qmldir index 18209098dd..d76dd278f8 100644 --- a/ui/app/AppLayouts/Chat/components/qmldir +++ b/ui/app/AppLayouts/Chat/components/qmldir @@ -7,3 +7,4 @@ ChannelIcon 1.0 ChannelIcon.qml RenameGroupPopup 1.0 RenameGroupPopup.qml GroupChatPopup 1.0 GroupChatPopup.qml StickersPopup 1.0 StickersPopup.qml +InviteFriendsPopup 1.0 InviteFriendsPopup.qml diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 42d04010ac..4b72c8fa5b 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -57,6 +57,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin DISTFILES += \ app/AppLayouts/Chat/ContactsColumn/ClosedEmptyView.qml \ app/AppLayouts/Chat/components/EmojiPopup.qml \ + app/AppLayouts/Chat/components/InviteFriendsPopup.qml \ fonts/InterStatus/InterStatus-Black.otf \ fonts/InterStatus/InterStatus-BlackItalic.otf \ fonts/InterStatus/InterStatus-Bold.otf \ diff --git a/ui/shared/ModalPopup.qml b/ui/shared/ModalPopup.qml index d4c6e69b8e..43c18b07e3 100644 --- a/ui/shared/ModalPopup.qml +++ b/ui/shared/ModalPopup.qml @@ -110,12 +110,14 @@ Popup { Separator { id: separator2 + visible: !!footerContent.children[0] anchors.bottom: parent.bottom anchors.bottomMargin: 75 } Item { id: footerContent + visible: !!children[0] height: children[0] && children[0].height width: parent.width anchors.top: separator2.bottom