feature: remove delay when clearing all notifications (#342)

* feat: add setting option to control delay

* Update widget/settings/pages/config/notifications/index.ts

* Update widget/settings/pages/config/notifications/index.ts

* Update widget/settings/pages/config/notifications/index.ts

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
Rubin Bhandari
2024-10-21 14:35:49 +05:45
committed by GitHub
parent 604f737182
commit 3bc8c0d2e1
4 changed files with 23 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
import { closeNotifications } from 'globals/notification';
import { BoxWidget } from 'lib/types/widget';
import { Notifications } from 'types/service/notifications';
import options from 'options';
const { clearDelay } = options.notifications;
const Controls = (notifs: Notifications): BoxWidget => {
return Widget.Box({
@@ -44,13 +47,15 @@ const Controls = (notifs: Notifications): BoxWidget => {
Widget.Button({
className: 'clear-notifications-button',
tooltip_text: 'Clear Notifications',
on_primary_click: () => {
if (removingNotifications.value) {
return;
}
on_primary_click: clearDelay.bind('value').as((delay) => {
return () => {
if (removingNotifications.value) {
return;
}
closeNotifications(notifs.notifications);
},
return closeNotifications(notifs.notifications, delay);
};
}),
child: Widget.Label({
class_name: removingNotifications.bind('value').as((removing: boolean) => {
return removing