diff --git a/package.json b/package.json index 58113d9..e3caeb8 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@astrojs/tailwind": "^5.0.2", "@astropub/icons": "^0.2.0", "@types/color": "^3.0.5", + "@types/crypto-js": "^4.1.3", "@types/node": "^20.8.10", "cssnano": "^6.0.1", "esbuild": "^0.19.5", @@ -34,6 +35,7 @@ "astro": "^3.4.3", "astro-i18n": "^2.1.18", "color": "^4.2.3", + "crypto-js": "^4.2.0", "flowbite": "^1.8.1", "flowbite-svelte": "^0.44.19", "flowbite-svelte-icons": "^0.4.5", diff --git a/src/components/Dashboard.svelte b/src/components/Dashboard.svelte new file mode 100644 index 0000000..4e1ab37 --- /dev/null +++ b/src/components/Dashboard.svelte @@ -0,0 +1,227 @@ + + +{#await userFetch} +

loading...

+{:then user} +
+
+ +
+ + {#if user.perms.includes("MODERATION")} + Admin Panel + {/if} +
+
+
+

Hello, {user.name}

+

Rang: {t("home.prefix." + user.prefix)}

+

Permissions:

+ +
+
+
+
+ {#await schematicFetch} +

Loading...

+ {:then schematics} +
+ + + + + + schematicFetch = getSchematics()} class="hover:underline hover:cursor-pointer text-2xl">Schematics + + {#each schematics.breadcrumbs as bread} + + + + + schematicFetch = getSchematic(bread.id)} class="hover:underline hover:cursor-pointer text-2xl">{bread.name} + + {/each} + +
+ +
+
+ + + + + + + + + + + + {#if schematics.breadcrumbs.length !== 0} + { + if (schematics.breadcrumbs.length === 1) { + schematicFetch = getSchematics() + } else { + schematicFetch = getSchematic(schematics.breadcrumbs[schematics.breadcrumbs.length - 2].id) + } + }}> + + + + + + + + + {/if} + {#each schematics.schematics as schem} + + + + + + + + + + {/each} + +
TypeName + + + Replace Color + + + + + Allow Replay + +
+ + ../
+ {#if schem.type == null} + + {:else} + + {/if} + + {schem.name}{#if schem.type == null}/{/if} + + {#if schem.replaceColor} + + {:else} + + {/if} + + {#if schem.allowReplay} + + {:else} + + {/if} +
+ {:catch error} +

error: {error.message}

+ {/await} +
+{:catch error} +

error: {error.message}

+{/await} + + +
+ +
+ + + + +
+ +{#if infoModalId !== null} + infoModalId = null} /> +{/if} + + + diff --git a/src/components/Login.svelte b/src/components/Login.svelte new file mode 100644 index 0000000..49939c3 --- /dev/null +++ b/src/components/Login.svelte @@ -0,0 +1,67 @@ + + +
+

{t("login.title")}

+
+ + + + +
+

+ {t("login.generateToken")}

+ + {#if error} +

{error}

+ {/if} + +
+ + \ No newline at end of file diff --git a/src/components/PlayerCount.svelte b/src/components/PlayerCount.svelte index 63708d4..118e47e 100644 --- a/src/components/PlayerCount.svelte +++ b/src/components/PlayerCount.svelte @@ -1,11 +1,10 @@ {#await $server} {:then data} {data.players.online} {:catch error} - Error {/await} \ No newline at end of file diff --git a/src/components/SchematicInfo.svelte b/src/components/SchematicInfo.svelte new file mode 100644 index 0000000..5f32155 --- /dev/null +++ b/src/components/SchematicInfo.svelte @@ -0,0 +1,65 @@ + + +{#await schemInfo} + + + +{:then info} + +

Path: {info.path}

+

+ Replace Color: + {#if info.schem.replaceColor} + + {:else} + + {/if} +

+

+ Allow Replay: {#if info.schem.allowReplay} + + {:else} + + {/if} +

+

Type: {info.schem.type ?? "Directory"}

+

Updated: {new Intl.DateTimeFormat(astroI18n.locale, { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + day: "2-digit", + month: "2-digit", + year: "numeric" + }).format(moment(info.schem.lastUpdate).utc(false).toDate())}

+

Item: {info.schem.item ?? (info.schem.type == null ? "CHEST" : "CAULDRON_ITEM")}

+ {#if info.members.length !== 0} +

Member: {info.members.join(", ")}

+ {/if} + +
+{:catch e} + +

{e.message}

+ +
+{/await} \ No newline at end of file diff --git a/src/components/ServerStatus.svelte b/src/components/ServerStatus.svelte index 6d9f511..76e87c0 100644 --- a/src/components/ServerStatus.svelte +++ b/src/components/ServerStatus.svelte @@ -1,6 +1,6 @@ diff --git a/src/components/admin/pages/event/modals/CreateFightModal.svelte b/src/components/admin/pages/event/modals/CreateFightModal.svelte index 15e81a5..ad395b3 100644 --- a/src/components/admin/pages/event/modals/CreateFightModal.svelte +++ b/src/components/admin/pages/event/modals/CreateFightModal.svelte @@ -1,9 +1,9 @@ + + + + \ No newline at end of file diff --git a/src/pages/event/[...slug].astro b/src/pages/event/[...slug].astro deleted file mode 100644 index 853d812..0000000 --- a/src/pages/event/[...slug].astro +++ /dev/null @@ -1,3 +0,0 @@ ---- - ---- diff --git a/src/pages/index.astro b/src/pages/index.astro index 3a74545..0e60cd1 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,7 +4,7 @@ import NavbarLayout from "../layouts/NavbarLayout.astro"; import { Image } from "astro:assets"; import localBau from "../images/2023-10-08_20.43.43.png"; import {CaretRight, Archive, Rocket, Bell} from "@astropub/icons" -import {astroI18n, t} from "astro-i18n"; +import {t} from "astro-i18n"; import {l} from "../util/util" import PlayerCount from "../components/PlayerCount.svelte"; diff --git a/src/pages/login.astro b/src/pages/login.astro index 09809b8..1f6dd5e 100644 --- a/src/pages/login.astro +++ b/src/pages/login.astro @@ -2,41 +2,22 @@ import NavbarLayout from "../layouts/NavbarLayout.astro"; import localBau from "../images/2023-10-08_20.43.43.png"; import {Image} from "astro:assets"; - +import {l} from "../util/util"; +import Login from "../components/Login.svelte"; --- + Bau
-
-

Login

-
- - - - -
- -
+
- -
- - \ No newline at end of file + \ No newline at end of file