2024-11-14 18:53:13 +00:00
|
|
|
<script lang="ts">
|
2026-03-16 20:38:05 +00:00
|
|
|
import Bell from "@assets/icons/bell.svg?dataurl"
|
|
|
|
|
import BellOff from "@assets/icons/bell-off.svg?dataurl"
|
2026-01-22 20:37:30 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2024-11-14 18:53:13 +00:00
|
|
|
import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte"
|
2025-10-30 22:36:14 +00:00
|
|
|
import RoomNameWithImage from "@app/components/RoomNameWithImage.svelte"
|
2026-03-16 20:38:05 +00:00
|
|
|
import VoiceRoomItem from "@app/components/VoiceRoomItem.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {rooms} from "@app/core"
|
|
|
|
|
import {RoomType, getRoomType} from "@app/rooms"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {deriveShouldNotify} from "@app/settings"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {notifications} from "@app/notifications"
|
|
|
|
|
import {makeRoomPath} from "@app/routes"
|
2024-11-14 18:53:13 +00:00
|
|
|
|
2026-07-07 21:23:52 +00:00
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
h: string
|
2025-02-11 19:42:49 +00:00
|
|
|
replaceState?: boolean
|
2026-07-07 21:23:52 +00:00
|
|
|
tooltip?: boolean
|
2025-02-04 00:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
2026-07-07 21:23:52 +00:00
|
|
|
const {url, h, replaceState = false, tooltip = true}: Props = $props()
|
2024-11-14 18:53:13 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const room = $rooms.forRoom(url, h)
|
2026-03-16 20:38:05 +00:00
|
|
|
const roomType = $derived(getRoomType($room))
|
2025-10-30 22:33:34 +00:00
|
|
|
const path = makeRoomPath(url, h)
|
2026-02-02 22:29:12 +00:00
|
|
|
const shouldNotifyForSpace = deriveShouldNotify(url)
|
|
|
|
|
const shouldNotifyForRoom = deriveShouldNotify(url, h)
|
|
|
|
|
const showDifferenceIcon = $derived($shouldNotifyForRoom !== $shouldNotifyForSpace)
|
2026-03-25 22:35:00 +00:00
|
|
|
const notification = $derived($shouldNotifyForRoom ? $notifications.has(path) : false)
|
2026-07-28 16:16:26 +00:00
|
|
|
const roomName = $derived($room?.meta?.name() || h)
|
2024-11-14 18:53:13 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-03-16 20:38:05 +00:00
|
|
|
{#if roomType === RoomType.Voice}
|
2026-03-25 22:35:00 +00:00
|
|
|
<VoiceRoomItem {url} {h} {replaceState} {notification} />
|
2026-03-16 20:38:05 +00:00
|
|
|
{:else}
|
2026-07-07 21:23:52 +00:00
|
|
|
<SecondaryNavItem href={path} title={tooltip ? roomName : ""} {replaceState} {notification}>
|
2026-03-16 20:38:05 +00:00
|
|
|
<RoomNameWithImage {url} {h} />
|
|
|
|
|
{#if showDifferenceIcon}
|
2026-07-02 18:36:05 +00:00
|
|
|
<Icon icon={$shouldNotifyForRoom ? Bell : BellOff} size={4} class="ml-auto opacity-50" />
|
2026-03-16 20:38:05 +00:00
|
|
|
{/if}
|
|
|
|
|
</SecondaryNavItem>
|
|
|
|
|
{/if}
|