fix: fix group info popup layout and clean it up

This commit is contained in:
Jonathan Rainville 2020-10-20 15:19:10 -04:00 committed by Iuri Matias
parent d83ca70bef
commit fc4a179dc7
2 changed files with 63 additions and 62 deletions

View File

@ -73,7 +73,6 @@ ModalPopup {
font.bold: true font.bold: true
font.pixelSize: 17 font.pixelSize: 17
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Style.current.padding
} }
StyledText { StyledText {

View File

@ -56,7 +56,6 @@ ModalPopup {
width: 36 width: 36
height: 36 height: 36
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Style.current.padding
color: chatsModel.activeChannel.color color: chatsModel.activeChannel.color
chatName: chatsModel.activeChannel.name chatName: chatsModel.activeChannel.name
} }
@ -66,7 +65,7 @@ ModalPopup {
//% "Add members" //% "Add members"
text: addMembers ? qsTrId("add-members") : chatsModel.activeChannel.name text: addMembers ? qsTrId("add-members") : chatsModel.activeChannel.name
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 18 anchors.topMargin: 2
anchors.left: letterIdenticon.right anchors.left: letterIdenticon.right
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
font.bold: true font.bold: true
@ -102,8 +101,7 @@ ModalPopup {
visible: !addMembers && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey) visible: !addMembers && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey)
height: 24 height: 24
width: 24 width: 24
anchors.top: parent.top anchors.verticalCenter: groupName.verticalCenter
anchors.topMargin: Style.current.padding
anchors.leftMargin: 4 anchors.leftMargin: 4
anchors.left: groupName.right anchors.left: groupName.right
radius: 8 radius: 8
@ -204,11 +202,11 @@ ModalPopup {
clip: true clip: true
id: groupMembers id: groupMembers
delegate: Contact { delegate: Contact {
isVisible: searchBox.text == "" || model.name.includes(searchBox.text) isVisible: searchBox.text === "" || model.name.includes(searchBox.text)
showCheckbox: memberCount < maxMembers showCheckbox: memberCount < maxMembers
pubKey: model.pubKey pubKey: model.pubKey
isUser: model.isUser isUser: model.isUser
name: model.name.endsWith(".eth") && !!model.localNickname ? name: model.name.endsWith(".eth") || !model.localNickname ?
Utils.removeStatusEns(model.name) : model.localNickname Utils.removeStatusEns(model.name) : model.localNickname
address: model.address address: model.address
identicon: model.identicon identicon: model.identicon
@ -257,8 +255,11 @@ ModalPopup {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
model: chatsModel.activeChannel.members model: chatsModel.activeChannel.members
delegate: Row { delegate: Item {
id: contactRow id: contactRow
width: parent.width
height: identicon.height
property string nickname: { property string nickname: {
// Get contact nickname // Get contact nickname
const contactList = profileModel.contactList const contactList = profileModel.contactList
@ -272,47 +273,49 @@ ModalPopup {
return "" return ""
} }
Column { StatusImageIdenticon {
Image { id: identicon
anchors.left: parent.left
source: model.identicon source: model.identicon
mipmap: true
smooth: false
antialiasing: true
} }
}
Column {
StyledText { StyledText {
text: !model.userName.endsWith(".eth") && !!contactRow.nickname ? text: !model.userName.endsWith(".eth") && !!contactRow.nickname ?
contactRow.nickname : Utils.removeStatusEns(model.userName) contactRow.nickname : Utils.removeStatusEns(model.userName)
width: 300 anchors.left: identicon.right
elide: Text.ElideRight anchors.leftMargin: Style.current.smallPadding
Layout.fillWidth: true anchors.right: adminLabel.left
anchors.rightMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 13 font.pixelSize: 13
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname) onClicked: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname, popup)
} }
} }
}
Column {
StyledText { StyledText {
id: adminLabel
visible: model.isAdmin visible: model.isAdmin
//% "Admin" //% "Admin"
text: qsTrId("group-chat-admin") text: qsTrId("group-chat-admin")
width: 100 anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 13 font.pixelSize: 13
} }
StyledText { StyledText {
id: moreActionsBtn id: moreActionsBtn
visible: !model.isAdmin && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey) visible: !model.isAdmin && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey)
text: "..." text: "..."
width: 100 anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
contextMenu.popup(moreActionsBtn.x - moreActionsBtn.width, moreActionsBtn.height + 10) contextMenu.popup(-contextMenu.width / 2 + moreActionsBtn.width / 2, moreActionsBtn.height + 10)
} }
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
PopupMenu { PopupMenu {
@ -336,7 +339,6 @@ ModalPopup {
} }
} }
} }
}
footer: Item { footer: Item {
visible: chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey) visible: chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey)