Feature: Node favourites (and ignores) (#618)

* Add favourite icon to node Avatar

* Favourites WIP

* Save isFavorite and isIgnored to device

* Fix spelling

* Clean up

* Always sort favorites first

* Add unread count to "Messages" top level menu

* Renaming, UI tweaks

* Add hook tests

* Handle undefined node better
This commit is contained in:
philon-
2025-05-13 08:45:24 -04:00
committed by GitHub
parent b2bb3baa01
commit 513a285fee
15 changed files with 699 additions and 256 deletions
+6 -1
View File
@@ -60,7 +60,11 @@ export const MessagesPage = () => {
...node,
unreadCount: unreadCounts.get(node.num) ?? 0,
}))
.sort((a, b) => b.unreadCount - a.unreadCount);
.sort((a, b) => {
const diff = b.unreadCount - a.unreadCount;
if (diff !== 0) return diff;
return Number(b.isFavorite) - Number(a.isFavorite);
});
};
const allChannels = Array.from(channels.values());
@@ -239,6 +243,7 @@ export const MessagesPage = () => {
text={node.user?.shortName ?? "UNK"}
className={cn(hasNodeError(node.num) && "text-red-500")}
showError={hasNodeError(node.num)}
showFavorite={node.isFavorite}
size="sm"
/>
</SidebarButton>