flotilla/src/app/components/PrimaryNavItemSpace.svelte

29 lines
735 B
Svelte
Raw Normal View History

2024-11-14 18:53:13 +00:00
<script lang="ts">
import PrimaryNavItem from "@lib/components/PrimaryNavItem.svelte"
import RelayIcon from "@app/components/RelayIcon.svelte"
2026-07-28 16:16:26 +00:00
import {relays} from "@app/core"
2026-06-08 21:14:40 +00:00
import {makeSpacePath, goToSpace} from "@app/routes"
import {notifications} from "@app/notifications"
2024-11-14 18:53:13 +00:00
2025-11-14 23:02:23 +00:00
type Props = {
url: string
2026-06-24 20:10:06 +00:00
showTooltip?: boolean
2025-11-14 23:02:23 +00:00
}
2026-06-24 20:10:06 +00:00
const {url, showTooltip = true}: Props = $props()
2024-11-14 18:53:13 +00:00
const onClick = () => goToSpace(url)
2026-05-04 23:01:39 +00:00
const path = makeSpacePath(url)
2026-07-28 16:16:26 +00:00
const display = $relays.display(url).$
2024-11-14 18:53:13 +00:00
</script>
<PrimaryNavItem
2026-05-04 23:01:39 +00:00
href={path}
2025-10-06 18:23:19 +00:00
onclick={onClick}
2026-06-24 20:10:06 +00:00
title={showTooltip ? $display : ""}
2026-05-04 23:01:39 +00:00
notification={$notifications.has(path)}>
<RelayIcon {url} size={10} class="rounded-full" />
2024-11-14 18:53:13 +00:00
</PrimaryNavItem>