2021-10-01 15:58:36 +00:00
|
|
|
import QtQuick 2.3
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-04-07 19:02:54 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
Loader {
|
|
|
|
id: root
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2022-08-10 14:04:56 +00:00
|
|
|
property int imageHeight: 44
|
|
|
|
property int imageWidth: 44
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
|
|
property string name
|
|
|
|
property string pubkey
|
2022-03-30 15:30:28 +00:00
|
|
|
property string image
|
2024-01-05 15:34:20 +00:00
|
|
|
property bool showRing: !ensVerified && !root.isBridgedAccount
|
2022-03-09 10:27:32 +00:00
|
|
|
property bool interactive: true
|
2022-09-15 07:31:38 +00:00
|
|
|
property bool disabled: false
|
2022-12-01 10:24:25 +00:00
|
|
|
property bool ensVerified: false
|
2023-04-06 07:56:50 +00:00
|
|
|
property bool loading: false
|
2024-01-05 15:34:20 +00:00
|
|
|
property bool isBridgedAccount: false
|
2024-02-09 15:52:28 +00:00
|
|
|
property int onlineStatus: Constants.onlineStatus.unknown
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2022-04-07 19:02:54 +00:00
|
|
|
property int colorId: Utils.colorIdForPubkey(pubkey)
|
2022-12-01 10:24:25 +00:00
|
|
|
property var colorHash: Utils.getColorHashAsJson(pubkey, ensVerified)
|
2022-04-07 19:02:54 +00:00
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
signal clicked()
|
|
|
|
|
|
|
|
sourceComponent: StatusSmartIdenticon {
|
|
|
|
name: root.name
|
2022-08-11 11:55:08 +00:00
|
|
|
asset {
|
2022-03-09 10:27:32 +00:00
|
|
|
width: root.imageWidth
|
|
|
|
height: root.imageHeight
|
2022-12-01 10:24:25 +00:00
|
|
|
color: Utils.colorForColorId(root.colorId)
|
2022-08-11 11:55:08 +00:00
|
|
|
name: root.image
|
2022-03-09 10:27:32 +00:00
|
|
|
charactersLen: 2
|
2022-08-11 11:55:08 +00:00
|
|
|
isImage: true
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
|
|
|
ringSettings {
|
2022-04-07 19:02:54 +00:00
|
|
|
ringSpecModel: root.showRing ? root.colorHash : undefined
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
2023-04-06 07:56:50 +00:00
|
|
|
loading: root.loading
|
2024-02-09 15:52:28 +00:00
|
|
|
|
|
|
|
badge.visible: root.onlineStatus !== Constants.onlineStatus.unknown && !root.isBridgedAccount
|
|
|
|
badge.width: root.imageWidth/4
|
|
|
|
badge.height: root.imageWidth/4
|
|
|
|
badge.border.width: 0.05 * root.imageWidth
|
|
|
|
badge.border.color: Theme.palette.statusBadge.foregroundColor
|
|
|
|
badge.color: {
|
|
|
|
if (root.onlineStatus === Constants.onlineStatus.online)
|
|
|
|
return Style.current.green
|
|
|
|
return Style.current.midGrey
|
|
|
|
}
|
|
|
|
badge.anchors.rightMargin: badge.border.width/2
|
|
|
|
badge.anchors.bottomMargin: badge.border.width/2
|
|
|
|
|
2024-01-05 15:34:20 +00:00
|
|
|
bridgeBadge.visible: root.isBridgedAccount
|
|
|
|
bridgeBadge.image.source: Style.svg("discord-bridge")
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
|
|
Loader {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
active: root.interactive
|
2021-12-09 12:53:40 +00:00
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
sourceComponent: MouseArea {
|
2022-09-15 07:31:38 +00:00
|
|
|
cursorShape: hoverEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
hoverEnabled: !root.disabled
|
2022-07-21 10:57:41 +00:00
|
|
|
onClicked: {
|
2022-09-15 07:31:38 +00:00
|
|
|
if (!root.disabled) {
|
|
|
|
root.clicked()
|
|
|
|
}
|
2022-07-21 10:57:41 +00:00
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|