2023-01-07 22:59:58 +05:30
|
|
|
<script lang="ts">
|
|
|
|
import type { PageData } from "./$types";
|
|
|
|
export let data: PageData;
|
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
import User, { type UserType } from "./User.svelte";
|
|
|
|
|
|
|
|
const isOnline = (user: UserType) => user.online
|
|
|
|
</script>
|
2023-01-07 22:59:58 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
<div class="h1-no-lg flex flex-col sm:(flex-row items-center) gap-4">
|
|
|
|
<span class="text-4xl font-bold">Pubnix</span>
|
|
|
|
<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>
|
|
|
|
</div>
|
2023-01-07 22:59:58 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
<h2>Online users</h2>
|
2023-01-07 22:59:58 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
{#if !data.error}
|
|
|
|
{#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 22:59:58 +05:30
|
|
|
{:else}
|
2023-01-25 22:41:11 +05:30
|
|
|
<p>No users online</p>
|
2023-01-07 22:59:58 +05:30
|
|
|
{/if}
|
2023-01-25 22:41:11 +05:30
|
|
|
{:else}
|
|
|
|
<p>{data.message}</p>
|
|
|
|
{/if}
|