2024-11-14 18:53:13 +00:00
|
|
|
<script lang="ts">
|
2026-09-02 23:42:29 +00:00
|
|
|
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"
|
2025-11-11 21:39:32 +00:00
|
|
|
import RelayIcon from "@app/components/RelayIcon.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {relays} from "@app/core"
|
2026-09-02 23:42:29 +00:00
|
|
|
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
|
|
|
|
2026-09-02 23:42:29 +00:00
|
|
|
const onClick = () => {
|
|
|
|
|
const entryPath = makeSpaceEntryPath(url)
|
|
|
|
|
|
|
|
|
|
goto(entryPath, {replaceState: entryPath === $page.url.pathname})
|
|
|
|
|
}
|
2026-04-06 16:08:02 +00:00
|
|
|
|
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)}>
|
2026-09-01 15:05:45 +00:00
|
|
|
<RelayIcon {url} size={10} />
|
2024-11-14 18:53:13 +00:00
|
|
|
</PrimaryNavItem>
|