feat: Refactor event management components and introduce EventModel for better state handling
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-06-04 11:33:11 +02:00
parent df389b3acf
commit bd1c4f7f45
9 changed files with 301 additions and 164 deletions

View File

@@ -18,19 +18,19 @@
-->
<script lang="ts">
import {t} from "astro-i18n";
import type {Player} from "@type/data.ts";
import {l} from "@utils/util.ts";
import { t } from "astro-i18n";
import type { Player } from "@type/data.ts";
import { l } from "@utils/util.ts";
import Statistics from "./Statistics.svelte";
import {authV2Repo} from "@repo/authv2.ts";
import { authV2Repo } from "@repo/authv2.ts";
import Card from "@components/Card.svelte";
import {navigate} from "astro:transitions/client";
import { navigate } from "astro:transitions/client";
interface Props {
user: Player;
}
interface Props {
user: Player;
}
let { user }: Props = $props();
let { user }: Props = $props();
async function logout() {
await $authV2Repo.logout();
@@ -43,19 +43,25 @@
<Card>
<figure>
<figcaption class="text-center mb-4 text-2xl">{user.name}</figcaption>
<img src={`${import.meta.env.PUBLIC_API_SERVER}/data/skin/${user.uuid}`} class="transition duration-300 ease-in-out hover:scale-110 hover:drop-shadow-2xl" alt={user.name + "s bust"} width="150" height="150" />
<img
src={`${import.meta.env.PUBLIC_API_SERVER}/data/skin/${user.uuid}`}
class="transition duration-300 ease-in-out hover:scale-110 hover:drop-shadow-2xl"
alt={user.name + "s bust"}
width="150"
height="150"
/>
</figure>
</Card>
<div class="flex flex-wrap">
<button class="btn mt-2" onclick={logout}>{t("dashboard.buttons.logout")}</button>
{#if user.perms.includes("MODERATION")}
<a class="btn w-fit mt-2" href="/admin" data-astro-reload>{t("dashboard.buttons.admin")}</a>
<a class="btn w-fit mt-2" href="/admin/new" data-astro-reload>{t("dashboard.buttons.admin")}</a>
{/if}
</div>
</div>
<div>
<h1 class="text-4xl font-bold">{t("dashboard.title", {name: user.name})}</h1>
<p>{t("dashboard.rank", {rank: t("home.prefix." + (user.prefix || "User"))})}</p>
<h1 class="text-4xl font-bold">{t("dashboard.title", { name: user.name })}</h1>
<p>{t("dashboard.rank", { rank: t("home.prefix." + (user.prefix || "User")) })}</p>
<Statistics {user} />
</div>
</div>
</div>