flotilla/src/app/components/PrimaryNavItemSpace.svelte

35 lines
905 B
Svelte
Raw Normal View History

2024-11-14 18:53:13 +00:00
<script lang="ts">
import {goto} from "$app/navigation"
import {page} from "$app/stores"
2024-11-14 18:53:13 +00:00
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"
import {makeSpacePath, makeSpaceEntryPath} from "@app/routes"
2026-06-08 21:14:40 +00:00
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 = () => {
const entryPath = makeSpaceEntryPath(url)
goto(entryPath, {replaceState: entryPath === $page.url.pathname})
}
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} />
2024-11-14 18:53:13 +00:00
</PrimaryNavItem>