2023-09-11 14:38:24 -04:00
|
|
|
const { Box, Label, Icon } = ags.Widget;
|
|
|
|
const { openWindow, closeWindow } = ags.App;
|
|
|
|
const { Notifications } = ags.Service;
|
2023-09-05 15:10:25 -04:00
|
|
|
|
2023-09-11 14:38:24 -04:00
|
|
|
import { EventBox, Separator } from '../common.js';
|
2023-09-10 23:24:58 -04:00
|
|
|
|
2023-09-11 14:38:24 -04:00
|
|
|
var notifButtonState = false;
|
|
|
|
|
|
|
|
export const NotifButton = EventBox({
|
|
|
|
className: 'toggle-off',
|
|
|
|
onPrimaryClickRelease: () => {
|
|
|
|
if (notifButtonState) {
|
2023-09-05 15:10:25 -04:00
|
|
|
NotifButton.toggleClassName('toggle-on', false);
|
2023-09-11 14:38:24 -04:00
|
|
|
closeWindow('notification-center');
|
|
|
|
notifButtonState = false;
|
|
|
|
}
|
|
|
|
else {
|
2023-09-05 15:10:25 -04:00
|
|
|
NotifButton.toggleClassName('toggle-on', true);
|
2023-09-11 14:38:24 -04:00
|
|
|
openWindow('notification-center');
|
|
|
|
notifButtonState = true;
|
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-11 16:25:57 -04:00
|
|
|
// TODO: add no notifs vs notifs
|
2023-09-11 14:38:24 -04:00
|
|
|
icon.icon = Notifications.dnd
|
|
|
|
? 'notifications-disabled-symbolic'
|
|
|
|
: 'preferences-system-notifications-symbolic';
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
|
|
|
|
Separator(8),
|
|
|
|
|
|
|
|
Label({
|
|
|
|
connections: [
|
|
|
|
[Notifications, label => {
|
|
|
|
label.label = String(Notifications.notifications.length);
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
2023-09-05 15:10:25 -04:00
|
|
|
}),
|
|
|
|
});
|