flotilla/src/app/components/PrimaryNavItemSpace.svelte

25 lines
773 B
Svelte
Raw Normal View History

2024-11-14 18:53:13 +00:00
<script lang="ts">
2025-10-06 18:23:19 +00:00
import {goto} from "$app/navigation"
2024-11-14 18:53:13 +00:00
import {displayRelayUrl} from "@welshman/util"
import PrimaryNavItem from "@lib/components/PrimaryNavItem.svelte"
import SpaceAvatar from "@app/components/SpaceAvatar.svelte"
2025-10-06 18:23:19 +00:00
import {encodeRelay} from "@app/core/state"
import {makeSpacePath} from "@app/util/routes"
2025-10-06 18:23:19 +00:00
import {lastPageBySpaceUrl} from "@app/util/history"
import {notifications} from "@app/util/notifications"
2024-11-14 18:53:13 +00:00
const {url} = $props()
2024-11-14 18:53:13 +00:00
const path = makeSpacePath(url)
2025-10-06 18:23:19 +00:00
const onClick = () => goto(lastPageBySpaceUrl.get(encodeRelay(url)) || path)
2024-11-14 18:53:13 +00:00
</script>
<PrimaryNavItem
2025-10-06 18:23:19 +00:00
onclick={onClick}
2024-11-14 18:53:13 +00:00
title={displayRelayUrl(url)}
class="tooltip-right"
2024-12-16 19:24:10 +00:00
notification={$notifications.has(path)}>
2024-11-14 18:53:13 +00:00
<SpaceAvatar {url} />
</PrimaryNavItem>