Simplify and optimize notifications

This commit is contained in:
Jon Staab
2024-12-16 11:24:10 -08:00
parent 85e5413951
commit 3d3ffaf406
12 changed files with 120 additions and 151 deletions
+2 -6
View File
@@ -1,11 +1,10 @@
<script lang="ts">
import {readable} from "svelte/store"
import Icon from "@lib/components/Icon.svelte"
import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte"
import ChannelName from "@app/components/ChannelName.svelte"
import {makeSpacePath} from "@app/routes"
import {deriveChannel, channelIsLocked} from "@app/state"
import {deriveNotification, getRoomFilters} from "@app/notifications"
import {notifications} from "@app/notifications"
export let url
export let room
@@ -13,12 +12,9 @@
const path = makeSpacePath(url, room)
const channel = deriveChannel(url, room)
const notification = notify
? deriveNotification(path, getRoomFilters(room), url)
: readable(false)
</script>
<SecondaryNavItem href={path} notification={$notification}>
<SecondaryNavItem href={path} notification={notify ? $notifications.has(path) : false}>
{#if channelIsLocked($channel)}
<Icon icon="lock" size={4} />
{:else}