Dieser Commit ist enthalten in:
Ursprung
a2687083e0
Commit
3108d9bf20
@ -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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
@ -19,7 +19,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {t} from "astro-i18n"
|
||||
import {dataRepo, schemRepo} from "./repo/repo";
|
||||
import {dataRepo, schemRepo} from "@repo/repo";
|
||||
import SchematicList from "./dashboard/SchematicList.svelte";
|
||||
import UserInfo from "./dashboard/UserInfo.svelte";
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {statsRepo} from "./repo/repo.ts";
|
||||
import {statsRepo} from "@repo/repo.ts";
|
||||
import {t} from "astro-i18n";
|
||||
|
||||
export let gamemode: string;
|
||||
|
@ -18,7 +18,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {statsRepo} from "./repo/repo.ts";
|
||||
import {statsRepo} from "@repo/repo.ts";
|
||||
import FightStatsChart from "./FightStatsChart.svelte";
|
||||
import {t} from "astro-i18n";
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
Legend,
|
||||
Title
|
||||
} from "chart.js"
|
||||
import type {FightStats} from "./types/stats.ts"
|
||||
import type {FightStats} from "@type/stats.ts"
|
||||
import 'chartjs-adapter-dayjs-4'
|
||||
|
||||
export let data: FightStats;
|
||||
|
@ -20,31 +20,46 @@
|
||||
<script lang="ts">
|
||||
import {window} from "./util.ts";
|
||||
import {astroI18n, t} from "astro-i18n";
|
||||
import type {ExtendedEvent} from "./types/event.ts";
|
||||
import type {EventFight, ExtendedEvent} from "@type/event";
|
||||
|
||||
export let event: ExtendedEvent;
|
||||
export let group: string;
|
||||
export let rows: number = 1;
|
||||
|
||||
function getWinner(fight: EventFight) {
|
||||
switch (fight.ergebnis) {
|
||||
case 1:
|
||||
return fight.blueTeam.kuerzel;
|
||||
case 2:
|
||||
return fight.redTeam.kuerzel;
|
||||
case 3:
|
||||
return t("announcements.table.draw");
|
||||
default:
|
||||
return t("announcements.table.notPlayed");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<tr class="font-bold border-b">
|
||||
{#each Array(rows) as _}
|
||||
{#each Array(rows) as i (i)}
|
||||
<td>{t("announcements.table.time")}</td>
|
||||
<td>{t("announcements.table.blue")}</td>
|
||||
<td>{t("announcements.table.red")}</td>
|
||||
<td>{t("announcements.table.winner")}</td>
|
||||
{/each}
|
||||
</tr>
|
||||
{#each window(event.fights.filter(f => f.group === group), rows) as fights}
|
||||
<tr>
|
||||
{#each fights as fight}
|
||||
{#each fights as fight (fight.id)}
|
||||
<td>{Intl.DateTimeFormat(astroI18n.locale, {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
}).format(new Date(fight.start))}</td>
|
||||
<td class:font-bold={fight.ergebnis === 1} class:italic={fight.ergebnis === 3}>{fight.blueTeam.kuerzel}</td>
|
||||
<td class:font-bold={fight.ergebnis === 2} class:italic={fight.ergebnis === 3}>{fight.redTeam.kuerzel}</td>
|
||||
<td>{getWinner(fight)}</td>
|
||||
{/each}
|
||||
</tr>
|
||||
{/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;
|
||||
}
|
||||
</style>
|
@ -20,7 +20,7 @@
|
||||
<script lang="ts">
|
||||
import {window} from "./util.ts";
|
||||
import {t} from "astro-i18n";
|
||||
import type {ExtendedEvent} from "./types/event.ts";
|
||||
import type {ExtendedEvent} from "@type/event.ts";
|
||||
|
||||
export let event: ExtendedEvent;
|
||||
export let group: string;
|
||||
@ -70,6 +70,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;
|
||||
}
|
||||
</style>
|
@ -18,14 +18,14 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {l} from "../util/util.ts";
|
||||
import {l} from "@utils/util.ts";
|
||||
import {t} from "astro-i18n";
|
||||
import {get} from "svelte/store";
|
||||
|
||||
let username = "";
|
||||
let pw = "";
|
||||
let username: string = "";
|
||||
let pw: string = "";
|
||||
|
||||
let error = "";
|
||||
let error: string = "";
|
||||
|
||||
async function login() {
|
||||
let {tokenStore, authRepo} = await import("./repo/repo.ts");
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
import {CollectionEntry} from "astro:content"
|
||||
import {CollectionEntry} from "astro:content";
|
||||
import {l} from "../util/util";
|
||||
import {astroI18n} from "astro-i18n";
|
||||
import {Image} from "astro:assets";
|
||||
@ -7,7 +7,7 @@ import TagComponent from "./TagComponent.astro";
|
||||
import P from "./P.astro";
|
||||
|
||||
interface Props {
|
||||
post: CollectionEntry<'announcements'>
|
||||
post: CollectionEntry<"announcements">
|
||||
}
|
||||
|
||||
const { post } = Astro.props as Props;
|
||||
@ -30,7 +30,7 @@ const { post } = Astro.props as Props;
|
||||
<P>{post.data.description}</P>
|
||||
<div class="mt-1">
|
||||
{post.data.tags.map((tag) => (
|
||||
<TagComponent tag={tag} />
|
||||
<TagComponent tag={tag} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@
|
||||
import wrap from "svelte-spa-router/wrap";
|
||||
import Router, {replace} from "svelte-spa-router";
|
||||
import {get} from "svelte/store";
|
||||
import {tokenStore} from "../repo/repo";
|
||||
import {tokenStore} from "@repo/repo";
|
||||
|
||||
const routes: RouteDefinition = {
|
||||
'/': wrap({asyncComponent: () => import('./pages/Home.svelte'), conditions: detail => get(tokenStore) != ""}),
|
||||
|
@ -20,8 +20,8 @@
|
||||
<script lang="ts">
|
||||
import {Input, Label, Select} from "flowbite-svelte";
|
||||
import TypeAheadSearch from "./TypeAheadSearch.svelte";
|
||||
import {gamemodes, groups, maps, players} from "../../stores/stores";
|
||||
import type {Team} from '../../types/team.js';
|
||||
import {gamemodes, groups, maps, players} from "@stores/stores.ts";
|
||||
import type {Team} from "@type/team.ts";
|
||||
|
||||
export let teams: Team[] = [];
|
||||
export let blueTeam: string;
|
||||
@ -29,8 +29,8 @@
|
||||
export let start = "";
|
||||
export let gamemode = "";
|
||||
export let map = "";
|
||||
export let kampfleiter = "";
|
||||
export let group = "";
|
||||
export let kampfleiter: string | undefined = "";
|
||||
export let group: string | null = "";
|
||||
export let groupSearch = "";
|
||||
|
||||
$: selectPlayers = $players.map(player => {
|
||||
|
@ -18,7 +18,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Button, Dropdown, DropdownItem, Search} from 'flowbite-svelte'
|
||||
import {Button, Dropdown, Search} from 'flowbite-svelte'
|
||||
|
||||
export let selected: string | null = null
|
||||
export let items: {name: string, value: string}[] = []
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {ArrowLeftSolid} from "flowbite-svelte-icons";
|
||||
import {Button, Card, Input, Label, Navbar, NavBrand, NavHamburger, NavUl, Spinner} from "flowbite-svelte";
|
||||
import {pageRepo} from "../../repo/repo";
|
||||
import {Button, Card, Navbar, NavBrand, Spinner} from "flowbite-svelte";
|
||||
import {pageRepo} from "@repo/repo.ts";
|
||||
import {mapToMap, nameRegex} from "../util.ts";
|
||||
import TypeAheadSearch from "../components/TypeAheadSearch.svelte";
|
||||
import {branches} from "../../stores/stores.ts";
|
||||
import {branches} from "@stores/stores.ts";
|
||||
import Editor from "./edit/Editor.svelte";
|
||||
|
||||
$: pagesFuture = $pageRepo.listPages(selectedBranch);
|
||||
|
@ -18,11 +18,11 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Avatar, Navbar, NavBrand, Spinner, TabItem, Tabs} from "flowbite-svelte";
|
||||
import {Navbar, NavBrand, Spinner, TabItem, Tabs} from "flowbite-svelte";
|
||||
import EventEdit from "./event/EventEdit.svelte";
|
||||
import {ArrowLeftSolid} from "flowbite-svelte-icons";
|
||||
import FightList from "./event/FightList.svelte";
|
||||
import {eventRepo} from "../../repo/repo";
|
||||
import {eventRepo} from "@repo/repo.ts";
|
||||
import TeamList from "./event/TeamList.svelte";
|
||||
|
||||
export let params: { id: number };
|
||||
|
@ -18,15 +18,12 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Avatar, Navbar, NavBrand, Spinner, TabItem, Tabs} from "flowbite-svelte";
|
||||
import EventEdit from "./event/EventEdit.svelte";
|
||||
import {Navbar, NavBrand, Spinner, TabItem, Tabs} from "flowbite-svelte";
|
||||
import {ArrowLeftSolid} from "flowbite-svelte-icons";
|
||||
import FightList from "./event/FightList.svelte";
|
||||
import {eventRepo} from "../../repo/repo";
|
||||
import TeamList from "./event/TeamList.svelte";
|
||||
import {eventRepo} from "@repo/repo.ts";
|
||||
import GroupGenerator from "./generate/GroupGenerator.svelte";
|
||||
|
||||
export let params: { id: number } = {};
|
||||
export let params: { id: number };
|
||||
|
||||
let id = params.id;
|
||||
let event = $eventRepo.getEvent(id.toString());
|
||||
|
@ -18,13 +18,12 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import {Button, Modal, Navbar, NavBrand, NavHamburger, NavLi, NavUl, Spinner} from "flowbite-svelte";
|
||||
import {replace} from "svelte-spa-router";
|
||||
import {PlusSolid} from "flowbite-svelte-icons";
|
||||
import EventCard from "./home/EventCard.svelte";
|
||||
import CreateEventModal from "./home/CreateEventModal.svelte";
|
||||
import {eventRepo, tokenStore} from "../../repo/repo";
|
||||
import {eventRepo, tokenStore} from "@repo/repo.ts";
|
||||
|
||||
let events = $eventRepo.listEvents()
|
||||
let showAdd = false
|
||||
|
@ -21,8 +21,8 @@
|
||||
import {Button, Input, Label, Spinner, Toast} from "flowbite-svelte";
|
||||
import {fly} from "svelte/transition";
|
||||
import {replace} from "svelte-spa-router";
|
||||
import {EyeOutline, EyeSlashOutline, EyeSolid} from "flowbite-svelte-icons";
|
||||
import {fetchWithToken, tokenStore} from "../../repo/repo";
|
||||
import {EyeOutline, EyeSlashOutline} from "flowbite-svelte-icons";
|
||||
import {fetchWithToken, tokenStore} from "@repo/repo.ts";
|
||||
|
||||
let show = false;
|
||||
let loading = false;
|
||||
|
@ -20,10 +20,9 @@
|
||||
<script lang="ts">
|
||||
import {Button, Card, Checkbox, Input, Label, Navbar, NavBrand, Radio, Spinner} from "flowbite-svelte";
|
||||
import {ArrowLeftSolid} from "flowbite-svelte-icons";
|
||||
import {players} from "../../stores/stores.ts";
|
||||
import {permsRepo} from "../../repo/repo.ts";
|
||||
import {players} from "@stores/stores.ts";
|
||||
import {permsRepo} from "@repo/repo.ts";
|
||||
import {capitalize} from "../util.ts";
|
||||
import type {Player} from "../../types/data.ts";
|
||||
|
||||
let search = "";
|
||||
$: lowerCaseSearch = search.toLowerCase();
|
||||
|
@ -18,12 +18,12 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Spinner, Toolbar, ToolbarButton, ToolbarGroup, Tooltip} from "flowbite-svelte";
|
||||
import {Spinner, Toolbar, ToolbarButton, ToolbarGroup} from "flowbite-svelte";
|
||||
import {json} from "@codemirror/lang-json";
|
||||
import CodeMirror from "svelte-codemirror-editor";
|
||||
import {pageRepo} from "../../../repo/repo.ts";
|
||||
import {pageRepo} from "@repo/repo.ts";
|
||||
import {base64ToBytes} from "../../util.ts";
|
||||
import type {Page} from "../../../types/page.ts";
|
||||
import type {Page} from "@type/page.ts";
|
||||
import {materialDark} from '@ddietr/codemirror-themes/material-dark.js'
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import MDEMarkdownEditor from "./MDEMarkdownEditor.svelte";
|
||||
|
@ -18,13 +18,13 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type {ExtendedEvent} from "../../../types/event.js";
|
||||
import {Button, Heading, Input, Label, Modal, Range, Select, Toast, Toggle} from "flowbite-svelte";
|
||||
import {schemTypes} from "../../../stores/stores";
|
||||
import type {ExtendedEvent} from "@type/event.ts";
|
||||
import {Button, Input, Label, Modal, Range, Select, Toast, Toggle} from "flowbite-svelte";
|
||||
import {schemTypes} from "@stores/stores.ts";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc"
|
||||
import type {UpdateEvent} from "../../../repo/event.js";
|
||||
import {eventRepo} from "../../../repo/repo";
|
||||
import type {UpdateEvent} from "@repo/event.ts";
|
||||
import {eventRepo} from "@repo/repo.ts";
|
||||
import ErrorModal from "../../components/ErrorModal.svelte";
|
||||
import {replace} from "svelte-spa-router";
|
||||
import {CheckCircleOutline} from "flowbite-svelte-icons";
|
||||
@ -43,7 +43,7 @@
|
||||
let spectateSystem = event.spectateSystem;
|
||||
|
||||
let errorOpen = false;
|
||||
let error: Error = undefined;
|
||||
let error: any = undefined;
|
||||
let deleteOpen = false;
|
||||
|
||||
$: deadlineDate = dayjs(deadline);
|
||||
|
@ -18,13 +18,13 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {EditOutline, InboxSolid, TrashBinOutline} from "flowbite-svelte-icons";
|
||||
import {Button, Checkbox, Modal, Toolbar, ToolbarButton} from "flowbite-svelte";
|
||||
import type {EventFight, ExtendedEvent} from "../../../types/event.js";
|
||||
import {EditOutline, TrashBinOutline} from "flowbite-svelte-icons";
|
||||
import {Button, Modal, Toolbar, ToolbarButton} from "flowbite-svelte";
|
||||
import type {EventFight, ExtendedEvent} from "@type/event.ts";
|
||||
import FightEditModal from "./modals/FightEditModal.svelte";
|
||||
import {createEventDispatcher, onMount} from "svelte";
|
||||
import {fightRepo} from "../../../repo/repo";
|
||||
import {isWide} from "../../../stores/stores";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import {fightRepo} from "@repo/repo.ts";
|
||||
import {isWide} from "@stores/stores.ts";
|
||||
|
||||
export let fight: EventFight;
|
||||
export let data: ExtendedEvent;
|
||||
|
@ -18,7 +18,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type {EventFight, ExtendedEvent} from "../../../types/event.js";
|
||||
import type {EventFight, ExtendedEvent} from "@type/event.ts";
|
||||
import {
|
||||
Button,
|
||||
Checkbox, Input, Label,
|
||||
@ -36,12 +36,12 @@
|
||||
} from "flowbite-svelte-icons";
|
||||
import FightCard from "./FightCard.svelte";
|
||||
import CreateFightModal from "./modals/CreateFightModal.svelte";
|
||||
import {fightRepo} from "../../../repo/repo";
|
||||
import {groups, players} from "../../../stores/stores";
|
||||
import {fightRepo} from "@repo/repo.ts";
|
||||
import {groups, players} from "@stores/stores.ts";
|
||||
import TypeAheadSearch from "../../components/TypeAheadSearch.svelte";
|
||||
import type {UpdateFight} from "../../../repo/fight.js";
|
||||
import type {UpdateFight} from "@repo/fight.ts";
|
||||
import dayjs from "dayjs";
|
||||
import * as duration from "dayjs/plugin/duration"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
dayjs.extend(duration)
|
||||
|
||||
export let data: ExtendedEvent;
|
||||
|
@ -18,8 +18,8 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Avatar, Button, Modal} from "flowbite-svelte";
|
||||
import type {ExtendedEvent} from "../../../types/event.js";
|
||||
import {Avatar} from "flowbite-svelte";
|
||||
import type {ExtendedEvent} from "@type/event.ts";
|
||||
|
||||
export let data: ExtendedEvent;
|
||||
</script>
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {Button, Modal} from "flowbite-svelte";
|
||||
import type {ExtendedEvent} from "../../../../types/event.js";
|
||||
import type {ExtendedEvent} from "@type/event.ts";
|
||||
import FightEditPart from "../../../components/FightEditPart.svelte";
|
||||
import {fightRepo} from "../../../../repo/repo";
|
||||
import type {CreateFight} from "../../../../repo/fight.ts";
|
||||
import {fightRepo} from "@repo/repo.ts";
|
||||
import ErrorModal from "../../../components/ErrorModal.svelte";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import dayjs from "dayjs";
|
||||
@ -40,12 +39,12 @@
|
||||
let gamemode: string = "";
|
||||
let map: string = "";
|
||||
|
||||
let kampfleiter: string | null = null;
|
||||
let kampfleiter: string | undefined = undefined;
|
||||
let group: string | null = null;
|
||||
let groupSearch = "";
|
||||
|
||||
let errorOpen = false;
|
||||
let error: Error | null = null;
|
||||
let error: any = undefined;
|
||||
|
||||
$: canCreate = blueTeam !== "" && redTeam !== "" && start !== "" && gamemode !== "" && map !== "";
|
||||
|
||||
|
@ -18,11 +18,11 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import {Button, Input, Label, Modal, Select} from "flowbite-svelte";
|
||||
import type {EventFight, ExtendedEvent} from "../../../../types/event.js";
|
||||
import {Button, Modal} from "flowbite-svelte";
|
||||
import type {EventFight, ExtendedEvent} from "@type/event.ts";
|
||||
import FightEditPart from "../../../components/FightEditPart.svelte";
|
||||
import type {UpdateFight} from "../../../../repo/fight.js";
|
||||
import {fightRepo} from "../../../../repo/repo";
|
||||
import type {UpdateFight} from "@repo/fight.ts";
|
||||
import {fightRepo} from "@repo/repo.ts";
|
||||
import ErrorModal from "../../../components/ErrorModal.svelte";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import dayjs from "dayjs";
|
||||
@ -37,14 +37,14 @@
|
||||
let redTeam = fight.redTeam.id.toString();
|
||||
let blueTeam = fight.blueTeam.id.toString();
|
||||
let start = dayjs(fight.start).utc(true).toISOString().slice(0, -1);
|
||||
let kampfleiter = fight.kampfleiter.id.toString();
|
||||
let kampfleiter = fight.kampfleiter?.id.toString();
|
||||
let gamemode = fight.spielmodus
|
||||
let map = fight.map;
|
||||
let group = fight.group;
|
||||
let groupSearch = fight.group ?? "";
|
||||
|
||||
let errorOpen = false;
|
||||
let error = undefined;
|
||||
let error: any = undefined;
|
||||
|
||||
let dispatch = createEventDispatcher();
|
||||
function save() {
|
||||
|
@ -36,7 +36,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="w-56 bg-gray-800 p-4 rounded" class:border={dragover} class:m-px={!dragover} on:drop={handleDrop} on:dragover={handleDragOver} on:dragleave={() => dragover = false}>
|
||||
<div class="w-56 bg-gray-800 p-4 rounded" class:border={dragover} class:m-px={!dragover} on:drop={handleDrop} on:dragover={handleDragOver} on:dragleave={() => dragover = false} role="none">
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
|
@ -18,14 +18,14 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type {ExtendedEvent} from "../../../types/event.js";
|
||||
import type {ExtendedEvent} from "@type/event.ts";
|
||||
import TeamChip from "./TeamChip.svelte";
|
||||
import type {Team} from "../../../types/team.js";
|
||||
import type {Team} from "@type/team.ts";
|
||||
import DragAcceptor from "./DragAcceptor.svelte";
|
||||
import {Button, Input, Label, Modal, Range, Select} from "flowbite-svelte";
|
||||
import {gamemodes, maps} from "../../../stores/stores";
|
||||
import {gamemodes, maps} from "@stores/stores.ts";
|
||||
import {PlusSolid} from "flowbite-svelte-icons";
|
||||
import {fightRepo} from "../../../repo/repo";
|
||||
import {fightRepo} from "@repo/repo.ts";
|
||||
import {replace} from "svelte-spa-router";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type {Team} from "../../../types/team.js";
|
||||
import type {Team} from "@type/team.ts";
|
||||
import {brightness, colorFromTeam, lighten} from "../../util";
|
||||
|
||||
export let team: Team;
|
||||
@ -30,7 +30,8 @@
|
||||
style:background-color={hover ? lighten(colorFromTeam(team)) : colorFromTeam(team)} class:text-black={brightness(colorFromTeam(team))} draggable="true"
|
||||
on:dragstart
|
||||
on:mouseenter={() => hover = true}
|
||||
on:mouseleave={() => hover = false}>
|
||||
on:mouseleave={() => hover = false}
|
||||
role="figure">
|
||||
<span>{team.name}</span>
|
||||
</div>
|
||||
|
||||
|
@ -21,14 +21,14 @@
|
||||
import {Button, Input, Label, Modal} from "flowbite-svelte";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import ErrorModal from "../../components/ErrorModal.svelte";
|
||||
import {eventRepo} from "../../../repo/repo";
|
||||
import {eventRepo} from "@repo/repo.ts";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export let open = false;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let errorOpen = false;
|
||||
let error = undefined;
|
||||
let error: any = undefined;
|
||||
|
||||
let eventName = "";
|
||||
let start = "";
|
||||
@ -47,7 +47,7 @@
|
||||
})
|
||||
dispatch("create");
|
||||
open = false;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
error = e;
|
||||
errorOpen = true;
|
||||
open = false;
|
||||
|
@ -20,7 +20,7 @@
|
||||
<script lang="ts">
|
||||
import {Card} from "flowbite-svelte";
|
||||
import {link} from 'svelte-spa-router'
|
||||
import type {ShortEvent} from "../../../types/event.js";
|
||||
import type {ShortEvent} from "@type/event.ts";
|
||||
|
||||
export let event: ShortEvent;
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
import Color from "color";
|
||||
import type {Team} from "../types/team.js";
|
||||
import type {ListPage, PageList} from "../types/page.ts";
|
||||
import type {Team} from "@type/team.js";
|
||||
import type {ListPage, PageList} from "@type/page.ts";
|
||||
|
||||
export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
|
||||
|
||||
@ -28,7 +28,7 @@ export const nameRegex = new RegExp("(?!.*\/).+(?=\\.(md|json))");
|
||||
export function mapToMap(pages: PageList): Map<string, ListPage[]> {
|
||||
const map = new Map();
|
||||
for (const page of pages) {
|
||||
let folder = page.path.substring(0, page.path.indexOf(nameRegex.exec(page.path)!![0]));
|
||||
const folder = page.path.substring(0, page.path.indexOf(nameRegex.exec(page.path)![0]));
|
||||
if (!map.has(folder)) {
|
||||
map.set(folder, []);
|
||||
}
|
||||
@ -39,47 +39,47 @@ export function mapToMap(pages: PageList): Map<string, ListPage[]> {
|
||||
|
||||
export function colorFromTeam(team: Team): string {
|
||||
switch (team.color) {
|
||||
case "1":
|
||||
return "#0000AA";
|
||||
case "2":
|
||||
return "#00AA00";
|
||||
case "3":
|
||||
return "#00AAAA";
|
||||
case "4":
|
||||
return "#AA0000";
|
||||
case "5":
|
||||
return "#AA00AA";
|
||||
case "6":
|
||||
return "#FFAA00";
|
||||
case "7":
|
||||
return "#AAAAAA";
|
||||
case "8":
|
||||
return "#555555";
|
||||
case "9":
|
||||
return "#5555FF";
|
||||
case "a":
|
||||
return "#55FF55";
|
||||
case "b":
|
||||
return "#55FFFF";
|
||||
case "c":
|
||||
return "#FF5555";
|
||||
case "d":
|
||||
return "#FF55FF";
|
||||
case "e":
|
||||
return "#FFFF55";
|
||||
case "f":
|
||||
return "#FFFFFF";
|
||||
default:
|
||||
return "#000000";
|
||||
case "1":
|
||||
return "#0000AA";
|
||||
case "2":
|
||||
return "#00AA00";
|
||||
case "3":
|
||||
return "#00AAAA";
|
||||
case "4":
|
||||
return "#AA0000";
|
||||
case "5":
|
||||
return "#AA00AA";
|
||||
case "6":
|
||||
return "#FFAA00";
|
||||
case "7":
|
||||
return "#AAAAAA";
|
||||
case "8":
|
||||
return "#555555";
|
||||
case "9":
|
||||
return "#5555FF";
|
||||
case "a":
|
||||
return "#55FF55";
|
||||
case "b":
|
||||
return "#55FFFF";
|
||||
case "c":
|
||||
return "#FF5555";
|
||||
case "d":
|
||||
return "#FF55FF";
|
||||
case "e":
|
||||
return "#FFFF55";
|
||||
case "f":
|
||||
return "#FFFFFF";
|
||||
default:
|
||||
return "#000000";
|
||||
}
|
||||
}
|
||||
|
||||
export function lighten(color: string) {
|
||||
return brightness(color) ? Color(color).lighten(0.2).hex() : Color(color).darken(0.2).hex()
|
||||
return brightness(color) ? Color(color).lighten(0.2).hex() : Color(color).darken(0.2).hex();
|
||||
}
|
||||
|
||||
export function brightness(color: string) {
|
||||
return Color(color).isLight()
|
||||
return Color(color).isLight();
|
||||
}
|
||||
|
||||
export function base64ToBytes(base64: string) {
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import {schemRepo} from "../repo/repo";
|
||||
import {schemRepo} from "@repo/repo";
|
||||
import {Modal, Spinner} from "flowbite-svelte";
|
||||
import SchematicInfoModal from "./SchematicInfoModal.svelte";
|
||||
import type {Player} from "../types/data.ts";
|
||||
import type {Player} from "@type/data.ts";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
import {astroI18n, t} from "astro-i18n";
|
||||
import {CheckSolid, XCircleOutline} from "flowbite-svelte-icons";
|
||||
import {Modal} from "flowbite-svelte";
|
||||
import type {SchematicInfo} from "../types/schem.ts";
|
||||
import type {SchematicInfo} from "@type/schem.ts";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import {schemRepo} from "../repo/repo";
|
||||
import type {Player} from "../types/data.ts";
|
||||
import {schemRepo} from "@repo/repo";
|
||||
import type {Player} from "@type/data.ts";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -28,12 +28,12 @@
|
||||
InfoCircleOutline
|
||||
} from "flowbite-svelte-icons";
|
||||
import SchematicListTile from "./SchematicListTile.svelte";
|
||||
import {Breadcrumb, BreadcrumbItem, Pagination, Tooltip} from "flowbite-svelte";
|
||||
import {Breadcrumb, BreadcrumbItem, Tooltip} from "flowbite-svelte";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import type {SchematicList} from "../types/schem.ts";
|
||||
import type {SchematicList} from "@type/schem.ts";
|
||||
import SchematicInfo from "./SchematicInfo.svelte";
|
||||
import UploadModal from "./UploadModal.svelte";
|
||||
import type {Player} from "../types/data.ts";
|
||||
import type {Player} from "@type/data.ts";
|
||||
import SWButton from "../styled/SWButton.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -20,8 +20,8 @@
|
||||
<script lang="ts">
|
||||
import {astroI18n, t} from "astro-i18n";
|
||||
import {CheckSolid, FileOutline, FolderOutline, XCircleOutline} from "flowbite-svelte-icons";
|
||||
import type {Schematic} from "../types/schem.ts";
|
||||
import type {Player} from "../types/data.ts";
|
||||
import type {Schematic} from "@type/schem.ts";
|
||||
import type {Player} from "@type/data.ts";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type {Player} from "../types/data.ts";
|
||||
import {statsRepo} from "../repo/repo.ts";
|
||||
import type {Player} from "@type/data.ts";
|
||||
import {statsRepo} from "@repo/repo.ts";
|
||||
import {astroI18n, t} from "astro-i18n"
|
||||
|
||||
export let user: Player;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {Modal} from "flowbite-svelte";
|
||||
import {schemRepo} from "../repo/repo.ts";
|
||||
import {schemRepo} from "@repo/repo.ts";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import {t} from "astro-i18n";
|
||||
import type {Player} from "../types/data.ts";
|
||||
import {authRepo, tokenStore} from "../repo/repo.ts";
|
||||
import {l} from "../../util/util.ts";
|
||||
import type {Player} from "@type/data.ts";
|
||||
import {authRepo, tokenStore} from "@repo/repo.ts";
|
||||
import {l} from "@utils/util.ts";
|
||||
import Statistics from "./Statistics.svelte";
|
||||
|
||||
export let user: Player;
|
||||
|
@ -17,8 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {Player, Server} from "../types/data.ts";
|
||||
import {PlayerSchema, ServerSchema} from "../types/data.ts";
|
||||
import type {Player, Server} from "@type/data.ts";
|
||||
import {PlayerSchema, ServerSchema} from "@type/data.ts";
|
||||
import {fetchWithToken} from "./repo.ts";
|
||||
|
||||
export class DataRepo {
|
||||
|
@ -17,9 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {ExtendedEvent, ShortEvent, SWEvent} from "../types/event.js";
|
||||
import type {ExtendedEvent, ShortEvent, SWEvent} from "@type/event";
|
||||
import {fetchWithToken} from "./repo";
|
||||
import {ExtendedEventSchema, ShortEventSchema, SWEventSchema} from "../types/event.js";
|
||||
import {ExtendedEventSchema, ShortEventSchema, SWEventSchema} from "@type/event.js";
|
||||
import {z} from "zod";
|
||||
import type {Dayjs} from "dayjs";
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {EventFight} from "../types/event.js";
|
||||
import type {EventFight} from "@type/event.js";
|
||||
import {fetchWithToken} from "./repo";
|
||||
import {z} from "zod";
|
||||
import {EventFightSchema} from "../types/event.js";
|
||||
import {EventFightSchema} from "@type/event.js";
|
||||
import type {Dayjs} from "dayjs";
|
||||
|
||||
export interface CreateFight {
|
||||
|
@ -17,9 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {Page, PageList} from "../types/page.ts";
|
||||
import type {Page, PageList} from "@type/page.ts";
|
||||
import {fetchWithToken} from "./repo.ts";
|
||||
import {PageListSchema, PageSchema} from "../types/page.ts";
|
||||
import {PageListSchema, PageSchema} from "@type/page.ts";
|
||||
import {bytesToBase64} from "../admin/util.ts";
|
||||
import {z} from "zod";
|
||||
|
||||
@ -30,13 +30,13 @@ export class PageRepo {
|
||||
return await fetchWithToken(this.token, `/page?branch=${branch}`)
|
||||
.then(value => value.json())
|
||||
.then(PageListSchema.parse)
|
||||
.then(value => value.map(value1 => ({...value1, path: value1.path.replace("src/content/", "")})))
|
||||
.then(value => value.map(value1 => ({...value1, path: value1.path.replace("src/content/", "")})));
|
||||
}
|
||||
|
||||
public async getPage(id: number, branch: string = "master"): Promise<Page> {
|
||||
return await fetchWithToken(this.token, `/page/${id}?branch=${branch}`)
|
||||
.then(value => value.json())
|
||||
.then(PageSchema.parse)
|
||||
.then(PageSchema.parse);
|
||||
}
|
||||
|
||||
public async updatePage(id: number, content: string, sha: string, message: string, branch: string = "master"): Promise<void> {
|
||||
@ -46,32 +46,32 @@ export class PageRepo {
|
||||
content: bytesToBase64(new TextEncoder().encode(content)),
|
||||
sha, message
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public async getBranches(): Promise<string[]> {
|
||||
return await fetchWithToken(this.token, "/page/branch")
|
||||
.then(value => value.json())
|
||||
.then(value => z.array(z.string()).parse(value))
|
||||
.then(value => z.array(z.string()).parse(value));
|
||||
}
|
||||
|
||||
public async createBranch(branch: string): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page/branch`, {method: "POST", body: JSON.stringify({branch})})
|
||||
await fetchWithToken(this.token, "/page/branch", {method: "POST", body: JSON.stringify({branch})});
|
||||
}
|
||||
|
||||
public async deleteBranch(branch: string): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page/branch`, {method: "DELETE", body: JSON.stringify({branch})})
|
||||
await fetchWithToken(this.token, "/page/branch", {method: "DELETE", body: JSON.stringify({branch})});
|
||||
}
|
||||
|
||||
public async createFile(path: string, branch: string = "master"): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page?branch=${branch}`, {method: "POST", body: JSON.stringify({path})})
|
||||
await fetchWithToken(this.token, `/page?branch=${branch}`, {method: "POST", body: JSON.stringify({path})});
|
||||
}
|
||||
|
||||
public async merge(branch: string, message: string): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page/branch/merge`, {method: "POST", body: JSON.stringify({branch, message})})
|
||||
await fetchWithToken(this.token, "/page/branch/merge", {method: "POST", body: JSON.stringify({branch, message})});
|
||||
}
|
||||
|
||||
public async deletePage(id: number, message: string, sha: string, branch: string = "master"): Promise<void> {
|
||||
await fetchWithToken(this.token, `/page/${id}?branch=${branch}`, {method: "DELETE", body: JSON.stringify({message, sha})})
|
||||
await fetchWithToken(this.token, `/page/${id}?branch=${branch}`, {method: "DELETE", body: JSON.stringify({message, sha})});
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {Perms, UserPerms} from "../types/perms.js";
|
||||
import type {Perms, UserPerms} from "@type/perms.js";
|
||||
import {fetchWithToken} from "./repo";
|
||||
import {PermsSchema, UserPermsSchema} from "../types/perms.js";
|
||||
import {PermsSchema, UserPermsSchema} from "@type/perms.js";
|
||||
|
||||
export class PermsRepo {
|
||||
constructor(private token: string) {}
|
||||
|
@ -18,18 +18,16 @@
|
||||
*/
|
||||
|
||||
import {derived, writable} from "svelte/store";
|
||||
import {EventRepo} from "./event.js";
|
||||
import {FightRepo} from "./fight.js";
|
||||
import {PermsRepo} from "./perms.js";
|
||||
import {PageRepo} from "./page.ts";
|
||||
import {DataRepo} from "./data.ts";
|
||||
import {EventRepo} from "./event";
|
||||
import {FightRepo} from "./fight";
|
||||
import {PermsRepo} from "./perms";
|
||||
import {PageRepo} from "./page";
|
||||
import {DataRepo} from "./data";
|
||||
import {SchematicRepo} from "./schem";
|
||||
import {StatsRepo} from "./stats";
|
||||
import {AuthRepo} from "./auth";
|
||||
|
||||
import { AES, enc, format } from "crypto-js";
|
||||
import {SchematicRepo} from "./schem.ts";
|
||||
import {StatsRepo} from "./stats.ts";
|
||||
import {AuthRepo} from "./auth.ts";
|
||||
|
||||
export { EventRepo } from "./event.js"
|
||||
import { AES, enc } from "crypto-js";
|
||||
|
||||
export const apiUrl = import.meta.env.PUBLIC_API_SERVER;
|
||||
const secret = import.meta.env.PUBLIC_SECRET;
|
||||
@ -43,14 +41,14 @@ function decryptToken(token: string): string {
|
||||
}
|
||||
|
||||
export const fetchWithToken = (token: string, url: string, params: RequestInit = {}) => fetch(`${apiUrl}${url}`, {...params, headers: {...(token !== "" ? {"Authorization": "Bearer " + (token)}:{}), "Content-Type": "application/json", ...params.headers}});
|
||||
export const tokenStore = writable(decryptToken(localStorage.getItem("sw-session") ?? ""))
|
||||
tokenStore.subscribe((value) => localStorage.setItem("sw-session", encryptToken(value)))
|
||||
export const tokenStore = writable(decryptToken(localStorage.getItem("sw-session") ?? ""));
|
||||
tokenStore.subscribe((value) => localStorage.setItem("sw-session", encryptToken(value)));
|
||||
|
||||
export const eventRepo = derived(tokenStore, ($token) => new EventRepo($token))
|
||||
export const fightRepo = derived(tokenStore, ($token) => new FightRepo($token))
|
||||
export const permsRepo = derived(tokenStore, ($token) => new PermsRepo($token))
|
||||
export const pageRepo = derived(tokenStore, ($token) => new PageRepo($token))
|
||||
export const dataRepo = derived(tokenStore, ($token) => new DataRepo($token))
|
||||
export const schemRepo = derived(tokenStore, ($token) => new SchematicRepo($token))
|
||||
export const statsRepo = derived(tokenStore, ($token) => new StatsRepo($token))
|
||||
export const authRepo = derived(tokenStore, ($token) => new AuthRepo($token))
|
||||
export const eventRepo = derived(tokenStore, ($token) => new EventRepo($token));
|
||||
export const fightRepo = derived(tokenStore, ($token) => new FightRepo($token));
|
||||
export const permsRepo = derived(tokenStore, ($token) => new PermsRepo($token));
|
||||
export const pageRepo = derived(tokenStore, ($token) => new PageRepo($token));
|
||||
export const dataRepo = derived(tokenStore, ($token) => new DataRepo($token));
|
||||
export const schemRepo = derived(tokenStore, ($token) => new SchematicRepo($token));
|
||||
export const statsRepo = derived(tokenStore, ($token) => new StatsRepo($token));
|
||||
export const authRepo = derived(tokenStore, ($token) => new AuthRepo($token));
|
||||
|
@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
import {fetchWithToken} from "./repo.ts";
|
||||
import type {SchematicCode, SchematicInfo, SchematicList} from "../types/schem.ts";
|
||||
import {SchematicCodeSchema, SchematicInfoSchema, SchematicListSchema} from "../types/schem.ts";
|
||||
import type {SchematicCode, SchematicInfo, SchematicList} from "@type/schem.ts";
|
||||
import {SchematicCodeSchema, SchematicInfoSchema, SchematicListSchema} from "@type/schem.ts";
|
||||
|
||||
export class SchematicRepo {
|
||||
constructor(private token: string) {}
|
||||
@ -41,12 +41,12 @@ export class SchematicRepo {
|
||||
}
|
||||
|
||||
public async uploadSchematic(name: string, content: string) {
|
||||
return await fetchWithToken(this.token, `/schem`, {
|
||||
return await fetchWithToken(this.token, "/schem", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name,
|
||||
content
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {FightStats, Ranking, UserStats} from "../types/stats.ts";
|
||||
import type {FightStats, Ranking, UserStats} from "@type/stats.ts";
|
||||
import {fetchWithToken} from "./repo.ts";
|
||||
import {FightStatsSchema, RankingSchema, UserStatsSchema} from "../types/stats.ts";
|
||||
import {FightStatsSchema, RankingSchema, UserStatsSchema} from "@type/stats.ts";
|
||||
|
||||
export class StatsRepo {
|
||||
|
||||
@ -30,7 +30,7 @@ export class StatsRepo {
|
||||
}
|
||||
|
||||
public async getFightStats(): Promise<FightStats> {
|
||||
return await fetchWithToken(this.token, `/stats/fights`).then(value => value.json()).then(FightStatsSchema.parse);
|
||||
return await fetchWithToken(this.token, "/stats/fights").then(value => value.json()).then(FightStatsSchema.parse);
|
||||
}
|
||||
|
||||
public async getUserStats(id: number): Promise<UserStats> {
|
||||
|
@ -33,7 +33,7 @@ export function cached<T>(normal: T, init: () => Promise<T>): Cached<T> {
|
||||
init().then(data => {
|
||||
store.set(data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
...readonly(store),
|
||||
@ -52,7 +52,7 @@ export function cachedFamily<T, K>(normal: K, init: (arg0: T) => Promise<K>): (a
|
||||
const stores: Map<T, Cached<K>> = new Map();
|
||||
return (arg: T) => {
|
||||
if(stores.has(arg)) {
|
||||
return stores.get(arg)!!;
|
||||
return stores.get(arg)!;
|
||||
} else {
|
||||
const store = writable<K>(normal);
|
||||
let first = true;
|
||||
@ -61,7 +61,7 @@ export function cachedFamily<T, K>(normal: K, init: (arg0: T) => Promise<K>): (a
|
||||
init(arg).then(data => {
|
||||
store.set(data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const cachedStore = {
|
||||
...readonly(store),
|
||||
@ -78,5 +78,5 @@ export function cachedFamily<T, K>(normal: K, init: (arg0: T) => Promise<K>): (a
|
||||
stores.set(arg, cachedStore);
|
||||
return cachedStore;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -17,28 +17,28 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type {Player, SchematicType} from "../types/data.js";
|
||||
import {PlayerSchema} from "../types/data.js";
|
||||
import {cached, cachedFamily} from "./cached.js";
|
||||
import type {Team} from "../types/team.js";
|
||||
import {TeamSchema} from "../types/team.js";
|
||||
import type {Player, SchematicType} from "@type/data";
|
||||
import {PlayerSchema} from "@type/data.ts";
|
||||
import {cached, cachedFamily} from "./cached";
|
||||
import type {Team} from "@type/team.ts";
|
||||
import {TeamSchema} from "@type/team";
|
||||
import {derived, get, writable} from "svelte/store";
|
||||
import {dataRepo, fetchWithToken, pageRepo, tokenStore} from "../repo/repo";
|
||||
import {dataRepo, fetchWithToken, pageRepo, tokenStore} from "@repo/repo.ts";
|
||||
import {z} from "zod";
|
||||
|
||||
export const schemTypes = cached<SchematicType[]>([], () =>
|
||||
fetchWithToken(get(tokenStore), `/data/schematicTypes`)
|
||||
.then(res => res.json()))
|
||||
fetchWithToken(get(tokenStore), "/data/schematicTypes")
|
||||
.then(res => res.json()));
|
||||
|
||||
export const players = cached<Player[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), `/data/users`);
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/users");
|
||||
return z.array(PlayerSchema).parse(await res.json());
|
||||
})
|
||||
});
|
||||
|
||||
export const gamemodes = cached<string[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), `/data/gamemodes`);
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/gamemodes");
|
||||
return z.array(z.string()).parse(await res.json());
|
||||
})
|
||||
});
|
||||
|
||||
export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
|
||||
if (get(gamemodes).every(value => value !== gamemode)) return [];
|
||||
@ -49,22 +49,22 @@ export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
|
||||
} else {
|
||||
return res.json();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
export const groups = cached<string[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), `/data/groups`);
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/groups");
|
||||
return z.array(z.string()).parse(await res.json());
|
||||
})
|
||||
});
|
||||
|
||||
export const teams = cached<Team[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), `/team`);
|
||||
const res = await fetchWithToken(get(tokenStore), "/team");
|
||||
return z.array(TeamSchema).parse(await res.json());
|
||||
})
|
||||
});
|
||||
|
||||
export const branches = cached<string[]>([], async () => {
|
||||
const res = await get(pageRepo).getBranches();
|
||||
return z.array(z.string()).parse(res);
|
||||
})
|
||||
});
|
||||
|
||||
export const server = derived(dataRepo, $dataRepo => $dataRepo.getServer());
|
||||
|
||||
|
@ -22,7 +22,7 @@ import {z} from "zod";
|
||||
export const SchematicTypeSchema = z.object({
|
||||
name: z.string(),
|
||||
db: z.string(),
|
||||
})
|
||||
});
|
||||
|
||||
export type SchematicType = z.infer<typeof SchematicTypeSchema>;
|
||||
|
||||
@ -32,7 +32,7 @@ export const PlayerSchema = z.object({
|
||||
uuid: z.string(),
|
||||
prefix: z.string(),
|
||||
perms: z.array(z.string()),
|
||||
})
|
||||
});
|
||||
|
||||
export type Player = z.infer<typeof PlayerSchema>;
|
||||
|
||||
@ -48,6 +48,6 @@ export const ServerSchema = z.object({
|
||||
protocol: z.number()
|
||||
}),
|
||||
favicon: z.string().optional()
|
||||
})
|
||||
});
|
||||
|
||||
export type Server = z.infer<typeof ServerSchema>;
|
||||
|
@ -26,7 +26,7 @@ export const ShortEventSchema = z.object({
|
||||
name: z.string(),
|
||||
start: z.number(),
|
||||
end: z.number(),
|
||||
})
|
||||
});
|
||||
|
||||
export type ShortEvent = z.infer<typeof ShortEventSchema>;
|
||||
|
||||
@ -36,7 +36,7 @@ export const SWEventSchema = ShortEventSchema.extend({
|
||||
schemType: z.string().nullable(),
|
||||
publicSchemsOnly: z.boolean(),
|
||||
spectateSystem: z.boolean(),
|
||||
})
|
||||
});
|
||||
|
||||
export type SWEvent = z.infer<typeof SWEventSchema>;
|
||||
|
||||
@ -50,7 +50,7 @@ export const EventFightSchema = z.object({
|
||||
start: z.number(),
|
||||
ergebnis: z.number(),
|
||||
group: z.string().nullable(),
|
||||
})
|
||||
});
|
||||
|
||||
export type EventFight = z.infer<typeof EventFightSchema>;
|
||||
|
||||
@ -58,6 +58,6 @@ export const ExtendedEventSchema = z.object({
|
||||
event: SWEventSchema,
|
||||
teams: z.array(TeamSchema),
|
||||
fights: z.array(EventFightSchema),
|
||||
})
|
||||
});
|
||||
|
||||
export type ExtendedEvent = z.infer<typeof ExtendedEventSchema>;
|
||||
|
@ -29,7 +29,7 @@ export const ListPageSchema = z.object({
|
||||
|
||||
export type ListPage = z.infer<typeof ListPageSchema>;
|
||||
|
||||
export const PageListSchema = z.array(ListPageSchema)
|
||||
export const PageListSchema = z.array(ListPageSchema);
|
||||
|
||||
export type PageList = z.infer<typeof PageListSchema>;
|
||||
|
||||
@ -41,7 +41,7 @@ export const PageSchema = z.object({
|
||||
content: z.string(),
|
||||
size: z.number().gte(0),
|
||||
id: z.number().positive()
|
||||
})
|
||||
});
|
||||
|
||||
export type Page = z.infer<typeof PageSchema>;
|
||||
|
||||
|
@ -23,20 +23,20 @@ export const PrefixSchema = z.object({
|
||||
name: z.string().startsWith("PREFIX_"),
|
||||
colorCode: z.string().length(2).startsWith("§"),
|
||||
chatPrefix: z.string()
|
||||
})
|
||||
});
|
||||
|
||||
export type Prefix = z.infer<typeof PrefixSchema>;
|
||||
|
||||
export const PermsSchema = z.object({
|
||||
perms: z.array(z.string()),
|
||||
prefixes: z.record(PrefixSchema),
|
||||
})
|
||||
});
|
||||
|
||||
export type Perms = z.infer<typeof PermsSchema>;
|
||||
|
||||
export const UserPermsSchema = z.object({
|
||||
prefix: PrefixSchema,
|
||||
perms: z.array(z.string()),
|
||||
})
|
||||
});
|
||||
|
||||
export type UserPerms = z.infer<typeof UserPermsSchema>;
|
||||
|
@ -30,7 +30,7 @@ export const SchematicSchema = z.object({
|
||||
rank: z.number(),
|
||||
replaceColor: z.boolean(),
|
||||
allowReplay: z.boolean()
|
||||
})
|
||||
});
|
||||
|
||||
export type Schematic = z.infer<typeof SchematicSchema>
|
||||
|
||||
@ -41,7 +41,7 @@ export const SchematicListSchema = z.object({
|
||||
})),
|
||||
schematics: z.array(SchematicSchema),
|
||||
players: z.record(z.string(), PlayerSchema)
|
||||
})
|
||||
});
|
||||
|
||||
export type SchematicList = z.infer<typeof SchematicListSchema>
|
||||
|
||||
@ -49,7 +49,7 @@ export const SchematicInfoSchema = z.object({
|
||||
members: z.array(PlayerSchema),
|
||||
path: z.string(),
|
||||
schem: SchematicSchema
|
||||
})
|
||||
});
|
||||
|
||||
export type SchematicInfo = z.infer<typeof SchematicInfoSchema>
|
||||
|
||||
@ -57,6 +57,6 @@ export const SchematicCodeSchema = z.object({
|
||||
id: z.number().gte(0),
|
||||
code: z.string(),
|
||||
expires: z.number().positive()
|
||||
})
|
||||
});
|
||||
|
||||
export type SchematicCode = z.infer<typeof SchematicCodeSchema>
|
@ -22,7 +22,7 @@ import {z} from "zod";
|
||||
export const RankingSchema = z.array(z.object({
|
||||
name: z.string(),
|
||||
elo: z.number(),
|
||||
}))
|
||||
}));
|
||||
|
||||
export type Ranking = z.infer<typeof RankingSchema>;
|
||||
|
||||
@ -30,7 +30,7 @@ export const FightStatsSchema = z.array(z.object({
|
||||
date: z.string(),
|
||||
gamemode: z.string(),
|
||||
count: z.number(),
|
||||
}))
|
||||
}));
|
||||
|
||||
export type FightStats = z.infer<typeof FightStatsSchema>;
|
||||
|
||||
@ -40,6 +40,6 @@ export const UserStatsSchema = z.object({
|
||||
acceptedSchematics: z.number(),
|
||||
fights: z.number(),
|
||||
playtime: z.number()
|
||||
})
|
||||
});
|
||||
|
||||
export type UserStats = z.infer<typeof UserStatsSchema>;
|
@ -24,8 +24,6 @@ export const TeamSchema = z.object({
|
||||
name: z.string(),
|
||||
kuerzel: z.string().min(1).max(4),
|
||||
color: z.string().max(1),
|
||||
})
|
||||
});
|
||||
|
||||
export type Team = z.infer<typeof TeamSchema>;
|
||||
|
||||
|
||||
|
@ -80,5 +80,16 @@
|
||||
},
|
||||
"elo": {
|
||||
"place": "Platz"
|
||||
},
|
||||
"announcements": {
|
||||
"table": {
|
||||
"time": "Startzeit",
|
||||
"blue": "Blaues Team",
|
||||
"red": "Rotes Team",
|
||||
"winner": "Sieger",
|
||||
"notPlayed": "Nicht gespielt",
|
||||
"draw": "Unentschieden",
|
||||
"points": "Punkte"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,9 @@
|
||||
"time": "Time",
|
||||
"blue": "Blue Team",
|
||||
"red": "Red Team",
|
||||
"winner": "Winner",
|
||||
"notPlayed": "Not Played",
|
||||
"draw": "Draw",
|
||||
"team": "Team",
|
||||
"points": "Points"
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
---
|
||||
import {astroI18n, createGetStaticPaths} from "astro-i18n";
|
||||
import {getCollection, CollectionEntry} from "astro:content";
|
||||
import PageLayout from "../../layouts/PageLayout.astro";
|
||||
import PageLayout from "@layouts/PageLayout.astro";
|
||||
import {TagSolid, CalendarMonthSolid} from "flowbite-svelte-icons";
|
||||
import TagComponent from "../../components/TagComponent.astro";
|
||||
import LanguageWarning from "../../components/LanguageWarning.astro";
|
||||
import TagComponent from "@components/TagComponent.astro";
|
||||
import LanguageWarning from "@components/LanguageWarning.astro";
|
||||
import { SEO } from "astro-seo";
|
||||
import localBau from "../../images/2022-03-28_13.18.25.png";
|
||||
import localBau from "@images/2022-03-28_13.18.25.png";
|
||||
import {getImage, Image} from "astro:assets";
|
||||
|
||||
export const getStaticPaths = createGetStaticPaths(async () => {
|
||||
@ -88,12 +88,12 @@ const ogImage = await getImage({
|
||||
)}
|
||||
<Content />
|
||||
<script>
|
||||
import type {ExtendedEvent} from "../../components/types/event";
|
||||
import FightTable from "../../components/FightTable.svelte";
|
||||
import type {ExtendedEvent} from "@types/event";
|
||||
import FightTable from "@components/FightTable.svelte";
|
||||
// @ts-expect-error Import Schenanigans
|
||||
import {get} from "svelte/store";
|
||||
import {eventRepo} from "../../components/repo/repo";
|
||||
import GroupTable from "../../components/GroupTable.svelte";
|
||||
import {eventRepo} from "@repo/repo";
|
||||
import GroupTable from "@components/GroupTable.svelte";
|
||||
const eventMounts: Map<string, ((ev: ExtendedEvent) => void)[]> = new Map();
|
||||
|
||||
class FightTableElement extends HTMLElement {
|
||||
|
@ -1,14 +1,14 @@
|
||||
---
|
||||
import NavbarLayout from "../layouts/NavbarLayout.astro";
|
||||
import NavbarLayout from "@layouts/NavbarLayout.astro";
|
||||
|
||||
import { Image } from "astro:assets";
|
||||
import localBau from "../images/2023-10-08_20.43.43.png";
|
||||
import localBau from "@images/2023-10-08_20.43.43.png";
|
||||
import {CaretRight, Archive, Rocket, Bell} from "@astropub/icons";
|
||||
import {t} from "astro-i18n";
|
||||
import {l} from "../util/util";
|
||||
import PlayerCount from "../components/PlayerCount.svelte";
|
||||
import {l} from "@utils/util";
|
||||
import PlayerCount from "@components/PlayerCount.svelte";
|
||||
import "../../public/fonts/barlow-condensed/barlow-condensed.css";
|
||||
import type {Player} from "../components/types/data";
|
||||
import type {Player} from "@components/types/data";
|
||||
|
||||
const teamMember = await fetch("http://localhost:1337/data/team").then(value => value.json());
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
---
|
||||
import Login from "../components/Login.svelte";
|
||||
import NavbarLayout from "../layouts/NavbarLayout.astro";
|
||||
import Login from "@components/Login.svelte";
|
||||
import NavbarLayout from "@layouts/NavbarLayout.astro";
|
||||
import {t} from "astro-i18n";
|
||||
import {Image} from "astro:assets";
|
||||
import localBau from "../images/2023-10-08_20.43.43.png";
|
||||
import localBau from "@images/2023-10-08_20.43.43.png";
|
||||
---
|
||||
|
||||
<NavbarLayout title={t("login.page")}>
|
||||
|
@ -1,3 +1,25 @@
|
||||
{
|
||||
"extends": "astro/tsconfigs/strict"
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@components/*": ["./src/components/*"],
|
||||
"@components": ["./src/components"],
|
||||
"@pages/*": ["./src/pages/*"],
|
||||
"@pages": ["./src/pages"],
|
||||
"@styles/*": ["./src/styles/*"],
|
||||
"@styles": ["./src/styles"],
|
||||
"@utils/*": ["./src/util/*"],
|
||||
"@utils": ["./src/util"],
|
||||
"@type/*": ["./src/components/types/*"],
|
||||
"@type": ["./src/components/types"],
|
||||
"@images/*": ["./src/images/*"],
|
||||
"@images": ["./src/images"],
|
||||
"@layouts/*": ["./src/layouts/*"],
|
||||
"@layouts": ["./src/layouts"],
|
||||
"@repo/*": ["./src/components/repo/*"],
|
||||
"@repo": ["./src/components/repo"],
|
||||
"@stores/*": ["./src/components/stores/*"],
|
||||
"@stores": ["./src/components/stores"],
|
||||
}
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren