updates
This commit is contained in:
1 parent
8b0cde6e86
commit
0389156702
10 files changed
+281
-120
No files matched your search
@@ -9,28 +9,62 @@ type NotificationsBoxType = {
|
||||
include?: string[];
|
||||
};
|
||||
|
||||
const NotificationNoReveal = (notification: NotificationType, visible = false, dismiss = true) => {
|
||||
const _notification = Notification(notification, dismiss);
|
||||
|
||||
const destroyWithAnims = () => {
|
||||
box.destroy();
|
||||
};
|
||||
|
||||
let box: Box<any, { destroyWithAnims: any; count: number; id: number }> = Widget.Box({
|
||||
const NotificationReveal = (notification: NotificationType, visible = false, dismiss = true) => {
|
||||
const transition_duration = 200;
|
||||
const secondRevealer = Widget.Revealer({
|
||||
vpack: "center",
|
||||
child: Notification(notification, dismiss),
|
||||
reveal_child: visible,
|
||||
transition: "crossfade",
|
||||
transition_duration: transition_duration,
|
||||
hexpand: true,
|
||||
attribute: {
|
||||
destroyWithAnims,
|
||||
count: 0,
|
||||
id: notification.id,
|
||||
},
|
||||
children: [_notification],
|
||||
class_name: "second_revealer",
|
||||
setup: (revealer) => {
|
||||
Utils.timeout(1, () => {
|
||||
revealer.reveal_child = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const firstRevealer = Widget.Revealer({
|
||||
child: secondRevealer,
|
||||
reveal_child: true,
|
||||
transition: "slide_down",
|
||||
transition_duration: transition_duration,
|
||||
class_name: "first_revealer"
|
||||
});
|
||||
|
||||
type BoxAttrs = {
|
||||
destroyWithAnims: any;
|
||||
count: number;
|
||||
id: number;
|
||||
};
|
||||
|
||||
let box: Box<any, BoxAttrs>;
|
||||
|
||||
const destroyWithAnims = () => {
|
||||
secondRevealer.reveal_child = false;
|
||||
Utils.timeout(transition_duration, () => {
|
||||
firstRevealer.reveal_child = false;
|
||||
Utils.timeout(transition_duration, () => {
|
||||
box.destroy();
|
||||
});
|
||||
});
|
||||
};
|
||||
box = Widget.Box({
|
||||
hexpand: true,
|
||||
attribute: {
|
||||
destroyWithAnims: destroyWithAnims,
|
||||
count: 0,
|
||||
id: notification.id
|
||||
},
|
||||
children: [firstRevealer]
|
||||
});
|
||||
return box;
|
||||
};
|
||||
|
||||
export function NotificationsBox({ exclude = [], include = [] }: NotificationsBoxType) {
|
||||
const popups = NotificationPopups(false, { exclude, include }, false, NotificationNoReveal);
|
||||
const popups = NotificationPopups(false, { exclude: exclude, include: include }, false, NotificationReveal);
|
||||
|
||||
const menu = Widget.Menu({
|
||||
class_name: "notifications_menu",
|
||||
@@ -38,19 +72,19 @@ export function NotificationsBox({ exclude = [], include = [] }: NotificationsBo
|
||||
Widget.MenuItem({
|
||||
child: Widget.Label({
|
||||
label: "Close all",
|
||||
hpack: "start",
|
||||
hpack: "start"
|
||||
}),
|
||||
class_name: "notifications_menu_item",
|
||||
on_activate: () => {
|
||||
notifications.notifications.forEach((n) => {
|
||||
for (let n of notifications.notifications) {
|
||||
if (n) {
|
||||
n.dismiss();
|
||||
n.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
}),
|
||||
],
|
||||
}
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
return Widget.EventBox({
|
||||
@@ -63,7 +97,7 @@ export function NotificationsBox({ exclude = [], include = [] }: NotificationsBo
|
||||
class_name: "notifications_sidebar_scrollable",
|
||||
hscroll: "never",
|
||||
child: popups,
|
||||
hexpand: true,
|
||||
}),
|
||||
hexpand: true
|
||||
})
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user