flotilla/src/app/components/MenuSpaceButton.svelte

28 lines
1,012 B
Svelte
Raw Normal View History

2024-11-15 22:03:54 +00:00
<script lang="ts">
2025-09-10 22:26:39 +00:00
import MenuDots from "@assets/icons/menu-dots.svg?dataurl"
2024-11-15 22:03:54 +00:00
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import MenuSpace from "@app/components/MenuSpace.svelte"
import {notifications} from "@app/util/notifications"
import {makeSpacePath} from "@app/util/routes"
import {pushDrawer} from "@app/util/modal"
2025-10-21 00:05:22 +00:00
import {deriveSocketStatus} from "@app/core/state"
2024-11-15 22:03:54 +00:00
const {url} = $props()
2024-11-15 22:03:54 +00:00
2025-10-06 18:23:19 +00:00
const path = makeSpacePath(url) + ":mobile"
2024-11-15 22:03:54 +00:00
2025-10-21 00:05:22 +00:00
const status = deriveSocketStatus(url)
2024-12-16 19:24:10 +00:00
const openMenu = () => pushDrawer(MenuSpace, {url})
2024-11-15 22:03:54 +00:00
</script>
<Button onclick={openMenu} class="btn btn-neutral btn-sm relative md:hidden">
2025-09-10 22:26:39 +00:00
<Icon icon={MenuDots} />
2025-10-21 00:05:22 +00:00
{#if $status.theme !== "success"}
<div class="absolute right-0 top-0 -mr-1 -mt-1 h-2 w-2 rounded-full bg-{$status.theme}"></div>
{:else if $notifications.has(path)}
2025-02-03 23:01:42 +00:00
<div class="absolute right-0 top-0 -mr-1 -mt-1 h-2 w-2 rounded-full bg-primary"></div>
2024-11-15 22:03:54 +00:00
{/if}
</Button>