clove/pkviewer
web/src/routes/manage/+page.svelte
<!-- web/src/routes/manage/+page.svelte -->
<script lang="ts">
import { site } from "$lib/config.ts";
import Icon from "$lib/components/Icon.svelte";
import Note from "$lib/components/manage/Note.svelte";
import PageHeader from "$lib/components/manage/PageHeader.svelte";
let { data } = $props();
</script>
<svelte:head>
<title>Manage · pkviewer</title>
</svelte:head>
{#if data.systems === null}
<div class="mg-shell">
<PageHeader title="Your systems" />
<Note icon="exclamation-triangle" tone="warn" role="alert">
Your systems could not be loaded right now. Please refresh in a moment.
</Note>
</div>
{:else if data.systems.length === 0}
<!-- Explains what claiming is for and offers the action, rather than describing a process -->
<div class="mg-shell mg-shell--narrow">
<div class="mg-empty">
<h1>No systems yet</h1>
<p>
pkviewer turns a PluralKit system into a website. PluralKit keeps the
identity and the data; pkviewer decides how it looks on the web.
</p>
<p>To manage a system here, pkviewer needs to confirm you can act for it:</p>
<ol>
<li>
<strong>Usually automatic.</strong> If the Discord account you signed
in with is linked to a PluralKit system, pkviewer can confirm that on
its own.
</li>
<li>
<strong>Otherwise, a short code.</strong> pkviewer gives you a code to
put in your system description for a moment, then checks for it.
</li>
</ol>
<p>You never have to hand pkviewer a PluralKit token.</p>
<div class="mg-actions">
<a class="btn primary" href="/manage/claim">
Claim a system <Icon name="arrow-right" />
</a>
<a class="btn quiet" href={site.docsUrl} rel="noopener">
Read about claiming <Icon name="box-arrow-up-right" />
</a>
</div>
</div>
</div>
{:else}
<div class="mg-shell">
<PageHeader title="Your systems" description="Choose a system to edit how it appears on the web.">
{#snippet actions()}
<a class="btn" href="/manage/claim">
<Icon name="plus-lg" /> Claim a system
</a>
{/snippet}
</PageHeader>
<ul class="mg-list">
{#each data.systems as system (system.systemId)}
<li>
<a class="mg-item" href="/manage/{system.systemId}">
{#if system.avatarUrl}
<img class="mg-thumb mg-thumb--round" src={system.avatarUrl} alt="" />
{:else}
<Icon name="person-circle" class="mg-thumb mg-thumb--round" />
{/if}
<span class="mg-identity">
<span class="name">{system.name ?? system.pkSystemHid}</span>
<span class="meta">
<code>{site.publicOrigin.replace(/^https?:\/\//, "")}{system.publicPath}</code>
{#if system.memberCount !== null}
<span>
{system.memberCount} {system.memberCount === 1 ? "member" : "members"}
</span>
{/if}
</span>
</span>
{#if !system.reachable}
<span class="mg-tag" data-tone="warn">PluralKit unreachable</span>
{:else if !system.slug}
<span class="mg-tag">No address yet</span>
{/if}
<Icon name="arrow-right" class="mg-chevron" />
</a>
</li>
{/each}
</ul>
</div>
{/if}