Skip to content

Commit ef62ffb

Browse files
committed
refactor(ActivityNotificationXX): Refactor notifications layout and improve storybook integration
- Adjusted text sizes for better readability across devices. - Refined all notification delegate's layout for consistency. - Enhanced `Storybook` example with interactive controls for improved component testing.
1 parent 62ece48 commit ef62ffb

File tree

53 files changed

+2383
-1113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2383
-1113
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
import QtQml
5+
6+
ColumnLayout {
7+
id: root
8+
9+
spacing: 8
10+
width: parent.width
11+
12+
property bool showBaseEditorFields: true
13+
14+
property QtObject notificationBaseMock: QtObject {
15+
property string id: "notificationID-111"
16+
property int notificationType: 0
17+
property string communityId: "communityID-222"
18+
property double previousTimestamp: 0
19+
readonly property string title: title.text
20+
readonly property string description: desc.text
21+
readonly property double timestamp: timestamp.text
22+
readonly property bool read: read.checked
23+
readonly property bool dismissed: dismissed.checked
24+
readonly property bool accepted: accepted.checked
25+
}
26+
27+
Label {
28+
Layout.fillWidth: true
29+
Layout.topMargin: 8
30+
31+
visible: root.showBaseEditorFields
32+
text: "Title:"
33+
font.weight: Font.Bold
34+
}
35+
36+
TextField {
37+
id: title
38+
Layout.fillWidth: true
39+
40+
visible: root.showBaseEditorFields
41+
text: "Some title"
42+
}
43+
44+
Label {
45+
Layout.topMargin: 8
46+
Layout.fillWidth: true
47+
48+
visible: root.showBaseEditorFields
49+
text: "Description:"
50+
font.weight: Font.Bold
51+
}
52+
53+
TextField {
54+
id: desc
55+
Layout.fillWidth: true
56+
57+
visible: root.showBaseEditorFields
58+
text: "Some notification description"
59+
}
60+
61+
Label {
62+
Layout.topMargin: 8
63+
Layout.fillWidth: true
64+
text: "Timestamp:"
65+
font.weight: Font.Bold
66+
}
67+
68+
TextField {
69+
id: timestamp
70+
Layout.fillWidth: true
71+
text: Date.now()
72+
}
73+
74+
Label {
75+
Layout.topMargin: 8
76+
Layout.fillWidth: true
77+
text: "Notification Status:"
78+
font.weight: Font.Bold
79+
}
80+
81+
ButtonGroup { id: read_dismissed_accepted }
82+
83+
RadioButton {
84+
id: read
85+
Layout.fillWidth: true
86+
text: "Read"
87+
}
88+
89+
RadioButton {
90+
id: dismissed
91+
Layout.fillWidth: true
92+
text: "Dismissed"
93+
checked: true
94+
}
95+
96+
RadioButton {
97+
id: accepted
98+
Layout.fillWidth: true
99+
text: "Accepted"
100+
}
101+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import Storybook
6+
7+
import utils
8+
9+
SplitView {
10+
id: root
11+
12+
property alias activityNotificationComponent: notificationLoader.sourceComponent
13+
property alias additionalEditorComponent: additionalEditorLoader.sourceComponent
14+
15+
property bool showBaseEditorFields: true
16+
required property bool communityEditorActive
17+
required property bool contactEditorActive
18+
19+
readonly property var baseEditor: baseEditor
20+
readonly property var communityEditor: communityEditorLoader.item
21+
readonly property var conntactEditor: contactEditorLoader.item
22+
readonly property alias logs: logsInternal
23+
24+
readonly property int leftPanelMaxWidth: 308 // It fits on mobile / portrait + desktop left panel
25+
26+
SplitView {
27+
orientation: Qt.Vertical
28+
SplitView.fillWidth: true
29+
30+
Logs { id: logsInternal }
31+
32+
Item {
33+
SplitView.fillHeight: true
34+
SplitView.fillWidth: true
35+
Loader {
36+
id: notificationLoader
37+
anchors.centerIn: parent
38+
width: root.leftPanelMaxWidth
39+
}
40+
}
41+
42+
LogsAndControlsPanel {
43+
SplitView.minimumHeight: 100
44+
SplitView.preferredHeight: 160
45+
46+
logsView.logText: logs.logText
47+
}
48+
49+
}
50+
51+
Pane {
52+
SplitView.minimumWidth: 300
53+
SplitView.preferredWidth: 300
54+
55+
ActivityNotificationBaseEditor {
56+
id: baseEditor
57+
58+
showBaseEditorFields: root.showBaseEditorFields
59+
60+
Loader {
61+
id: contactEditorLoader
62+
active: root.contactEditorActive
63+
sourceComponent: contactEditorComponent
64+
}
65+
66+
Loader {
67+
id: communityEditorLoader
68+
active: root.communityEditorActive
69+
sourceComponent: communityEditorComponent
70+
}
71+
72+
Loader {
73+
id: additionalEditorLoader
74+
}
75+
}
76+
}
77+
78+
Component {
79+
id: communityEditorComponent
80+
81+
ActivityNotificationCommunityEditor {
82+
id: communityEditor
83+
}
84+
}
85+
86+
Component {
87+
id: contactEditorComponent
88+
89+
ActivityNotificationContactEditor {
90+
id: contactEditor
91+
}
92+
}
93+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import StatusQ.Core.Theme
6+
7+
import AppLayouts.ActivityCenter.views
8+
9+
import Storybook
10+
11+
ActivityNotificationBaseLayout {
12+
id: root
13+
14+
property bool isBanned: true
15+
16+
showBaseEditorFields: false
17+
communityEditorActive: true
18+
contactEditorActive: false
19+
activityNotificationComponent: ActivityNotificationCommunityBanUnban {
20+
notification: baseEditor.notificationBaseMock
21+
community: communityEditor.communityMock
22+
banned: root.isBanned
23+
24+
onSetActiveCommunity: (communityId) =>
25+
logs.logEvent("ActivityNotificationCommunityBanUnban::onSetActiveCommunity - " + communityId)
26+
}
27+
28+
additionalEditorComponent: ColumnLayout {
29+
Switch {
30+
id: isBannedSwitch
31+
checked: root.isBanned
32+
text: "Is banned?"
33+
onCheckedChanged: root.isBanned = checked
34+
}
35+
}
36+
}
37+
// category: Activity Center
38+
// status: good
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
import QtQml
5+
6+
import Models
7+
8+
9+
ColumnLayout {
10+
spacing: 8
11+
width: parent.width
12+
13+
property QtObject communityMock: QtObject {
14+
readonly property string name: communityName.text
15+
readonly property string image: communityImage.checked ? "" : ModelsData.banners.status
16+
readonly property string color: communityColor.checked ? "pink" : "green"
17+
}
18+
19+
Label {
20+
Layout.fillWidth: true
21+
Layout.topMargin: 8
22+
text: "Community name"
23+
font.weight: Font.Bold
24+
}
25+
26+
TextField {
27+
Layout.fillWidth: true
28+
id: communityName
29+
text: "Status CCs"
30+
}
31+
32+
Label {
33+
Layout.fillWidth: true
34+
Layout.topMargin: 8
35+
text: "Community image"
36+
font.weight: Font.Bold
37+
}
38+
39+
Switch {
40+
id: communityImage
41+
text: "Image or Text"
42+
}
43+
44+
Label {
45+
Layout.fillWidth: true
46+
Layout.topMargin: 8
47+
text: "Community color"
48+
font.weight: Font.Bold
49+
}
50+
51+
Switch {
52+
id: communityColor
53+
text: "Green or Pink"
54+
}
55+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import StatusQ.Core.Theme
6+
7+
import AppLayouts.ActivityCenter.views
8+
9+
import Storybook
10+
11+
ActivityNotificationBaseLayout {
12+
id: root
13+
14+
communityEditorActive: true
15+
contactEditorActive: true
16+
activityNotificationComponent: ActivityNotificationCommunityInvitation {
17+
community: communityEditor.communityMock
18+
contactDetails: conntactEditor.contactDetailsMock
19+
notification: QtObject {
20+
readonly property string id: baseEditor.notificationBaseMock.id
21+
readonly property string author: baseEditor.notificationBaseMock.title
22+
readonly property string chatId: baseEditor.notificationBaseMock.id
23+
readonly property string sectionId: "sectionId-123"
24+
readonly property bool read: baseEditor.notificationBaseMock.read
25+
readonly property bool dismissed: baseEditor.notificationBaseMock.dismissed
26+
readonly property bool accepted: baseEditor.notificationBaseMock.accepted
27+
property double timestamp: baseEditor.notificationBaseMock.timestamp
28+
property QtObject message: QtObject {
29+
readonly property string communityId: "communityId-222"
30+
readonly property string id: "messageID-aaa"
31+
readonly property string messageText: baseEditor.notificationBaseMock.description
32+
}
33+
}
34+
35+
onSetActiveCommunityRequested: (communityId) =>
36+
logs.logEvent("ActivityNotificationCommunityInvitation::onSetActiveCommunityRequested - " + communityId)
37+
onSwitchToRequested: (sectionId, chatId, messageId) =>
38+
logs.logEvent("ActivityNotificationCommunityInvitation::onSwitchToRequested",
39+
["sectionId", "chatId", "messageId"],
40+
[sectionId, chatId, messageId])
41+
onOpenProfilePopup: (contactId) =>
42+
logs.logEvent("ActivityNotificationCommunityInvitation::onOpenProfilePopup - " + contactId)
43+
}
44+
}
45+
// category: Activity Center
46+
// status: good
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Layouts
4+
5+
import StatusQ.Core.Theme
6+
7+
import AppLayouts.ActivityCenter.views
8+
9+
import Storybook
10+
11+
ActivityNotificationBaseLayout {
12+
id: root
13+
14+
communityEditorActive: true
15+
contactEditorActive: false
16+
activityNotificationComponent: ActivityNotificationCommunityKicked {
17+
community: communityEditor.communityMock
18+
notification: baseEditor.notificationBaseMock
19+
20+
onSetActiveCommunity: (communityId) =>
21+
logs.logEvent("ActivityNotificationCommunityKicked::onSetActiveCommunityRequested - " + communityId)
22+
}
23+
}
24+
// category: Activity Center
25+
// status: good

0 commit comments

Comments
 (0)