flotilla/src/app/components/MenuSpaceRoomItem.svelte

31 lines
979 B
Svelte
Raw Normal View History

2024-11-14 18:53:13 +00:00
<script lang="ts">
2024-12-10 21:38:34 +00:00
import {readable} from "svelte/store"
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"
2024-11-14 18:53:13 +00:00
import {makeSpacePath} from "@app/routes"
2024-12-10 21:38:34 +00:00
import {deriveChannel, channelIsLocked} from "@app/state"
2024-11-14 18:53:13 +00:00
import {deriveNotification, getRoomFilters} from "@app/notifications"
export let url
export let room
2024-12-10 21:38:34 +00:00
export let notify = false
2024-11-14 18:53:13 +00:00
const path = makeSpacePath(url, room)
2024-12-10 21:38:34 +00:00
const channel = deriveChannel(url, room)
const notification = notify
? deriveNotification(path, getRoomFilters(room), url)
: readable(false)
2024-11-14 18:53:13 +00:00
</script>
<SecondaryNavItem href={path} notification={$notification}>
2024-12-10 21:38:34 +00:00
{#if channelIsLocked($channel)}
<Icon icon="lock" size={4} />
{:else}
<Icon icon="hashtag" />
{/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>