2023-04-07 18:31:29 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
2024-08-09 11:28:51 +00:00
|
|
|
import QtGraphicalEffects 1.15
|
2023-04-07 18:31:29 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2024-08-09 11:28:51 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-04-07 18:31:29 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property int mentionsCount
|
|
|
|
property int recentMessagesCount
|
|
|
|
|
2023-04-11 21:24:10 +00:00
|
|
|
property alias recentMessagesButtonVisible: recentMessagesButton.visible
|
|
|
|
|
2023-04-07 18:31:29 +00:00
|
|
|
signal mentionsButtonClicked
|
|
|
|
signal recentMessagesButtonClicked
|
|
|
|
|
|
|
|
implicitWidth: layout.implicitWidth
|
|
|
|
implicitHeight: layout.implicitHeight
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
function limitNumberTo99(number) {
|
|
|
|
return number > 99 ? qsTr("99+") : number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component AnchorButton: StatusButton {
|
|
|
|
Layout.preferredHeight: 38
|
|
|
|
radius: 100
|
2024-08-09 11:28:51 +00:00
|
|
|
spacing: 2
|
2023-04-07 18:31:29 +00:00
|
|
|
|
|
|
|
icon.width: Style.current.primaryTextFontSize + 5
|
|
|
|
icon.height: Style.current.primaryTextFontSize + 5
|
|
|
|
verticalPadding: Style.current.halfPadding
|
|
|
|
horizontalPadding: Style.current.smallPadding
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
2024-08-09 11:28:51 +00:00
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow {
|
|
|
|
samples: 16
|
|
|
|
cached: true
|
|
|
|
color: Theme.palette.alphaColor(Theme.palette.directColor1, 0.16)
|
|
|
|
}
|
2023-04-07 18:31:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: layout
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
spacing: Style.current.smallPadding
|
|
|
|
|
|
|
|
AnchorButton {
|
2024-08-09 11:28:51 +00:00
|
|
|
visible: root.mentionsCount > 0
|
|
|
|
text: d.limitNumberTo99(root.mentionsCount)
|
2023-04-07 18:31:29 +00:00
|
|
|
type: StatusBaseButton.Type.Primary
|
2024-08-09 11:28:51 +00:00
|
|
|
textColor: Theme.palette.white
|
2023-04-07 18:31:29 +00:00
|
|
|
icon.name: "username"
|
|
|
|
|
|
|
|
onClicked: root.mentionsButtonClicked()
|
|
|
|
}
|
|
|
|
|
|
|
|
AnchorButton {
|
2023-04-11 21:24:10 +00:00
|
|
|
id: recentMessagesButton
|
|
|
|
|
2024-08-09 11:28:51 +00:00
|
|
|
text: root.recentMessagesCount <= 0 ? "" : d.limitNumberTo99(root.recentMessagesCount)
|
|
|
|
normalColor: Theme.palette.baseColor1
|
|
|
|
hoverColor: Theme.palette.hoverColor(normalColor)
|
|
|
|
textColor: Theme.palette.white
|
2023-04-07 18:31:29 +00:00
|
|
|
textPosition: StatusBaseButton.TextPosition.Left
|
|
|
|
icon.name: "arrow-down"
|
|
|
|
|
|
|
|
onClicked: root.recentMessagesButtonClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|