Skip to content

Commit 7682968

Browse files
committed
feat: add empty state for notification center
1. Added "No recent notifications" message when notification center is empty 2. Created reusable DropShadowText component for consistent text styling 3. Added viewCount properties to track notification counts 4. Updated translation files for new empty state message 5. Improved header text styling by using DropShadowText component The changes provide better user feedback when there are no notifications and improve text consistency across the notification center. The empty state message helps users understand the current state of the application. feat: 为通知中心添加空状态提示 1. 当通知中心为空时添加"没有最近的通知"提示信息 2. 创建可复用的DropShadowText组件实现统一文本样式 3. 添加viewCount属性来跟踪通知数量 4. 更新翻译文件支持新的空状态提示 5. 使用DropShadowText组件改进标题文本样式 这些改动在通知中心为空时提供了更好的用户反馈,并改进了整个通知中心的文本 一致性。空状态提示帮助用户理解应用的当前状态。 Issue: https://bbs.deepin.org/post/289386
1 parent c6c67f4 commit 7682968

26 files changed

+230
-344
lines changed

panels/notification/center/NotifyCenter.qml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import QtQuick
66
import QtQuick.Controls
77
import QtQuick.Layouts
88
import org.deepin.dtk 1.0
9+
import org.deepin.ds.notification
910
import org.deepin.ds.notificationcenter
1011

