Add "new" badge and title
This commit is contained in:
parent
3a76e4733c
commit
1d2f3f72e4
5 changed files with 42 additions and 10 deletions
|
@ -46,6 +46,7 @@ const Root = () => {
|
|||
const users = useLiveQuery(() => userManager.all());
|
||||
const subscriptions = useLiveQuery(() => subscriptionManager.all());
|
||||
const selectedSubscription = findSelected(location, subscriptions);
|
||||
const newNotificationsCount = subscriptions?.reduce((prev, cur) => prev + cur.new, 0) || 0;
|
||||
|
||||
useWorkers();
|
||||
useConnectionListeners();
|
||||
|
@ -54,6 +55,11 @@ const Root = () => {
|
|||
connectionManager.refresh(subscriptions, users);
|
||||
}, [subscriptions, users]); // Dangle!
|
||||
|
||||
useEffect(() => {
|
||||
console.log(`hello ${newNotificationsCount}`)
|
||||
document.title = (newNotificationsCount > 0) ? `(${newNotificationsCount}) ntfy web` : "ntfy web";
|
||||
}, [newNotificationsCount]);
|
||||
|
||||
return (
|
||||
<Box sx={{display: 'flex'}}>
|
||||
<CssBaseline/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue