flotilla/src/app/components/MenuSpaceRoomItem.svelte

39 lines
1.1 KiB
Svelte
Raw Normal View History

2024-11-14 18:53:13 +00:00
<script lang="ts">
2025-09-10 22:26:39 +00:00
import Lock from "@assets/icons/lock-keyhole.svg?dataurl"
2025-09-11 19:43:18 +00:00
import Hashtag from "@assets/icons/hashtag.svg?dataurl"
2024-11-14 18:53:13 +00:00
import Icon from "@lib/components/Icon.svelte"
import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte"
2024-12-10 01:04:39 +00:00
import ChannelName from "@app/components/ChannelName.svelte"
import {makeRoomPath} from "@app/util/routes"
import {deriveChannel} from "@app/core/state"
import {notifications} from "@app/util/notifications"
2024-11-14 18:53:13 +00:00
2025-02-04 00:37:14 +00:00
interface Props {
url: any
room: any
notify?: boolean
replaceState?: boolean
2025-02-04 00:37:14 +00:00
}
const {url, room, notify = false, replaceState = false}: Props = $props()
2024-11-14 18:53:13 +00:00
2024-12-17 02:59:16 +00:00
const path = makeRoomPath(url, room)
2024-12-10 21:38:34 +00:00
const channel = deriveChannel(url, room)
2024-11-14 18:53:13 +00:00
</script>
<SecondaryNavItem
href={path}
{replaceState}
notification={notify ? $notifications.has(path) : false}>
{#if $channel?.picture}
<Icon icon={$channel.picture} />
{:else if $channel?.closed || $channel?.private}
<Icon icon={Lock} />
2024-12-10 21:38:34 +00:00
{:else}
2025-09-10 22:26:39 +00:00
<Icon icon={Hashtag} />
2024-12-10 21:38:34 +00:00
{/if}
2024-12-10 21:02:41 +00:00
<div class="min-w-0 overflow-hidden text-ellipsis">
<ChannelName {url} {room} />
</div>
2024-11-14 18:53:13 +00:00
</SecondaryNavItem>