2022-09-12 10:06:26 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-18 12:01:09 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
import "../popups"
|
2021-05-28 17:35:21 +00:00
|
|
|
|
|
|
|
Item {
|
2021-10-01 15:58:36 +00:00
|
|
|
id: root
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2022-10-05 14:51:42 +00:00
|
|
|
property bool hasAdmin: false
|
2022-05-10 16:04:25 +00:00
|
|
|
property bool hasMentions: false
|
|
|
|
property bool hasReplies: false
|
2022-09-16 13:06:52 +00:00
|
|
|
property bool hasContactRequests: false
|
2022-11-15 10:11:55 +00:00
|
|
|
property bool hasIdentityRequests: false
|
2022-10-05 14:51:42 +00:00
|
|
|
property bool hasMembership: false
|
2022-09-16 13:06:52 +00:00
|
|
|
|
2022-05-10 16:04:25 +00:00
|
|
|
property bool hideReadNotifications: false
|
2022-09-16 13:06:52 +00:00
|
|
|
property int unreadNotificationsCount: 0
|
2022-09-12 10:06:26 +00:00
|
|
|
|
|
|
|
property int currentActivityCategory: ActivityCenterPopup.ActivityCategory.All
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
property alias errorText: errorText.text
|
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
signal categoryTriggered(int category)
|
|
|
|
signal markAllReadClicked()
|
2022-09-16 13:06:52 +00:00
|
|
|
signal showHideReadNotifications(bool hideReadNotifications)
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
height: 64
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
RowLayout {
|
|
|
|
id: row
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2021-05-28 17:35:21 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
2022-11-18 09:22:07 +00:00
|
|
|
StatusRollArea {
|
2022-09-12 10:06:26 +00:00
|
|
|
Layout.fillWidth: true
|
2022-11-18 09:22:07 +00:00
|
|
|
|
|
|
|
content: RowLayout {
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
// NOTE: some entries are hidden until implimentation
|
|
|
|
model: [ { text: qsTr("All"), category: ActivityCenterPopup.ActivityCategory.All, visible: true, enabled: true },
|
2022-11-15 10:11:55 +00:00
|
|
|
{ text: qsTr("Admin"), category: ActivityCenterPopup.ActivityCategory.Admin, visible: root.hasAdmin, enabled: root.hasAdmin },
|
|
|
|
{ text: qsTr("Mentions"), category: ActivityCenterPopup.ActivityCategory.Mentions, visible: true, enabled: root.hasMentions },
|
|
|
|
{ text: qsTr("Replies"), category: ActivityCenterPopup.ActivityCategory.Replies, visible: true, enabled: root.hasReplies },
|
|
|
|
{ text: qsTr("Contact requests"), category: ActivityCenterPopup.ActivityCategory.ContactRequests, visible: true, enabled: root.hasContactRequests },
|
|
|
|
{ text: qsTr("Identity verification"), category: ActivityCenterPopup.ActivityCategory.IdentityVerification, visible: true, enabled: root.hasIdentityRequests },
|
|
|
|
{ text: qsTr("Transactions"), category: ActivityCenterPopup.ActivityCategory.Transactions, visible: false, enabled: true },
|
|
|
|
{ text: qsTr("Membership"), category: ActivityCenterPopup.ActivityCategory.Membership, visible: true, enabled: root.hasMembership },
|
|
|
|
{ text: qsTr("System"), category: ActivityCenterPopup.ActivityCategory.System, visible: false, enabled: true } ]
|
2022-11-18 09:22:07 +00:00
|
|
|
|
|
|
|
StatusFlatButton {
|
|
|
|
enabled: modelData.enabled
|
|
|
|
visible: modelData.visible
|
|
|
|
text: modelData.text
|
|
|
|
size: StatusBaseButton.Size.Small
|
2022-11-21 16:17:39 +00:00
|
|
|
highlighted: modelData.category === root.currentActivityCategory
|
2022-11-18 09:22:07 +00:00
|
|
|
onClicked: root.categoryTriggered(modelData.category)
|
|
|
|
onEnabledChanged: if (!enabled && highlighted) root.categoryTriggered(ActivityCenterPopup.ActivityCategory.All)
|
2022-11-21 16:17:39 +00:00
|
|
|
Layout.preferredWidth: visible ? implicitWidth : 0
|
2022-11-18 09:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-12 10:06:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-18 12:01:09 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: markAllReadBtn
|
2022-09-16 13:06:52 +00:00
|
|
|
enabled: root.unreadNotificationsCount > 0
|
2021-10-18 12:01:09 +00:00
|
|
|
icon.name: "double-checkmark"
|
2022-09-16 13:06:52 +00:00
|
|
|
onClicked: root.markAllReadClicked()
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2021-10-18 12:01:09 +00:00
|
|
|
StatusToolTip {
|
2022-09-16 13:06:52 +00:00
|
|
|
visible: markAllReadBtn.hovered
|
|
|
|
text: qsTr("Mark all as Read")
|
2021-10-18 12:01:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
2022-09-12 10:06:26 +00:00
|
|
|
id: hideReadNotificationsBtn
|
2022-09-16 13:06:52 +00:00
|
|
|
icon.name: root.hideReadNotifications ? "hide" : "show"
|
|
|
|
onClicked: root.showHideReadNotifications(!root.hideReadNotifications)
|
2021-10-18 12:01:09 +00:00
|
|
|
|
2022-09-12 10:06:26 +00:00
|
|
|
StatusToolTip {
|
2022-09-16 13:06:52 +00:00
|
|
|
visible: hideReadNotificationsBtn.hovered
|
2022-10-01 12:07:14 +00:00
|
|
|
offset: width / 4
|
2022-09-16 13:06:52 +00:00
|
|
|
text: root.hideReadNotifications ? qsTr("Show read notifications") : qsTr("Hide read notifications")
|
2021-10-18 12:01:09 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|
2021-06-11 17:41:59 +00:00
|
|
|
|
2021-10-18 12:01:09 +00:00
|
|
|
StatusBaseText {
|
2021-06-11 17:41:59 +00:00
|
|
|
id: errorText
|
|
|
|
visible: !!text
|
2022-09-12 10:06:26 +00:00
|
|
|
anchors.top: parent.top
|
2021-06-11 17:41:59 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2021-10-18 12:01:09 +00:00
|
|
|
color: Theme.palette.dangerColor1
|
2021-06-11 17:41:59 +00:00
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|