Add error notifications for network menu.
This commit is contained in:
@@ -82,8 +82,13 @@ export default () => {
|
||||
vertical: true,
|
||||
setup: (self) => {
|
||||
self.hook(notifs, () => {
|
||||
console.log(JSON.stringify(notifs, null, 2));
|
||||
|
||||
const notifHasImg = (notif) => {
|
||||
return notif.image !== undefined && notif.image.length;
|
||||
};
|
||||
const imageContainer = (notif) => {
|
||||
if (notif.image !== undefined) {
|
||||
if (notifHasImg(notif)) {
|
||||
return [
|
||||
Widget.Box({
|
||||
class_name: "notification-card-image-container menu",
|
||||
@@ -138,7 +143,9 @@ export default () => {
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
return [Widget.Box({
|
||||
class_name: "spacer"
|
||||
})];
|
||||
};
|
||||
|
||||
const NotificationIcon = ({
|
||||
@@ -208,7 +215,7 @@ export default () => {
|
||||
vpack: "center",
|
||||
vertical: true,
|
||||
hexpand: true,
|
||||
class_name: `notification-card-content ${notif.image === undefined ? "noimg" : " menu"}`,
|
||||
class_name: `notification-card-content ${!notifHasImg(notif) ? "noimg" : " menu"}`,
|
||||
children: [
|
||||
Widget.Box({
|
||||
vertical: false,
|
||||
@@ -226,8 +233,9 @@ export default () => {
|
||||
hpack: "start",
|
||||
hexpand: true,
|
||||
vexpand: true,
|
||||
max_width_chars:
|
||||
notif.image === undefined ? 27 : 20,
|
||||
max_width_chars: !notifHasImg(notif)
|
||||
? 27
|
||||
: 20,
|
||||
truncate: "end",
|
||||
wrap: true,
|
||||
label: notif["summary"],
|
||||
@@ -255,8 +263,9 @@ export default () => {
|
||||
justification: "left",
|
||||
truncate: "end",
|
||||
lines: 2,
|
||||
max_width_chars:
|
||||
notif.image === undefined ? 35 : 28,
|
||||
max_width_chars: !notifHasImg(notif)
|
||||
? 35
|
||||
: 28,
|
||||
wrap: true,
|
||||
class_name:
|
||||
"notification-card-body-label menu",
|
||||
|
||||
Reference in New Issue
Block a user