Fix badges on muted rooms

This commit is contained in:
Jon Staab 2026-09-08 07:57:30 -07:00
parent 95621c936d
commit 5639380380

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import Bell from "@assets/icons/bell.svg?dataurl"
import BellOff from "@assets/icons/bell-off.svg?dataurl" import BellOff from "@assets/icons/bell-off.svg?dataurl"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte" import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte"
@ -7,7 +6,7 @@
import VoiceRoomItem from "@app/components/VoiceRoomItem.svelte" import VoiceRoomItem from "@app/components/VoiceRoomItem.svelte"
import {rooms} from "@app/core" import {rooms} from "@app/core"
import {RoomType, getRoomType} from "@app/rooms" import {RoomType, getRoomType} from "@app/rooms"
import {deriveShouldNotify} from "@app/settings" import {deriveIsMuted} from "@app/settings"
import {notifications} from "@app/notifications" import {notifications} from "@app/notifications"
import {makeRoomPath} from "@app/routes" import {makeRoomPath} from "@app/routes"
@ -23,9 +22,7 @@
const room = $rooms.forRoom(url, h) const room = $rooms.forRoom(url, h)
const roomType = $derived(getRoomType($room)) const roomType = $derived(getRoomType($room))
const path = makeRoomPath(url, h) const path = makeRoomPath(url, h)
const shouldNotifyForSpace = deriveShouldNotify(url) const isMuted = deriveIsMuted(url, h)
const shouldNotifyForRoom = deriveShouldNotify(url, h)
const showDifferenceIcon = $derived($shouldNotifyForRoom !== $shouldNotifyForSpace)
const notification = $derived($notifications.has(path)) const notification = $derived($notifications.has(path))
const roomName = $derived($room?.meta?.name() || h) const roomName = $derived($room?.meta?.name() || h)
</script> </script>
@ -35,8 +32,8 @@
{:else} {:else}
<SecondaryNavItem href={path} title={tooltip ? roomName : ""} {replaceState} {notification}> <SecondaryNavItem href={path} title={tooltip ? roomName : ""} {replaceState} {notification}>
<RoomNameWithImage {url} {h} /> <RoomNameWithImage {url} {h} />
{#if showDifferenceIcon} {#if $isMuted}
<Icon icon={$shouldNotifyForRoom ? Bell : BellOff} size={4} class="ml-auto opacity-50" /> <Icon icon={BellOff} size={4} class="ml-auto opacity-50" />
{/if} {/if}
</SecondaryNavItem> </SecondaryNavItem>
{/if} {/if}