website/src/routes/pubnix/+page.svelte

49 lines
987 B
Svelte
Raw Normal View History

2023-01-07 19:29:58 +02:00
<script lang="ts">
import type { PageData } from "./$types";
export let data: PageData;
2023-01-25 19:11:11 +02:00
import User, { type UserType } from "./User.svelte";
2023-02-03 19:55:33 +02:00
const isOnline = (user: UserType) => user.online;
2023-01-25 19:11:11 +02:00
</script>
2023-01-07 19:29:58 +02:00
2023-01-25 19:11:11 +02:00
<div class="h1-no-lg flex flex-col sm:(flex-row items-center) gap-4">
<span class="text-4xl font-bold">Pubnix</span>
2023-02-03 19:55:33 +02:00
<a
href="/pubnix/register"
class="button sm:w-fit"
><div class="i-ic:outline-plus" />
Register</a
>
<a
href="/pubnix/users"
class="button sm:w-fit"
><div class="i-ic:outline-people" />
Users</a
>
<a
href="/pubnix/faq"
class="button sm:w-fit"
><div class="i-ic:outline-question-mark" />
FAQ</a
>
2023-01-25 19:11:11 +02:00
</div>
2023-01-07 19:29:58 +02:00
2023-01-25 19:11:11 +02:00
<h2>Online users</h2>
2023-01-07 19:29:58 +02:00
2023-02-18 18:42:23 +02:00
{#if !data.users.error}
2023-01-25 19:11:11 +02:00
{#if data.users.users.some(isOnline)}
<div class="flex flex-row flex-wrap gap-4">
{#each data.users.users as user}
{#if user.online}
<User {user} />
{/if}
{/each}
</div>
2023-01-07 19:29:58 +02:00
{:else}
2023-01-25 19:11:11 +02:00
<p>No users online</p>
2023-01-07 19:29:58 +02:00
{/if}
2023-01-25 19:11:11 +02:00
{:else}
2023-02-18 18:42:23 +02:00
<p>{data.users.message}</p>
2023-02-03 19:55:33 +02:00
{/if}