refactor(ContactsContainer): make use of NoFriendsRectangle

This commit is contained in:
Pascal Precht 2021-02-01 13:06:21 +01:00
parent 1b009d634d
commit 105c4cba4a
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 12 additions and 58 deletions

View File

@ -6,16 +6,17 @@ import "../../../../shared/status"
Rectangle { Rectangle {
id: noContactsRect id: noContactsRect
width: 260 width: 260
property string text: qsTr("You dont have any contacts yet. Invite your friends to start chatting.")
StyledText { StyledText {
id: noContacts id: noContacts
//% "You dont have any contacts yet. Invite your friends to start chatting." text: noContactsRect.text
text: qsTrId("you-don-t-have-any-contacts-yet--invite-your-friends-to-start-chatting-")
color: Style.current.darkGrey color: Style.current.darkGrey
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
StatusButton { StatusButton {

View File

@ -149,35 +149,13 @@ ModalPopup {
} }
} }
Rectangle {
NoFriendsRectangle {
id: noContactsRect id: noContactsRect
width: 260 visible: profileModel.contacts.addedContacts.rowCount() === 0
anchors.centerIn: parent text: qsTr("You dont have any contacts yet. Invite your friends to start chatting.")
StyledText { width: parent.width
id: noContacts anchors.verticalCenter: parent.verticalCenter
//% "You dont have any contacts yet. Invite your friends to start chatting."
text: qsTrId("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
}
StatusButton {
//% "Invite friends"
text: qsTrId("invite-friends")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: noContacts.bottom
anchors.topMargin: Style.current.xlPadding
onClicked: {
inviteFriendsPopup.open()
}
}
InviteFriendsPopup {
id: inviteFriendsPopup
}
} }
} }
} }

View File

@ -232,37 +232,12 @@ Item {
searchString: searchBox.text searchString: searchBox.text
} }
Item { NoFriendsRectangle {
id: element id: element
visible: profileModel.contacts.addedContacts.rowCount() === 0 visible: profileModel.contacts.addedContacts.rowCount() === 0
anchors.top: addNewContact.bottom text: qsTr("You dont have any contacts yet")
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.verticalCenter: parent.verticalCenter
StyledText {
id: noFriendsText
//% "You dont have any contacts yet"
text: qsTrId("you-don-t-have-any-contacts-yet")
anchors.verticalCenterOffset: -Style.current.bigPadding
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
color: Style.current.darkGrey
}
StatusButton {
anchors.horizontalCenter: noFriendsText.horizontalCenter
anchors.top: noFriendsText.bottom
anchors.topMargin: Style.current.bigPadding
//% "Invite friends"
text: qsTrId("invite-friends")
onClicked: function () {
inviteFriendsPopup.open()
}
}
}
InviteFriendsPopup {
id: inviteFriendsPopup
} }
} }
} }