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 {
id: noContactsRect
width: 260
property string text: qsTr("You dont have any contacts yet. Invite your friends to start chatting.")
StyledText {
id: noContacts
//% "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-")
text: noContactsRect.text
color: Style.current.darkGrey
anchors.top: parent.top
anchors.topMargin: Style.current.padding
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
}
StatusButton {

View File

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

View File

@ -232,37 +232,12 @@ Item {
searchString: searchBox.text
}
Item {
NoFriendsRectangle {
id: element
visible: profileModel.contacts.addedContacts.rowCount() === 0
anchors.top: addNewContact.bottom
text: qsTr("You dont have any contacts yet")
width: parent.width
anchors.bottom: parent.bottom
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
anchors.verticalCenter: parent.verticalCenter
}
}
}