2020-09-22 14:45:09 +00:00
|
|
|
import QtQuick 2.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-09-22 14:45:09 +00:00
|
|
|
import "../../shared"
|
2021-10-14 13:09:35 +00:00
|
|
|
import "../../shared/panels"
|
2020-09-22 14:45:09 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2021-03-02 20:43:32 +00:00
|
|
|
property string chatId
|
2020-09-22 14:45:09 +00:00
|
|
|
property string chatName
|
2021-05-12 10:02:09 +00:00
|
|
|
property int letterSize: 15
|
2020-09-22 14:45:09 +00:00
|
|
|
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
radius: width / 2
|
|
|
|
|
|
|
|
color: {
|
2021-06-17 22:09:00 +00:00
|
|
|
const color = chatsModel.channelView.getChannelColor(chatId)
|
2020-09-22 14:45:09 +00:00
|
|
|
if (!color) {
|
2020-12-11 20:29:46 +00:00
|
|
|
return Style.current.orange
|
2020-09-22 14:45:09 +00:00
|
|
|
}
|
|
|
|
return color
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: (root.chatName.charAt(0) == "#" ? root.chatName.charAt(1) : root.chatName.charAt(0)).toUpperCase()
|
|
|
|
opacity: 0.7
|
|
|
|
font.weight: Font.Bold
|
2021-03-10 11:27:35 +00:00
|
|
|
font.pixelSize: root.letterSize
|
2020-09-22 14:45:09 +00:00
|
|
|
color: "white"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-03-10 11:27:35 +00:00
|
|
|
anchors.leftMargin: -1
|
|
|
|
anchors.bottomMargin: -2
|
2020-09-22 14:45:09 +00:00
|
|
|
}
|
|
|
|
}
|