* Implemented strict linting standards and prettier formatting config. * More linter fixes and type updates. * More linter updates and type fixes * Remove noisy comments * Linter and type updates * Linter, formatting and type updates. * Linter updates * Type updates * Type updates * fixed all linter errors * Fixed all linting, formatting and type issues. * Resolve merge conflicts.
72 lines
2.8 KiB
TypeScript
72 lines
2.8 KiB
TypeScript
import { closeNotifications } from 'globals/notification';
|
|
import { BoxWidget } from 'lib/types/widget';
|
|
import { Notifications } from 'types/service/notifications';
|
|
|
|
const Controls = (notifs: Notifications): BoxWidget => {
|
|
return Widget.Box({
|
|
class_name: 'notification-menu-controls',
|
|
expand: false,
|
|
vertical: false,
|
|
children: [
|
|
Widget.Box({
|
|
class_name: 'menu-label-container notifications',
|
|
hpack: 'start',
|
|
vpack: 'center',
|
|
expand: true,
|
|
children: [
|
|
Widget.Label({
|
|
class_name: 'menu-label notifications',
|
|
label: 'Notifications',
|
|
}),
|
|
],
|
|
}),
|
|
Widget.Box({
|
|
hpack: 'end',
|
|
vpack: 'center',
|
|
expand: false,
|
|
children: [
|
|
Widget.Switch({
|
|
class_name: 'menu-switch notifications',
|
|
vpack: 'center',
|
|
active: notifs.bind('dnd').as((dnd: boolean) => !dnd),
|
|
on_activate: ({ active }) => {
|
|
notifs.dnd = !active;
|
|
},
|
|
}),
|
|
Widget.Box({
|
|
children: [
|
|
Widget.Separator({
|
|
hpack: 'center',
|
|
vexpand: true,
|
|
vertical: true,
|
|
class_name: 'menu-separator notification-controls',
|
|
}),
|
|
Widget.Button({
|
|
className: 'clear-notifications-button',
|
|
tooltip_text: 'Clear Notifications',
|
|
on_primary_click: () => {
|
|
if (removingNotifications.value) {
|
|
return;
|
|
}
|
|
|
|
closeNotifications(notifs.notifications);
|
|
},
|
|
child: Widget.Label({
|
|
class_name: removingNotifications.bind('value').as((removing: boolean) => {
|
|
return removing
|
|
? 'clear-notifications-label txt-icon removing'
|
|
: 'clear-notifications-label txt-icon';
|
|
}),
|
|
label: '',
|
|
}),
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
});
|
|
};
|
|
|
|
export { Controls };
|