From 3108d9bf202ff66170bb479d6a39abadac62e39a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 25 Dec 2023 21:54:40 +0100 Subject: [PATCH] Some Code Cleanup --- astro.config.mjs | 18 ++++- src/components/Dashboard.svelte | 2 +- src/components/EloTable.svelte | 2 +- src/components/FightStatistics.svelte | 2 +- src/components/FightStatsChart.svelte | 2 +- src/components/FightTable.svelte | 23 +++++- src/components/GroupTable.svelte | 4 +- src/components/Login.svelte | 8 +- src/components/PostComponent.astro | 6 +- src/components/admin/App.svelte | 2 +- .../admin/components/FightEditPart.svelte | 8 +- .../admin/components/TypeAheadSearch.svelte | 2 +- src/components/admin/pages/Edit.svelte | 6 +- src/components/admin/pages/Event.svelte | 4 +- src/components/admin/pages/Generate.svelte | 9 +-- src/components/admin/pages/Home.svelte | 3 +- src/components/admin/pages/Login.svelte | 4 +- src/components/admin/pages/Perms.svelte | 5 +- src/components/admin/pages/edit/Editor.svelte | 6 +- .../admin/pages/event/EventEdit.svelte | 12 +-- .../admin/pages/event/FightCard.svelte | 12 +-- .../admin/pages/event/FightList.svelte | 10 +-- .../admin/pages/event/TeamList.svelte | 4 +- .../event/modals/CreateFightModal.svelte | 9 +-- .../pages/event/modals/FightEditModal.svelte | 12 +-- .../admin/pages/generate/DragAcceptor.svelte | 2 +- .../pages/generate/GroupGenerator.svelte | 8 +- .../admin/pages/generate/TeamChip.svelte | 5 +- .../admin/pages/home/CreateEventModal.svelte | 6 +- .../admin/pages/home/EventCard.svelte | 2 +- src/components/admin/util.ts | 74 +++++++++---------- src/components/dashboard/SchematicInfo.svelte | 4 +- .../dashboard/SchematicInfoModal.svelte | 6 +- src/components/dashboard/SchematicList.svelte | 6 +- .../dashboard/SchematicListTile.svelte | 4 +- src/components/dashboard/Statistics.svelte | 4 +- src/components/dashboard/UploadModal.svelte | 2 +- src/components/dashboard/UserInfo.svelte | 6 +- src/components/repo/data.ts | 4 +- src/components/repo/event.ts | 4 +- src/components/repo/fight.ts | 4 +- src/components/repo/page.ts | 22 +++--- src/components/repo/perms.ts | 4 +- src/components/repo/repo.ts | 40 +++++----- src/components/repo/schem.ts | 8 +- src/components/repo/stats.ts | 6 +- src/components/stores/cached.ts | 8 +- src/components/stores/stores.ts | 36 ++++----- src/components/types/data.ts | 6 +- src/components/types/event.ts | 8 +- src/components/types/page.ts | 4 +- src/components/types/perms.ts | 6 +- src/components/types/schem.ts | 8 +- src/components/types/stats.ts | 6 +- src/components/types/team.ts | 4 +- src/i18n/common/de.json | 11 +++ src/i18n/common/en.json | 3 + src/pages/announcements/[...slug].astro | 16 ++-- src/pages/index.astro | 10 +-- src/pages/login.astro | 6 +- tsconfig.json | 24 +++++- 61 files changed, 305 insertions(+), 247 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 9d5f075..ba3c8e2 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,6 +5,8 @@ import configureI18n from "./astro-i18n.adapter"; import sitemap from "@astrojs/sitemap"; import robotsTxt from "astro-robots-txt"; +import {resolve} from "node:url"; +import path from "node:path"; // https://astro.build/config export default defineConfig({ @@ -30,5 +32,19 @@ export default defineConfig({ disallow: ["/admin", "/login", "/dashboard", "/de", "/_astro"] }] })], - vite: {} + vite: { + resolve: { + alias: { + "@components": path.resolve("./src/components"), + "@pages": path.resolve("./src/pages"), + "@styles": path.resolve("./src/styles"), + "@utils": path.resolve("./src/util"), + "@type": path.resolve("./src/components/types"), + "@images": path.resolve("./src/images"), + "@layouts": path.resolve("./src/layouts"), + "@repo": path.resolve("./src/components/repo"), + "@stores": path.resolve("./src/components/stores"), + } + } + } }); \ No newline at end of file diff --git a/src/components/Dashboard.svelte b/src/components/Dashboard.svelte index 6ba2181..8331297 100644 --- a/src/components/Dashboard.svelte +++ b/src/components/Dashboard.svelte @@ -19,7 +19,7 @@
- {#each Array(rows) as _} + {#each Array(rows) as i (i)} + {/each} {#each window(event.fights.filter(f => f.group === group), rows) as fights} - {#each fights as fight} + {#each fights as fight (fight.id)} + {/each} {/each} @@ -56,6 +71,6 @@ @apply w-full; } div { - @apply p-3 bg-gray-200 dark:bg-gray-800 rounded-2xl w-3/4 mx-auto; + @apply p-3 bg-gray-200 dark:bg-neutral-800 rounded-2xl w-3/4 mx-auto; } \ No newline at end of file diff --git a/src/components/GroupTable.svelte b/src/components/GroupTable.svelte index 3d50299..3edb0bf 100644 --- a/src/components/GroupTable.svelte +++ b/src/components/GroupTable.svelte @@ -20,7 +20,7 @@ diff --git a/src/components/admin/pages/event/modals/CreateFightModal.svelte b/src/components/admin/pages/event/modals/CreateFightModal.svelte index 927d9d3..3e47aae 100644 --- a/src/components/admin/pages/event/modals/CreateFightModal.svelte +++ b/src/components/admin/pages/event/modals/CreateFightModal.svelte @@ -19,10 +19,9 @@ -
dragover = false}> +
dragover = false} role="none">
diff --git a/src/components/admin/pages/generate/GroupGenerator.svelte b/src/components/admin/pages/generate/GroupGenerator.svelte index f14b897..c76837b 100644 --- a/src/components/admin/pages/generate/GroupGenerator.svelte +++ b/src/components/admin/pages/generate/GroupGenerator.svelte @@ -18,14 +18,14 @@ -->
{t("announcements.table.time")} {t("announcements.table.blue")} {t("announcements.table.red")}{t("announcements.table.winner")}
{Intl.DateTimeFormat(astroI18n.locale, { hour: "numeric", minute: "numeric", }).format(new Date(fight.start))} {fight.blueTeam.kuerzel} {fight.redTeam.kuerzel}{getWinner(fight)}