2026-09-08 22:47:51 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import Add from "@assets/icons/add.svg?dataurl"
|
|
|
|
|
import Server from "@assets/icons/server.svg?dataurl"
|
|
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import Link from "@lib/components/Link.svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
2026-09-08 23:33:37 +00:00
|
|
|
import Spinner from "@lib/components/Spinner.svelte"
|
2026-09-08 23:30:23 +00:00
|
|
|
import HomeSection from "@app/components/HomeSection.svelte"
|
2026-09-08 22:47:51 +00:00
|
|
|
import RelayListItem from "@app/components/hosting/RelayListItem.svelte"
|
|
|
|
|
import RelayCreate from "@app/components/hosting/RelayCreate.svelte"
|
|
|
|
|
import {pushModal} from "@app/modal"
|
2026-09-26 04:31:17 +00:00
|
|
|
import {hosting} from "@app/hosting"
|
2026-09-09 21:40:45 +00:00
|
|
|
import {PLATFORM_NAME} from "@app/env"
|
2026-09-08 22:47:51 +00:00
|
|
|
|
2026-09-26 08:12:13 +00:00
|
|
|
type Props = {
|
|
|
|
|
class?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {class: className = ""}: Props = $props()
|
2026-09-09 01:14:19 +00:00
|
|
|
|
2026-09-26 04:31:17 +00:00
|
|
|
const tenantRelays = $hosting.relays
|
2026-09-08 22:47:51 +00:00
|
|
|
|
2026-09-26 04:31:17 +00:00
|
|
|
const relays = $derived($tenantRelays.relays)
|
2026-09-08 22:47:51 +00:00
|
|
|
|
2026-09-26 04:31:17 +00:00
|
|
|
const openCreate = () => pushModal(RelayCreate)
|
2026-09-08 22:47:51 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-09 01:14:19 +00:00
|
|
|
<HomeSection title="Hosting" icon={Server} class={className}>
|
2026-09-08 23:33:37 +00:00
|
|
|
{#snippet action()}
|
|
|
|
|
{#if relays.length > 0}
|
|
|
|
|
<Link href="/settings/hosting" class="button button-neutral button-xs">Manage</Link>
|
|
|
|
|
{/if}
|
|
|
|
|
{/snippet}
|
2026-09-26 04:31:17 +00:00
|
|
|
{#if $tenantRelays.loading}
|
2026-09-08 23:33:37 +00:00
|
|
|
<div class="flex justify-center px-4 pb-8">
|
|
|
|
|
<Spinner>Checking your hosted spaces…</Spinner>
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
2026-09-08 23:30:23 +00:00
|
|
|
{#if relays.length > 0}
|
|
|
|
|
<div class="flex flex-col divide-y divide-line border-y border-line">
|
|
|
|
|
{#each relays as relay (relay.id)}
|
2026-09-22 18:16:19 +00:00
|
|
|
<RelayListItem {relay} compact class="px-4 py-3" />
|
2026-09-08 23:30:23 +00:00
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2026-09-09 16:21:02 +00:00
|
|
|
<div class="flex flex-col items-center gap-3 px-4 pt-4 pb-8 text-center">
|
2026-09-08 23:30:23 +00:00
|
|
|
<p class="text-sm opacity-75">
|
|
|
|
|
{#if relays.length > 0}
|
|
|
|
|
Spin up another hosted space — rooms, calendar and moderation included.
|
|
|
|
|
{:else}
|
2026-09-09 21:40:45 +00:00
|
|
|
Don't wait for an invite. {PLATFORM_NAME} Hosting sets up a space with rooms, calendar and moderation
|
|
|
|
|
in about a minute.
|
2026-09-08 23:30:23 +00:00
|
|
|
{/if}
|
|
|
|
|
</p>
|
|
|
|
|
<Button class="button button-primary button-sm" onclick={openCreate}>
|
|
|
|
|
<Icon icon={Add} size={4} />
|
|
|
|
|
{relays.length > 0 ? "Add another space" : "Start a space"}
|
|
|
|
|
</Button>
|
2026-09-08 22:47:51 +00:00
|
|
|
</div>
|
2026-09-08 23:33:37 +00:00
|
|
|
{/if}
|
|
|
|
|
</HomeSection>
|