mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-15 09:04:45 +00:00
fac0e50e37
This component introduces `StatusLetterIdenticon`, `StatusImageIdenticon` and `StatusIdenticon`. - `StatusLetterIdenticon` renders an identicon with a single letter based on a name. - `StatusImageIdenticon` renders an actual image based on an identicon URL - `StatusIdenticon` is a composition of the former both, but with a loading mechanism to decide which should be rendered The commit also ensures all of these components are used respectively throughout the application.
124 lines
3.6 KiB
QML
124 lines
3.6 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Controls 2.3
|
|
import QtQuick.Layouts 1.3
|
|
import QtQml.Models 2.3
|
|
import "../../../../imports"
|
|
import "../../../../shared"
|
|
import "../../../../shared/status"
|
|
import "./"
|
|
|
|
PopupMenu {
|
|
property bool isProfile: false
|
|
property bool isSticker: false
|
|
|
|
id: messageContextMenu
|
|
width: messageContextMenu.isProfile ? profileHeader.width : emojiContainer.width
|
|
|
|
Item {
|
|
id: emojiContainer
|
|
visible: !messageContextMenu.isProfile
|
|
width: emojiRow.width
|
|
height: visible ? emojiRow.height : 0
|
|
|
|
Row {
|
|
id: emojiRow
|
|
spacing: Style.current.smallPadding
|
|
leftPadding: Style.current.smallPadding
|
|
rightPadding: Style.current.smallPadding
|
|
bottomPadding: Style.current.padding
|
|
|
|
Repeater {
|
|
model: reactionModel
|
|
delegate: EmojiReaction {
|
|
source: "../../../img/" + filename
|
|
emojiId: model.emojiId
|
|
closeModal: function () {
|
|
messageContextMenu.close()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
property bool hovered: false
|
|
|
|
id: profileHeader
|
|
visible: messageContextMenu.isProfile
|
|
width: 200
|
|
height: visible ? profileImage.height + username.height + Style.current.padding : 0
|
|
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
|
|
|
|
StatusImageIdenticon {
|
|
id: profileImage
|
|
source: profilePopup.identicon
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 4
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
}
|
|
|
|
StyledText {
|
|
id: username
|
|
text: Utils.removeStatusEns(profilePopup.userName)
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.WordWrap
|
|
anchors.top: profileImage.bottom
|
|
anchors.topMargin: 4
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
font.weight: Font.Medium
|
|
font.pixelSize: 15
|
|
}
|
|
|
|
MouseArea {
|
|
cursorShape: Qt.PointingHandCursor
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
onEntered: {
|
|
profileHeader.hovered = true
|
|
}
|
|
onExited: {
|
|
profileHeader.hovered = false
|
|
}
|
|
onClicked: {
|
|
profilePopup.open()
|
|
messageContextMenu.close()
|
|
}
|
|
}
|
|
}
|
|
|
|
Separator {
|
|
anchors.bottom: viewProfileAction.top
|
|
}
|
|
|
|
Action {
|
|
id: viewProfileAction
|
|
//% "View profile"
|
|
text: qsTrId("view-profile")
|
|
onTriggered: {
|
|
profilePopup.open()
|
|
messageContextMenu.close()
|
|
}
|
|
icon.source: "../../../img/profileActive.svg"
|
|
icon.width: 16
|
|
icon.height: 16
|
|
}
|
|
Action {
|
|
text: messageContextMenu.isProfile ?
|
|
//% "Send message"
|
|
qsTrId("send-message") :
|
|
//% "Reply to"
|
|
qsTrId("reply-to")
|
|
onTriggered: {
|
|
messageContextMenu.isProfile ? chatsModel.joinChat(profilePopup.fromAuthor, Constants.chatTypeOneToOne) : showReplyArea()
|
|
messageContextMenu.close()
|
|
}
|
|
icon.source: "../../../img/messageActive.svg"
|
|
icon.width: 16
|
|
icon.height: 16
|
|
enabled: !isSticker
|
|
}
|
|
}
|