Lukáš Tinkl 9559789030 chore: reduce the number of (verification) RPC calls
- when calling `Utils.getColorHashAsJson()` we don't actually need to
issue ID verification requests at all and there might be situations when
we know beforehand that we don't need the ENS verification either
- change these helper functions' syntax and do early returns in that case
- in MessageContextMenuView, the "contact details" were duplicated, so
remove one
- remove dead code, fix some warnings
2022-12-01 16:50:23 +01:00

60 lines
1.4 KiB
QML

import QtQuick 2.3
import shared 1.0
import shared.panels 1.0
import utils 1.0
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
Loader {
id: root
property int imageHeight: 44
property int imageWidth: 44
property string name
property string pubkey
property string image
property bool showRing: !ensVerified
property bool interactive: true
property bool disabled: false
property bool ensVerified: false
property int colorId: Utils.colorIdForPubkey(pubkey)
property var colorHash: Utils.getColorHashAsJson(pubkey, ensVerified)
signal clicked()
sourceComponent: StatusSmartIdenticon {
name: root.name
asset {
width: root.imageWidth
height: root.imageHeight
color: Utils.colorForColorId(root.colorId)
name: root.image
charactersLen: 2
isImage: true
}
ringSettings {
ringSpecModel: root.showRing ? root.colorHash : undefined
}
Loader {
anchors.fill: parent
active: root.interactive
sourceComponent: MouseArea {
cursorShape: hoverEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: !root.disabled
onClicked: {
if (!root.disabled) {
root.clicked()
}
}
}
}
}
}