2023-10-02 12:06:35 -04:00
|
|
|
import { App, Notifications, Widget } from '../../imports.js';
|
|
|
|
const { Box, Label, Icon } = Widget;
|
|
|
|
const { toggleWindow } = App;
|
2023-09-05 15:10:25 -04:00
|
|
|
|
2023-09-11 19:57:21 -04:00
|
|
|
import { Separator } from '../misc/separator.js';
|
|
|
|
import { EventBox } from '../misc/cursorbox.js';
|
2023-09-10 23:24:58 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-09-11 14:38:24 -04:00
|
|
|
export const NotifButton = EventBox({
|
|
|
|
className: 'toggle-off',
|
2023-09-12 09:37:48 -04:00
|
|
|
onPrimaryClickRelease: () => toggleWindow('notification-center'),
|
|
|
|
connections: [
|
2023-10-02 12:06:35 -04:00
|
|
|
[App, (box, windowName, visible) => {
|
2023-09-12 09:37:48 -04:00
|
|
|
if (windowName == 'notification-center') {
|
2023-09-21 20:01:14 -04:00
|
|
|
box.toggleClassName('toggle-on', visible);
|
2023-09-12 09:37:48 -04:00
|
|
|
}
|
|
|
|
}],
|
|
|
|
],
|
2023-09-05 15:10:25 -04:00
|
|
|
child: Box({
|
|
|
|
className: 'notif-panel',
|
|
|
|
vertical: false,
|
2023-09-11 14:38:24 -04:00
|
|
|
children: [
|
|
|
|
Separator(28),
|
|
|
|
|
|
|
|
Icon({
|
|
|
|
connections: [
|
|
|
|
[Notifications, icon => {
|
2023-09-12 18:00:19 -04:00
|
|
|
if (Notifications.dnd) {
|
|
|
|
icon.icon = 'notification-disabled-symbolic'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (Notifications.notifications.length > 0) {
|
|
|
|
icon.icon = 'notification-new-symbolic'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
icon.icon = 'notification-symbolic'
|
|
|
|
}
|
|
|
|
}
|
2023-09-11 14:38:24 -04:00
|
|
|
}],
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
|
|
|
|
Separator(8),
|
|
|
|
|
|
|
|
Label({
|
|
|
|
connections: [
|
|
|
|
[Notifications, label => {
|
|
|
|
label.label = String(Notifications.notifications.length);
|
|
|
|
}],
|
2023-10-02 12:06:35 -04:00
|
|
|
],
|
2023-09-11 14:38:24 -04:00
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
2023-09-05 15:10:25 -04:00
|
|
|
}),
|
|
|
|
});
|