From 678746c89bf9f52326051871fabfdf0538f263a0 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 28 Feb 2024 17:28:21 +0100 Subject: [PATCH] Begin Display, Add View Transitions --- package.json | 1 + pnpm-lock.yaml | 22 ++-- src/components/Login.svelte | 3 +- src/components/Navbar.svelte | 2 +- src/components/admin/App.svelte | 4 + src/components/admin/pages/Display.svelte | 43 ++++++++ src/components/admin/pages/Edit.svelte | 4 + .../admin/pages/display/EventDisplay.svelte | 103 ++++++++++++++++++ src/components/dashboard/Statistics.svelte | 2 +- src/i18n/common/de.json | 71 ++++++++++++ src/i18n/common/en.json | 92 ++++++++++++++++ src/i18n/pages/announcements/de.json | 5 - src/i18n/pages/announcements/en.json | 5 - src/i18n/pages/announcements/tags/en.json | 5 - src/i18n/pages/dashboard/de.json | 28 ----- src/i18n/pages/dashboard/en.json | 45 -------- src/i18n/pages/login/de.json | 16 --- src/i18n/pages/login/en.json | 17 --- src/i18n/pages/ranked/de.json | 5 - src/i18n/pages/ranked/en.json | 5 - src/i18n/pages/rules/de.json | 22 ---- src/i18n/pages/rules/en.json | 22 ---- src/i18n/pages/stats/fight/de.json | 5 - src/i18n/pages/stats/fight/en.json | 5 - src/layouts/Basic.astro | 5 +- src/layouts/NavbarLayout.astro | 2 +- src/layouts/PageLayout.astro | 2 +- src/pages/dashboard.astro | 3 +- src/pages/login.astro | 3 +- src/pages/rules/[mode].astro | 2 +- src/pages/rules/index.astro | 12 +- 31 files changed, 349 insertions(+), 212 deletions(-) create mode 100644 src/components/admin/pages/Display.svelte create mode 100644 src/components/admin/pages/display/EventDisplay.svelte delete mode 100644 src/i18n/pages/announcements/de.json delete mode 100644 src/i18n/pages/announcements/en.json delete mode 100644 src/i18n/pages/announcements/tags/en.json delete mode 100644 src/i18n/pages/dashboard/de.json delete mode 100644 src/i18n/pages/dashboard/en.json delete mode 100644 src/i18n/pages/login/de.json delete mode 100644 src/i18n/pages/login/en.json delete mode 100644 src/i18n/pages/ranked/de.json delete mode 100644 src/i18n/pages/ranked/en.json delete mode 100644 src/i18n/pages/rules/de.json delete mode 100644 src/i18n/pages/rules/en.json delete mode 100644 src/i18n/pages/stats/fight/de.json delete mode 100644 src/i18n/pages/stats/fight/en.json diff --git a/package.json b/package.json index 8de1b20..56cd0ef 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "flowbite": "^1.8.1", "flowbite-svelte": "^0.44.24", "flowbite-svelte-icons": "^0.4.5", + "qs": "^6.11.2", "sharp": "^0.32.6", "svelte-awesome": "^3.3.1", "svelte-codemirror-editor": "^1.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7cd8213..9903399 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ dependencies: flowbite-svelte-icons: specifier: ^0.4.5 version: 0.4.5(svelte@4.2.12)(tailwind-merge@2.2.1)(tailwindcss@3.4.1) + qs: + specifier: ^6.11.2 + version: 6.11.2 sharp: specifier: ^0.32.6 version: 0.32.6 @@ -1985,7 +1988,6 @@ packages: function-bind: 1.1.2 get-intrinsic: 1.2.4 set-function-length: 1.2.1 - dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -2400,7 +2402,6 @@ packages: es-define-property: 1.0.0 es-errors: 1.3.0 gopd: 1.0.1 - dev: true /define-properties@1.2.1: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} @@ -2581,12 +2582,10 @@ packages: engines: {node: '>= 0.4'} dependencies: get-intrinsic: 1.2.4 - dev: true /es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - dev: true /es-iterator-helpers@1.0.17: resolution: {integrity: sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ==} @@ -3135,7 +3134,6 @@ packages: has-proto: 1.0.3 has-symbols: 1.0.3 hasown: 2.0.1 - dev: true /get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} @@ -3224,7 +3222,6 @@ packages: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: get-intrinsic: 1.2.4 - dev: true /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -3259,17 +3256,14 @@ packages: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} dependencies: es-define-property: 1.0.0 - dev: true /has-proto@1.0.3: resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} engines: {node: '>= 0.4'} - dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} - dev: true /has-tostringtag@1.0.2: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} @@ -4592,7 +4586,6 @@ packages: /object-inspect@1.13.1: resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - dev: true /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} @@ -5287,6 +5280,13 @@ packages: engines: {node: '>=6'} dev: true + /qs@6.11.2: + resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.5 + dev: false + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -5598,7 +5598,6 @@ packages: get-intrinsic: 1.2.4 gopd: 1.0.1 has-property-descriptors: 1.0.2 - dev: true /set-function-name@2.0.2: resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} @@ -5650,7 +5649,6 @@ packages: es-errors: 1.3.0 get-intrinsic: 1.2.4 object-inspect: 1.13.1 - dev: true /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} diff --git a/src/components/Login.svelte b/src/components/Login.svelte index f5b1f5d..d40061b 100644 --- a/src/components/Login.svelte +++ b/src/components/Login.svelte @@ -21,6 +21,7 @@ import {l} from "@utils/util.ts"; import {t} from "astro-i18n"; import {get} from "svelte/store"; + import {navigate} from "astro:transitions/client"; let username: string = ""; let pw: string = ""; @@ -45,7 +46,7 @@ } tokenStore.set(auth); - window.location.href = l("/dashboard"); + navigate(l("/dashboard")); } catch (e: any) { pw = ""; error = t("login.error"); diff --git a/src/components/Navbar.svelte b/src/components/Navbar.svelte index 4adf0b4..c8e16b0 100644 --- a/src/components/Navbar.svelte +++ b/src/components/Navbar.svelte @@ -105,7 +105,7 @@ --> - + {t("navbar.links.account")} diff --git a/src/components/admin/App.svelte b/src/components/admin/App.svelte index f27672b..26a031d 100644 --- a/src/components/admin/App.svelte +++ b/src/components/admin/App.svelte @@ -46,6 +46,10 @@ asyncComponent: () => import("./pages/Edit.svelte"), conditions: detail => get(tokenStore) != "" }), + "/display/:event": wrap({ + asyncComponent: () => import("./pages/Display.svelte"), + conditions: detail => get(tokenStore) != "" + }), "*": wrap({asyncComponent: () => import("./pages/NotFound.svelte")}) }; diff --git a/src/components/admin/pages/Display.svelte b/src/components/admin/pages/Display.svelte new file mode 100644 index 0000000..cc926cc --- /dev/null +++ b/src/components/admin/pages/Display.svelte @@ -0,0 +1,43 @@ + + + + +{#await eventFuture} +

Loading...

+{:then event} + +{:catch error} +

{error.message}

+{/await} \ No newline at end of file diff --git a/src/components/admin/pages/Edit.svelte b/src/components/admin/pages/Edit.svelte index c54fbda..687e2a6 100644 --- a/src/components/admin/pages/Edit.svelte +++ b/src/components/admin/pages/Edit.svelte @@ -139,6 +139,10 @@