Simplify notification badges, improve performance (#57)

Co-authored-by: Jon Staab <shtaab@gmail.com>
This commit is contained in:
hodlbod
2026-02-09 11:44:32 -08:00
committed by GitHub
parent 8f73fb85e9
commit c4f2f55617
19 changed files with 91 additions and 258 deletions
-7
View File
@@ -1,6 +1,4 @@
<script lang="ts">
import {page} from "$app/stores"
import {onDestroy} from "svelte"
import InfoCircle from "@assets/icons/info-circle.svg?dataurl"
import Magnifier from "@assets/icons/magnifier.svg?dataurl"
import MenuDots from "@assets/icons/menu-dots.svg?dataurl"
@@ -13,7 +11,6 @@
import ChatMenu from "@app/components/ChatMenu.svelte"
import {chatSearch} from "@app/core/state"
import {pushModal} from "@app/util/modal"
import {setChecked} from "@app/util/notifications"
let term = $state("")
@@ -22,10 +19,6 @@
const openMenu = () => pushModal(ChatMenu)
const chats = $derived($chatSearch.searchOptions(term))
onDestroy(() => {
setChecked($page.url.pathname)
})
</script>
<div class="hidden min-h-screen md:hero">
-8
View File
@@ -4,18 +4,10 @@
import {append, uniq} from "@welshman/lib"
import {pubkey} from "@welshman/app"
import Chat from "@app/components/Chat.svelte"
import {notifications, setChecked} from "@app/util/notifications"
import {splitChatId} from "@app/core/state"
const {chat} = $page.params as MakeNonOptional<typeof $page.params>
const pubkeys = uniq(append($pubkey!, splitChatId(chat)))
// We have to watch this one, since on mobile the badge will be visible when active
$effect(() => {
if ($notifications.has($page.url.pathname)) {
setChecked($page.url.pathname)
}
})
</script>
<Chat {pubkeys} />