1112
FocusScope {
@@ -15,6 +16,7 @@ FocusScope {
1516

1617
property alias model: notifyModel
1718
property int maxViewHeight: 400
19+
property int stagingViewCount: 0
1820

1921
NotifyModel {
2022
id: notifyModel
@@ -48,5 +50,16 @@ FocusScope {
4850
height: Math.min(maxViewHeight, viewHeight)
4951
notifyModel: notifyModel
5052
}
53+
54+
DropShadowText {
55+
text: qsTr("No recent notifications")
56+
visible: root.stagingViewCount === 0 && view.viewCount === 0
57+
anchors {
58+
top: header.bottom
59+
topMargin: 10
60+
horizontalCenter: parent.horizontalCenter
61+
}
62+
height: 40
63+
}
5164
}
5265
}

panels/notification/center/NotifyHeaderTitleText.qml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
import QtQuick
66
import Qt5Compat.GraphicalEffects
77
import org.deepin.dtk 1.0
8+
import org.deepin.ds.notification
89
import org.deepin.ds.notificationcenter
910

10-
Text {
11+
DropShadowText {
1112
property font tFont: DTK.fontManager.t4
1213
font {
1314
pixelSize: tFont.pixelSize
1415
family: tFont.family
1516
bold: true
1617
}
17-
color: Qt.rgba(1, 1, 1, 1)
18-
layer.enabled: true
19-
layer.effect: DropShadow {
20-
color: Qt.rgba(0, 0, 0, 0.6)
21-
radius: 4
22-
samples: 9
23-
verticalOffset: 1
24-
}
2518
}

panels/notification/center/NotifyStaging.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ FocusScope {
1414
implicitWidth: 360
1515
implicitHeight: view.height
1616
property var model: notifyModel
17+
readonly property int viewCount: view.count
1718

1819
NotifyStagingModel {
1920
id: notifyModel

panels/notification/center/NotifyView.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Control {
1414

1515
required property NotifyModel notifyModel
1616
readonly property real viewHeight: view.contentHeight
17+
readonly property int viewCount: view.count
1718

1819
NotifySetting {
1920
id: notifySetting

panels/notification/center/package/main.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Window {
128128

129129
implicitWidth: 360
130130
maxViewHeight: root.height
131+
stagingViewCount: notifyStaging.viewCount
131132
}
132133
}
133134
}

panels/notification/center/translations/org.deepin.ds.notificationcenter.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<translation type="unfinished"></translation>
99
</message>
1010
</context>
11+
<context>
12+
<name>NotifyCenter</name>
13+
<message>
14+
<source>No recent notifications</source>
15+
<translation type="unfinished"></translation>
16+
</message>
17+
</context>
1118
<context>
1219
<name>NotifyHeader</name>
1320
<message>
@@ -40,21 +47,5 @@
4047
<source>Just now</source>
4148
<translation type="unfinished"></translation>
4249
</message>
43-
<message>
44-
<source>%1 minutes ago</source>
45-
<translation type="unfinished"></translation>
46-
</message>
47-
<message>
48-
<source>1 hour ago</source>
49-
<translation type="unfinished"></translation>
50-
</message>
51-
<message>
52-
<source>%1 hours ago</source>
53-
<translation type="unfinished"></translation>
54-
</message>
55-
<message>
56-
<source>Yesterday </source>
57-
<translation type="unfinished"></translation>
58-
</message>
5950
</context>
6051
</TS>

panels/notification/center/translations/org.deepin.ds.notificationcenter_az.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="az">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1" language="az">
24
<context>
35
<name>GroupNotify</name>
46
<message>
57
<source>Clear All</source>
68
<translation>مسح الكل</translation>
79
</message>
810
</context>
11+
<context>
12+
<name>NotifyCenter</name>
13+
<message>
14+
<source>No recent notifications</source>
15+
<translation type="unfinished"></translation>
16+
</message>
17+
</context>
918
<context>
1019
<name>NotifyHeader</name>
1120
<message>
@@ -38,21 +47,5 @@
3847
<source>Just now</source>
3948
<translation>الآن</translation>
4049
</message>
41-
<message>
42-
<source>%1 minutes ago</source>
43-
<translation>%1 دقيقة مضت</translation>
44-
</message>
45-
<message>
46-
<source>1 hour ago</source>
47-
<translation type="unfinished"/>
48-
</message>
49-
<message>
50-
<source>%1 hours ago</source>
51-
<translation>%1 ساعة مضت</translation>
52-
</message>
53-
<message>
54-
<source>Yesterday </source>
55-
<translation>أمس </translation>
56-
</message>
5750
</context>
58-
</TS>
51+
</TS>

panels/notification/center/translations/org.deepin.ds.notificationcenter_bo.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<translation type="unfinished"></translation>
99
</message>
1010
</context>
11+
<context>
12+
<name>NotifyCenter</name>
13+
<message>
14+
<source>No recent notifications</source>
15+
<translation type="unfinished"></translation>
16+
</message>
17+
</context>
1118
<context>
1219
<name>NotifyHeader</name>
1320
<message>
@@ -40,21 +47,5 @@
4047
<source>Just now</source>
4148
<translation type="unfinished"></translation>
4249
</message>
43-
<message>
44-
<source>%1 minutes ago</source>
45-
<translation type="unfinished"></translation>
46-
</message>
47-
<message>
48-
<source>1 hour ago</source>
49-
<translation type="unfinished"></translation>
50-
</message>
51-
<message>
52-
<source>%1 hours ago</source>
53-
<translation type="unfinished"></translation>
54-
</message>
55-
<message>
56-
<source>Yesterday </source>
57-
<translation type="unfinished"></translation>
58-
</message>
5950
</context>
6051
</TS>

panels/notification/center/translations/org.deepin.ds.notificationcenter_ca.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ca">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1" language="ca">
24
<context>
35
<name>GroupNotify</name>
46
<message>
57
<source>Clear All</source>
68
<translation>Neteja-ho tot</translation>
79
</message>
810
</context>
11+
<context>
12+
<name>NotifyCenter</name>
13+
<message>
14+
<source>No recent notifications</source>
15+
<translation type="unfinished"></translation>
16+
</message>
17+
</context>
918
<context>
1019
<name>NotifyHeader</name>
1120
<message>
@@ -38,21 +47,5 @@
3847
<source>Just now</source>
3948
<translation>Ara mateix</translation>
4049
</message>
41-
<message>
42-
<source>%1 minutes ago</source>
43-
<translation>Fa %1 minuts</translation>
44-
</message>
45-
<message>
46-
<source>1 hour ago</source>
47-
<translation>Fa 1 hora</translation>
48-
</message>
49-
<message>
50-
<source>%1 hours ago</source>
51-
<translation>Fa %1 hores</translation>
52-
</message>
53-
<message>
54-
<source>Yesterday </source>
55-
<translation>Ahir</translation>
56-
</message>
5750
</context>
58-
</TS>
51+
</TS>

panels/notification/center/translations/org.deepin.ds.notificationcenter_es.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="es">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1" language="es">
24
<context>
35
<name>GroupNotify</name>
46
<message>
57
<source>Clear All</source>
68
<translation>Limpiar todo</translation>
79
</message>
810
</context>
11+
<context>
12+
<name>NotifyCenter</name>
13+
<message>
14+
<source>No recent notifications</source>
15+
<translation type="unfinished"></translation>
16+
</message>
17+
</context>
918
<context>
1019
<name>NotifyHeader</name>
1120
<message>
@@ -38,21 +47,5 @@
3847
<source>Just now</source>
3948
<translation>Ahora mismo</translation>
4049
</message>
41-
<message>
42-
<source>%1 minutes ago</source>
43-
<translation>Hace %1 minutos</translation>
44-
</message>
45-
<message>
46-
<source>1 hour ago</source>
47-
<translation>Hace una hora</translation>
48-
</message>
49-
<message>
50-
<source>%1 hours ago</source>
51-
<translation>Hace %1 horas</translation>
52-
</message>
53-
<message>
54-
<source>Yesterday </source>
55-
<translation>Ayer </translation>
56-
</message>
5750
</context>
58-
</TS>
51+
</TS>

0 commit comments

Comments
 (0)