mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-22 04:21:44 +00:00
feat: display empty state when user has no contacts
This commit is contained in:
parent
d3b6ff32b8
commit
477f5aa460
@ -78,6 +78,11 @@ QtObject:
|
||||
self.contacts.add(contact)
|
||||
self.endInsertRows()
|
||||
|
||||
proc hasAddedContacts(self: ContactList): bool {.slot.} =
|
||||
for c in self.contacts:
|
||||
if(c.isContact()): return true
|
||||
return false
|
||||
|
||||
proc updateContact*(self: ContactList, contact: Profile) =
|
||||
var found = false
|
||||
let topLeft = self.createIndex(0, 0, nil)
|
||||
|
@ -46,6 +46,11 @@ ModalPopup {
|
||||
identicon: profileModel.profile.identicon,
|
||||
isUser: true
|
||||
});
|
||||
noContactsRect.visible = !profileModel.contactList.hasAddedContacts();
|
||||
svMembers.visible = !noContactsRect.visible;
|
||||
if(!svMembers.visible){
|
||||
memberCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function doJoin(){
|
||||
@ -94,6 +99,38 @@ ModalPopup {
|
||||
visible: !selectChatMembers
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: noContactsRect
|
||||
width: 260
|
||||
anchors.top: groupName.bottom
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
StyledText {
|
||||
id: noContacts
|
||||
text: qsTr("You don’t have any contacts yet. Invite your friends to start chatting.")
|
||||
color: Style.current.darkGrey
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledButton {
|
||||
//% "Invite friends"
|
||||
label: qsTrId("invite-friends")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: noContacts.bottom
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
onClicked: {
|
||||
inviteFriendsPopup.open()
|
||||
}
|
||||
}
|
||||
InviteFriendsPopup {
|
||||
id: inviteFriendsPopup
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 50
|
||||
@ -101,6 +138,7 @@ ModalPopup {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: svMembers
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: groupMembers.contentHeight > groupMembers.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||
|
||||
|
@ -18,11 +18,6 @@ ModalPopup {
|
||||
pubKeys = [];
|
||||
memberCount = chatsModel.activeChannel.members.rowCount();
|
||||
currMemberCount = memberCount;
|
||||
for(var i in groupMembers.contentItem.children){
|
||||
if (groupMembers.contentItem.children[i].isChecked !== null) {
|
||||
groupMembers.contentItem.children[i].isChecked = false
|
||||
}
|
||||
}
|
||||
data.clear();
|
||||
for(let i = 0; i < profileModel.contactList.rowCount(); i++){
|
||||
if(chatsModel.activeChannel.contains(profileModel.contactList.rowData(i, "pubKey"))) continue;
|
||||
@ -162,8 +157,41 @@ ModalPopup {
|
||||
fontPixelSize: 15
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: noContactsRect
|
||||
width: 320
|
||||
visible: data.count == 0
|
||||
anchors.top: searchBox.bottom
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
StyledText {
|
||||
id: noContacts
|
||||
text: qsTr("All your contacts are already in the group")
|
||||
color: Style.current.textColor
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledButton {
|
||||
//% "Invite friends"
|
||||
label: qsTrId("invite-friends")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: noContacts.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
onClicked: {
|
||||
inviteFriendsPopup.open()
|
||||
}
|
||||
}
|
||||
InviteFriendsPopup {
|
||||
id: inviteFriendsPopup
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
visible: addMembers
|
||||
visible: addMembers && data.count > 0
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 50
|
||||
anchors.top: searchBox.bottom
|
||||
|
@ -56,6 +56,7 @@ ModalPopup {
|
||||
pubKey = "";
|
||||
ensUsername.text = "";
|
||||
chatKey.forceActiveFocus(Qt.MouseFocusReason)
|
||||
noContactsRect.visible = !profileModel.contactList.hasAddedContacts()
|
||||
}
|
||||
|
||||
Input {
|
||||
@ -128,6 +129,36 @@ ModalPopup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: noContactsRect
|
||||
width: 260
|
||||
anchors.centerIn: parent
|
||||
StyledText {
|
||||
id: noContacts
|
||||
text: qsTr("You don’t have any contacts yet. Invite your friends to start chatting.")
|
||||
color: Style.current.darkGrey
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledButton {
|
||||
//% "Invite friends"
|
||||
label: qsTrId("invite-friends")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: noContacts.bottom
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
onClicked: {
|
||||
inviteFriendsPopup.open()
|
||||
}
|
||||
}
|
||||
InviteFriendsPopup {
|
||||
id: inviteFriendsPopup
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user