2023-02-21 16:11:44 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
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
|
|
|
|
|
2023-02-23 11:09:05 +00:00
|
|
|
import "../stores"
|
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
|
2023-03-01 12:23:46 +00:00
|
|
|
property bool hasIdentityVerification: 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
|
|
|
|
2023-02-23 11:09:05 +00:00
|
|
|
property int activeGroup: ActivityCenterStore.ActivityCenterGroup.All
|
2022-09-12 10:06:26 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
property alias errorText: errorText.text
|
|
|
|
|
2023-02-21 16:11:44 +00:00
|
|
|
signal groupTriggered(int group)
|
2022-09-12 10:06:26 +00:00
|
|
|
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
|
2023-02-23 11:09:05 +00:00
|
|
|
model: [ { text: qsTr("All"), group: ActivityCenterStore.ActivityCenterGroup.All, visible: true, enabled: true },
|
|
|
|
{ text: qsTr("Admin"), group: ActivityCenterStore.ActivityCenterGroup.Admin, visible: root.hasAdmin, enabled: root.hasAdmin },
|
|
|
|
{ text: qsTr("Mentions"), group: ActivityCenterStore.ActivityCenterGroup.Mentions, visible: true, enabled: root.hasMentions },
|
|
|
|
{ text: qsTr("Replies"), group: ActivityCenterStore.ActivityCenterGroup.Replies, visible: true, enabled: root.hasReplies },
|
|
|
|
{ text: qsTr("Contact requests"), group: ActivityCenterStore.ActivityCenterGroup.ContactRequests, visible: true, enabled: root.hasContactRequests },
|
2023-03-01 12:23:46 +00:00
|
|
|
{ text: qsTr("Identity verification"), group: ActivityCenterStore.ActivityCenterGroup.IdentityVerification, visible: true, enabled: root.hasIdentityVerification },
|
2023-02-23 11:09:05 +00:00
|
|
|
{ text: qsTr("Transactions"), group: ActivityCenterStore.ActivityCenterGroup.Transactions, visible: false, enabled: true },
|
|
|
|
{ text: qsTr("Membership"), group: ActivityCenterStore.ActivityCenterGroup.Membership, visible: true, enabled: root.hasMembership },
|
|
|
|
{ text: qsTr("System"), group: ActivityCenterStore.ActivityCenterGroup.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
|
2023-02-21 16:11:44 +00:00
|
|
|
highlighted: modelData.group === root.activeGroup
|
|
|
|
onClicked: root.groupTriggered(modelData.group)
|
2023-02-23 11:09:05 +00:00
|
|
|
onEnabledChanged: if (!enabled && highlighted) root.groupTriggered(ActivityCenterStore.ActivityCenterGroup.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
|
|
|
}
|