grid: fix notification ordering

This commit is contained in:
Liam Fitzgerald 2021-09-09 13:04:37 +10:00
parent f2e1e2fe93
commit ea47640344
3 changed files with 15 additions and 3 deletions

View File

@ -34,7 +34,7 @@ export const BasicNotification = ({ notification, unread = false }: BasicNotific
const charge = useCharge(desk);
const first = notification.body?.[0];
if (!first) {
if (!first || !charge) {
return null;
}
const contents = map(notification.body, 'content').filter((c) => c.length > 0);

View File

@ -19,7 +19,7 @@ export const RuntimeLagNotification = () => (
<header id="system-updates-blocked" className="relative -left-8 space-y-2">
<div className="flex space-x-2">
<span className="inline-block w-6 h-6 bg-orange-500 rounded-full" />
<span className="font-medium">Landscape</span>
<span className="font-medium">Grid</span>
</div>
<div className="flex space-x-2">
<Elbow className="w-6 h-6 text-gray-300" />

View File

@ -63,7 +63,7 @@ function reduceHark(u: any) {
set((state) => {
state.unreads = state.unreads.filter((unread) => !harkBinEq(unread.bin, u.added.bin));
state.unreads.push(u.added);
state.unreads.unshift(u.added);
});
} else if ('timebox' in u) {
const { timebox } = u;
@ -78,6 +78,18 @@ function reduceHark(u: any) {
state.unreads = [...state.unreads, ...notifications];
});
}
} else if ('archive' in u) {
console.log(u.archive);
set((state) => {
const time = u.archive?.time;
if (time) {
let box = state.reads.get(makePatDa(time)) || [];
box = box.filter((n) => !harkBinEq(u.archive.bin, n.bin));
state.reads = state.reads.set(makePatDa(time), box);
} else {
state.unreads = state.unreads.filter((n) => !harkBinEq(u.archive.bin, n.bin));
}
});
}
}