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,64 +273,65 @@ ModalPopup {
return "" return ""
} }
Column { StatusImageIdenticon {
Image { id: identicon
source: model.identicon anchors.left: parent.left
mipmap: true source: model.identicon
smooth: false
antialiasing: true
}
} }
Column {
StyledText {
text: !model.userName.endsWith(".eth") && !!contactRow.nickname ?
contactRow.nickname : Utils.removeStatusEns(model.userName)
width: 300
elide: Text.ElideRight
Layout.fillWidth: true
font.pixelSize: 13
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname)
}
}
} StyledText {
Column { text: !model.userName.endsWith(".eth") && !!contactRow.nickname ?
StyledText { contactRow.nickname : Utils.removeStatusEns(model.userName)
visible: model.isAdmin anchors.left: identicon.right
//% "Admin" anchors.leftMargin: Style.current.smallPadding
text: qsTrId("group-chat-admin") anchors.right: adminLabel.left
width: 100 anchors.rightMargin: Style.current.smallPadding
font.pixelSize: 13 anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 13
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname, popup)
} }
StyledText { }
id: moreActionsBtn
visible: !model.isAdmin && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey) StyledText {
text: "..." id: adminLabel
width: 100 visible: model.isAdmin
MouseArea { //% "Admin"
anchors.fill: parent text: qsTrId("group-chat-admin")
onClicked: { anchors.right: parent.right
contextMenu.popup(moreActionsBtn.x - moreActionsBtn.width, moreActionsBtn.height + 10) anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 13
}
StyledText {
id: moreActionsBtn
visible: !model.isAdmin && chatsModel.activeChannel.isAdmin(profileModel.profile.pubKey)
text: "..."
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: {
contextMenu.popup(-contextMenu.width / 2 + moreActionsBtn.width / 2, moreActionsBtn.height + 10)
}
cursorShape: Qt.PointingHandCursor
PopupMenu {
id: contextMenu
Action {
icon.source: "../../../img/make-admin.svg"
//% "Make Admin"
text: qsTrId("make-admin")
onTriggered: chatsModel.makeAdmin(chatsModel.activeChannel.id, model.pubKey)
} }
cursorShape: Qt.PointingHandCursor Action {
PopupMenu { icon.source: "../../../img/remove-from-group.svg"
id: contextMenu icon.color: Style.current.red
Action { //% "Remove From Group"
icon.source: "../../../img/make-admin.svg" text: qsTrId("remove-from-group")
//% "Make Admin" onTriggered: chatsModel.kickGroupMember(chatsModel.activeChannel.id, model.pubKey)
text: qsTrId("make-admin")
onTriggered: chatsModel.makeAdmin(chatsModel.activeChannel.id, model.pubKey)
}
Action {
icon.source: "../../../img/remove-from-group.svg"
icon.color: Style.current.red
//% "Remove From Group"
text: qsTrId("remove-from-group")
onTriggered: chatsModel.kickGroupMember(chatsModel.activeChannel.id, model.pubKey)
}
} }
} }
} }