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"
|
|
|
|
|
import {deriveRoom, deriveShouldNotify, getRoomType, RoomType} from "@app/core/state"
|
2026-02-27 20:25:16 +00:00
|
|
|
import {notifications} from "@app/util/notifications"
|
2025-08-21 22:01:31 +00:00
|
|
|
import {makeRoomPath} from "@app/util/routes"
|
2024-11-14 18:53:13 +00:00
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
interface Props {
|
|
|
|
|
url: any
|
2025-10-30 22:33:34 +00:00
|
|
|
h: any
|
2025-02-11 19:42:49 +00:00
|
|
|
replaceState?: boolean
|
2025-02-04 00:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-17 22:11:02 +00:00
|
|
|
const {url, h, replaceState = false}: Props = $props()
|
2024-11-14 18:53:13 +00:00
|
|
|
|
2026-03-16 20:38:05 +00:00
|
|
|
const room = deriveRoom(url, h)
|
|
|
|
|
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-04-06 16:08:02 +00:00
|
|
|
const roomName = $derived($room?.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-04-06 16:08:02 +00:00
|
|
|
<SecondaryNavItem href={path} title={roomName} {replaceState} {notification}>
|
2026-03-16 20:38:05 +00:00
|
|
|
<RoomNameWithImage {url} {h} />
|
|
|
|
|
{#if showDifferenceIcon}
|
|
|
|
|
<Icon icon={$shouldNotifyForRoom ? Bell : BellOff} size={4} class="opacity-50" />
|
|
|
|
|
{/if}
|
|
|
|
|
</SecondaryNavItem>
|
|
|
|
|
{/if}
|