Fixing and Sitemap and Robots.txt

Dieser Commit ist enthalten in:
Chaoscaot 2023-12-10 17:14:10 +01:00
Ursprung 3d95bffb6a
Commit 6c9c496f05
33 geänderte Dateien mit 150 neuen und 57 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,5 @@
import type { AstroIntegration } from "astro"; import type { AstroIntegration } from "astro";
import { mkdir, rename, access, constants } from 'node:fs/promises' import { mkdir, access, constants, copyFile } from 'node:fs/promises'
import {rm} from "fs/promises";
const locales = ["de"]; const locales = ["de"];
@ -21,14 +20,10 @@ export default function configureI18n(): AstroIntegration {
await mkdir(cutPrefix(newPath), {recursive: true}); await mkdir(cutPrefix(newPath), {recursive: true});
} }
await rename(`${cutPrefix(oldPath)}index.html`, `${cutPrefix(newPath)}index.${locale}.html`) await copyFile(`${cutPrefix(oldPath)}index.html`, `${cutPrefix(newPath)}index.${locale}.html`)
logger.info(`Renamed ${oldPath} to ${newPath}`) logger.info(`Copied ${oldPath}index.html to ${newPath}index.${locale}.html`)
} }
} }
for (let locale of locales) {
await rm(`${cutPrefix(dir.pathname)}${locale}`, {recursive: true, force: true})
}
} }
} }
} }

Datei anzeigen

@ -2,14 +2,31 @@ import { defineConfig, sharpImageService } from 'astro/config';
import svelte from "@astrojs/svelte"; import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind"; import tailwind from "@astrojs/tailwind";
import configureI18n from "./astro-i18n.adapter"; import configureI18n from "./astro-i18n.adapter";
import sitemap from "@astrojs/sitemap";
import robotsTxt from "astro-robots-txt";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
output: "static", output: "static",
image: { image: {
service: sharpImageService(), service: sharpImageService()
}, },
compressHTML: true, compressHTML: true,
integrations: [svelte(), tailwind(), configureI18n()], site: "https://steamwar.de",
integrations: [svelte(), tailwind(), configureI18n(), sitemap({
i18n: {
defaultLocale: "en",
locales: {
en: "en-US",
de: "de-DE"
}
}
}), robotsTxt({
policy: [{
userAgent: "*",
disallow: ["/admin", "/login", "/dashboard", "/de", "/_astro"]
}]
})],
vite: {} vite: {}
}); });

Datei anzeigen

@ -30,10 +30,13 @@
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
"dependencies": { "dependencies": {
"@astrojs/sitemap": "^3.0.3",
"@codemirror/lang-json": "^6.0.1", "@codemirror/lang-json": "^6.0.1",
"@ddietr/codemirror-themes": "^1.4.2", "@ddietr/codemirror-themes": "^1.4.2",
"astro": "^4.0.3", "astro": "^4.0.3",
"astro-i18n": "^2.1.18", "astro-i18n": "^2.1.18",
"astro-robots-txt": "^1.0.0",
"astro-seo": "^0.8.0",
"chart.js": "^4.4.1", "chart.js": "^4.4.1",
"chartjs-adapter-dayjs-4": "^1.0.4", "chartjs-adapter-dayjs-4": "^1.0.4",
"chartjs-adapter-moment": "^1.0.1", "chartjs-adapter-moment": "^1.0.1",

Datei anzeigen

@ -5,6 +5,9 @@ settings:
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
dependencies: dependencies:
'@astrojs/sitemap':
specifier: ^3.0.3
version: 3.0.3
'@codemirror/lang-json': '@codemirror/lang-json':
specifier: ^6.0.1 specifier: ^6.0.1
version: 6.0.1 version: 6.0.1
@ -17,6 +20,12 @@ dependencies:
astro-i18n: astro-i18n:
specifier: ^2.1.18 specifier: ^2.1.18
version: 2.1.18(esbuild@0.19.8) version: 2.1.18(esbuild@0.19.8)
astro-robots-txt:
specifier: ^1.0.0
version: 1.0.0
astro-seo:
specifier: ^0.8.0
version: 0.8.0
chart.js: chart.js:
specifier: ^4.4.1 specifier: ^4.4.1
version: 4.4.1 version: 4.4.1
@ -155,6 +164,13 @@ packages:
dependencies: dependencies:
prismjs: 1.29.0 prismjs: 1.29.0
/@astrojs/sitemap@3.0.3:
resolution: {integrity: sha512-+GRKp1yho9dpHBcMcU6JpbL41k0yYZghOkNsMRb8QIRflbGHvd787tdv9oIZ5NJj0SqAuOlqp2UpqLkJXuAe2A==}
dependencies:
sitemap: 7.1.1
zod: 3.22.4
dev: false
/@astrojs/svelte@5.0.0(astro@4.0.3)(svelte@4.2.8)(typescript@5.3.3)(vite@5.0.7): /@astrojs/svelte@5.0.0(astro@4.0.3)(svelte@4.2.8)(typescript@5.3.3)(vite@5.0.7):
resolution: {integrity: sha512-v8AZU9hSP4JuESDv5pev8S4eZQXulIoS/gBJbhAEBWfkANptsc7CP/qjWk83KWidNXX8hfVLI4VNlShWo3ADRw==} resolution: {integrity: sha512-v8AZU9hSP4JuESDv5pev8S4eZQXulIoS/gBJbhAEBWfkANptsc7CP/qjWk83KWidNXX8hfVLI4VNlShWo3ADRw==}
engines: {node: '>=18.14.1'} engines: {node: '>=18.14.1'}
@ -984,11 +1000,21 @@ packages:
dependencies: dependencies:
'@types/unist': 2.0.10 '@types/unist': 2.0.10
/@types/node@17.0.45:
resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==}
dev: false
/@types/node@20.10.4: /@types/node@20.10.4:
resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==}
dependencies: dependencies:
undici-types: 5.26.5 undici-types: 5.26.5
/@types/sax@1.2.7:
resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==}
dependencies:
'@types/node': 20.10.4
dev: false
/@types/tern@0.23.9: /@types/tern@0.23.9:
resolution: {integrity: sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==} resolution: {integrity: sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==}
dependencies: dependencies:
@ -1086,6 +1112,17 @@ packages:
esbuild: 0.19.8 esbuild: 0.19.8
dev: false dev: false
/astro-robots-txt@1.0.0:
resolution: {integrity: sha512-6JQSLid4gMhoWjOm85UHLkgrw0+hHIjnJVIUqxjU2D6feKlVyYukMNYjH44ZDZBK1P8hNxd33PgWlHzCASvedA==}
dependencies:
valid-filename: 4.0.0
zod: 3.22.4
dev: false
/astro-seo@0.8.0:
resolution: {integrity: sha512-7gq6lhibCM8FuzZIJlbLLWP5EJ9KL2/4XqeFrAg9O6ZK2xMFxJ5ubKf+a0VJwwTu8W8Xr421CmpiXu6Hq7n/7Q==}
dev: false
/astro@4.0.3(@types/node@20.10.4)(sass@1.69.5)(typescript@5.3.3): /astro@4.0.3(@types/node@20.10.4)(sass@1.69.5)(typescript@5.3.3):
resolution: {integrity: sha512-hrwe7CIVhSKW8/iibDs1hpqzZAtvx6Qu8TFFxjaGbooEWF720M9L+ZZtyTgrcy6K/ZHJ0xwFvZV3/X2Vvbf/LQ==} resolution: {integrity: sha512-hrwe7CIVhSKW8/iibDs1hpqzZAtvx6Qu8TFFxjaGbooEWF720M9L+ZZtyTgrcy6K/ZHJ0xwFvZV3/X2Vvbf/LQ==}
engines: {node: '>=18.14.1', npm: '>=6.14.0'} engines: {node: '>=18.14.1', npm: '>=6.14.0'}
@ -1860,6 +1897,11 @@ packages:
dependencies: dependencies:
reusify: 1.0.4 reusify: 1.0.4
/filename-reserved-regex@3.0.0:
resolution: {integrity: sha512-hn4cQfU6GOT/7cFHXBqeBg2TbrMBgdD0kcjLhvSQYYwm3s4B6cjvBfb7nBALJLAXqmU5xajSa7X2NnUud/VCdw==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dev: false
/fill-range@7.0.1: /fill-range@7.0.1:
resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -3694,6 +3736,17 @@ packages:
/sisteransi@1.0.5: /sisteransi@1.0.5:
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
/sitemap@7.1.1:
resolution: {integrity: sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==}
engines: {node: '>=12.0.0', npm: '>=5.6.0'}
hasBin: true
dependencies:
'@types/node': 17.0.45
'@types/sax': 1.2.7
arg: 5.0.2
sax: 1.3.0
dev: false
/source-map-js@1.0.2: /source-map-js@1.0.2:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -4197,6 +4250,13 @@ packages:
/util-deprecate@1.0.2: /util-deprecate@1.0.2:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
/valid-filename@4.0.0:
resolution: {integrity: sha512-VEYTpTVPMgO799f2wI7zWf0x2C54bPX6NAfbZ2Z8kZn76p+3rEYCTYVYzMUcVSMvakxMQTriBf24s3+WeXJtEg==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dependencies:
filename-reserved-regex: 3.0.0
dev: false
/vfile-location@5.0.2: /vfile-location@5.0.2:
resolution: {integrity: sha512-NXPYyxyBSH7zB5U6+3uDdd6Nybz6o6/od9rk8bp9H8GR3L+cm/fC0uUTbqBmUTnMCUDslAGBOIKNfvvb+gGlDg==} resolution: {integrity: sha512-NXPYyxyBSH7zB5U6+3uDdd6Nybz6o6/od9rk8bp9H8GR3L+cm/fC0uUTbqBmUTnMCUDslAGBOIKNfvvb+gGlDg==}
dependencies: dependencies:

Datei anzeigen

@ -0,0 +1,8 @@
---
import {t} from "astro-i18n";
---
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4" role="alert">
<p class="font-bold">{t("warning.title")}</p>
<p>{t("warning.text")}</p>
</div>

11
src/components/P.astro Normale Datei
Datei anzeigen

@ -0,0 +1,11 @@
---
interface Props {
class: string;
}
const { class: s } = Astro.props as Props;
---
<p class={s}>
<slot></slot>
</p>

Datei anzeigen

@ -4,6 +4,7 @@ import {l} from "../util/util";
import {astroI18n} from "astro-i18n"; import {astroI18n} from "astro-i18n";
import {Image} from "astro:assets"; import {Image} from "astro:assets";
import TagComponent from "./TagComponent.astro"; import TagComponent from "./TagComponent.astro";
import P from "./P.astro";
interface Props { interface Props {
post: CollectionEntry<'announcements'> post: CollectionEntry<'announcements'>
@ -21,12 +22,12 @@ const { post } = Astro.props as Props;
) : null} ) : null}
<div> <div>
<h2 class="text-2xl font-bold">{post.data.title}</h2> <h2 class="text-2xl font-bold">{post.data.title}</h2>
<div class="text-gray-500">{Intl.DateTimeFormat(astroI18n.locale, { <P class="text-gray-500">{Intl.DateTimeFormat(astroI18n.locale, {
day: "numeric", day: "numeric",
month: "long", month: "long",
year: "numeric" year: "numeric"
}).format(post.data.created)}</div> }).format(post.data.created)}</P>
<div>{post.data.description}</div> <P>{post.data.description}</P>
<div> <div>
{post.data.tags.map((tag) => ( {post.data.tags.map((tag) => (
<TagComponent tag={tag} /> <TagComponent tag={tag} />

Datei anzeigen

@ -22,7 +22,7 @@
import wrap from "svelte-spa-router/wrap"; import wrap from "svelte-spa-router/wrap";
import Router, {replace} from "svelte-spa-router"; import Router, {replace} from "svelte-spa-router";
import {get} from "svelte/store"; import {get} from "svelte/store";
import {tokenStore} from "../repo/repo.js"; import {tokenStore} from "../repo/repo";
const routes: RouteDefinition = { const routes: RouteDefinition = {
'/': wrap({asyncComponent: () => import('./pages/Home.svelte'), conditions: detail => get(tokenStore) != ""}), '/': wrap({asyncComponent: () => import('./pages/Home.svelte'), conditions: detail => get(tokenStore) != ""}),

Datei anzeigen

@ -20,7 +20,7 @@
<script lang="ts"> <script lang="ts">
import {Input, Label, Select} from "flowbite-svelte"; import {Input, Label, Select} from "flowbite-svelte";
import TypeAheadSearch from "./TypeAheadSearch.svelte"; import TypeAheadSearch from "./TypeAheadSearch.svelte";
import {gamemodes, groups, maps, players} from "../../stores/stores.js"; import {gamemodes, groups, maps, players} from "../../stores/stores";
import type {Team} from '../../types/team.js'; import type {Team} from '../../types/team.js';
export let teams: Team[] = []; export let teams: Team[] = [];

Datei anzeigen

@ -20,7 +20,7 @@
<script lang="ts"> <script lang="ts">
import {ArrowLeftSolid} from "flowbite-svelte-icons"; import {ArrowLeftSolid} from "flowbite-svelte-icons";
import {Button, Card, Input, Label, Navbar, NavBrand, NavHamburger, NavUl, Spinner} from "flowbite-svelte"; import {Button, Card, Input, Label, Navbar, NavBrand, NavHamburger, NavUl, Spinner} from "flowbite-svelte";
import {pageRepo} from "../../repo/repo.js"; import {pageRepo} from "../../repo/repo";
import {mapToMap, nameRegex} from "../util.ts"; import {mapToMap, nameRegex} from "../util.ts";
import TypeAheadSearch from "../components/TypeAheadSearch.svelte"; import TypeAheadSearch from "../components/TypeAheadSearch.svelte";
import {branches} from "../../stores/stores.ts"; import {branches} from "../../stores/stores.ts";

Datei anzeigen

@ -22,7 +22,7 @@
import EventEdit from "./event/EventEdit.svelte"; import EventEdit from "./event/EventEdit.svelte";
import {ArrowLeftSolid} from "flowbite-svelte-icons"; import {ArrowLeftSolid} from "flowbite-svelte-icons";
import FightList from "./event/FightList.svelte"; import FightList from "./event/FightList.svelte";
import {eventRepo} from "../../repo/repo.js"; import {eventRepo} from "../../repo/repo";
import TeamList from "./event/TeamList.svelte"; import TeamList from "./event/TeamList.svelte";
export let params: { id: number }; export let params: { id: number };

Datei anzeigen

@ -22,7 +22,7 @@
import EventEdit from "./event/EventEdit.svelte"; import EventEdit from "./event/EventEdit.svelte";
import {ArrowLeftSolid} from "flowbite-svelte-icons"; import {ArrowLeftSolid} from "flowbite-svelte-icons";
import FightList from "./event/FightList.svelte"; import FightList from "./event/FightList.svelte";
import {eventRepo} from "../../repo/repo.js"; import {eventRepo} from "../../repo/repo";
import TeamList from "./event/TeamList.svelte"; import TeamList from "./event/TeamList.svelte";
import GroupGenerator from "./generate/GroupGenerator.svelte"; import GroupGenerator from "./generate/GroupGenerator.svelte";

Datei anzeigen

@ -24,7 +24,7 @@
import {PlusSolid} from "flowbite-svelte-icons"; import {PlusSolid} from "flowbite-svelte-icons";
import EventCard from "./home/EventCard.svelte"; import EventCard from "./home/EventCard.svelte";
import CreateEventModal from "./home/CreateEventModal.svelte"; import CreateEventModal from "./home/CreateEventModal.svelte";
import {eventRepo, tokenStore} from "../../repo/repo.js"; import {eventRepo, tokenStore} from "../../repo/repo";
let events = $eventRepo.listEvents() let events = $eventRepo.listEvents()
let showAdd = false let showAdd = false

Datei anzeigen

@ -22,7 +22,7 @@
import {fly} from "svelte/transition"; import {fly} from "svelte/transition";
import {replace} from "svelte-spa-router"; import {replace} from "svelte-spa-router";
import {EyeOutline, EyeSlashOutline, EyeSolid} from "flowbite-svelte-icons"; import {EyeOutline, EyeSlashOutline, EyeSolid} from "flowbite-svelte-icons";
import {fetchWithToken, tokenStore} from "../../repo/repo.js"; import {fetchWithToken, tokenStore} from "../../repo/repo";
let show = false; let show = false;
let loading = false; let loading = false;

Datei anzeigen

@ -20,11 +20,11 @@
<script lang="ts"> <script lang="ts">
import type {ExtendedEvent} from "../../../types/event.js"; import type {ExtendedEvent} from "../../../types/event.js";
import {Button, Heading, Input, Label, Modal, Range, Select, Toast, Toggle} from "flowbite-svelte"; import {Button, Heading, Input, Label, Modal, Range, Select, Toast, Toggle} from "flowbite-svelte";
import {schemTypes} from "../../../stores/stores.js"; import {schemTypes} from "../../../stores/stores";
import dayjs from "dayjs"; import dayjs from "dayjs";
import utc from "dayjs/plugin/utc" import utc from "dayjs/plugin/utc"
import type {UpdateEvent} from "../../../repo/event.js"; import type {UpdateEvent} from "../../../repo/event.js";
import {eventRepo} from "../../../repo/repo.js"; import {eventRepo} from "../../../repo/repo";
import ErrorModal from "../../components/ErrorModal.svelte"; import ErrorModal from "../../components/ErrorModal.svelte";
import {replace} from "svelte-spa-router"; import {replace} from "svelte-spa-router";
import {CheckCircleOutline} from "flowbite-svelte-icons"; import {CheckCircleOutline} from "flowbite-svelte-icons";

Datei anzeigen

@ -23,8 +23,8 @@
import type {EventFight, ExtendedEvent} from "../../../types/event.js"; import type {EventFight, ExtendedEvent} from "../../../types/event.js";
import FightEditModal from "./modals/FightEditModal.svelte"; import FightEditModal from "./modals/FightEditModal.svelte";
import {createEventDispatcher, onMount} from "svelte"; import {createEventDispatcher, onMount} from "svelte";
import {fightRepo} from "../../../repo/repo.js"; import {fightRepo} from "../../../repo/repo";
import {isWide} from "../../../stores/stores.js"; import {isWide} from "../../../stores/stores";
export let fight: EventFight; export let fight: EventFight;
export let data: ExtendedEvent; export let data: ExtendedEvent;

Datei anzeigen

@ -36,8 +36,8 @@
} from "flowbite-svelte-icons"; } from "flowbite-svelte-icons";
import FightCard from "./FightCard.svelte"; import FightCard from "./FightCard.svelte";
import CreateFightModal from "./modals/CreateFightModal.svelte"; import CreateFightModal from "./modals/CreateFightModal.svelte";
import {fightRepo} from "../../../repo/repo.js"; import {fightRepo} from "../../../repo/repo";
import {groups, players} from "../../../stores/stores.js"; import {groups, players} from "../../../stores/stores";
import TypeAheadSearch from "../../components/TypeAheadSearch.svelte"; import TypeAheadSearch from "../../components/TypeAheadSearch.svelte";
import type {UpdateFight} from "../../../repo/fight.js"; import type {UpdateFight} from "../../../repo/fight.js";
import dayjs from "dayjs"; import dayjs from "dayjs";

Datei anzeigen

@ -21,7 +21,7 @@
import {Button, Modal} from "flowbite-svelte"; import {Button, Modal} from "flowbite-svelte";
import type {ExtendedEvent} from "../../../../types/event.js"; import type {ExtendedEvent} from "../../../../types/event.js";
import FightEditPart from "../../../components/FightEditPart.svelte"; import FightEditPart from "../../../components/FightEditPart.svelte";
import {fightRepo} from "../../../../repo/repo.js"; import {fightRepo} from "../../../../repo/repo";
import type {CreateFight} from "../../../../repo/fight.ts"; import type {CreateFight} from "../../../../repo/fight.ts";
import ErrorModal from "../../../components/ErrorModal.svelte"; import ErrorModal from "../../../components/ErrorModal.svelte";
import {createEventDispatcher} from "svelte"; import {createEventDispatcher} from "svelte";

Datei anzeigen

@ -22,7 +22,7 @@
import type {EventFight, ExtendedEvent} from "../../../../types/event.js"; import type {EventFight, ExtendedEvent} from "../../../../types/event.js";
import FightEditPart from "../../../components/FightEditPart.svelte"; import FightEditPart from "../../../components/FightEditPart.svelte";
import type {UpdateFight} from "../../../../repo/fight.js"; import type {UpdateFight} from "../../../../repo/fight.js";
import {fightRepo} from "../../../../repo/repo.js"; import {fightRepo} from "../../../../repo/repo";
import ErrorModal from "../../../components/ErrorModal.svelte"; import ErrorModal from "../../../components/ErrorModal.svelte";
import {createEventDispatcher} from "svelte"; import {createEventDispatcher} from "svelte";
import dayjs from "dayjs"; import dayjs from "dayjs";

Datei anzeigen

@ -23,9 +23,9 @@
import type {Team} from "../../../types/team.js"; import type {Team} from "../../../types/team.js";
import DragAcceptor from "./DragAcceptor.svelte"; import DragAcceptor from "./DragAcceptor.svelte";
import {Button, Input, Label, Modal, Range, Select} from "flowbite-svelte"; import {Button, Input, Label, Modal, Range, Select} from "flowbite-svelte";
import {gamemodes, maps} from "../../../stores/stores.js"; import {gamemodes, maps} from "../../../stores/stores";
import {PlusSolid} from "flowbite-svelte-icons"; import {PlusSolid} from "flowbite-svelte-icons";
import {fightRepo} from "../../../repo/repo.js"; import {fightRepo} from "../../../repo/repo";
import {replace} from "svelte-spa-router"; import {replace} from "svelte-spa-router";
import dayjs from "dayjs"; import dayjs from "dayjs";

Datei anzeigen

@ -19,7 +19,7 @@
<script lang="ts"> <script lang="ts">
import type {Team} from "../../../types/team.js"; import type {Team} from "../../../types/team.js";
import {brightness, colorFromTeam, lighten} from "../../util.js"; import {brightness, colorFromTeam, lighten} from "../../util";
export let team: Team; export let team: Team;

Datei anzeigen

@ -21,7 +21,7 @@
import {Button, Input, Label, Modal} from "flowbite-svelte"; import {Button, Input, Label, Modal} from "flowbite-svelte";
import {createEventDispatcher} from "svelte"; import {createEventDispatcher} from "svelte";
import ErrorModal from "../../components/ErrorModal.svelte"; import ErrorModal from "../../components/ErrorModal.svelte";
import {eventRepo} from "../../../repo/repo.js"; import {eventRepo} from "../../../repo/repo";
import dayjs from "dayjs"; import dayjs from "dayjs";
export let open = false; export let open = false;

Datei anzeigen

@ -18,7 +18,7 @@
*/ */
import type {ExtendedEvent, ShortEvent, SWEvent} from "../types/event.js"; import type {ExtendedEvent, ShortEvent, SWEvent} from "../types/event.js";
import {fetchWithToken} from "./repo.js"; import {fetchWithToken} from "./repo";
import {ExtendedEventSchema, ShortEventSchema, SWEventSchema} from "../types/event.js"; import {ExtendedEventSchema, ShortEventSchema, SWEventSchema} from "../types/event.js";
import {z} from "zod"; import {z} from "zod";
import type {Dayjs} from "dayjs"; import type {Dayjs} from "dayjs";

Datei anzeigen

@ -18,7 +18,7 @@
*/ */
import type {EventFight} from "../types/event.js"; import type {EventFight} from "../types/event.js";
import {fetchWithToken} from "./repo.js"; import {fetchWithToken} from "./repo";
import {z} from "zod"; import {z} from "zod";
import {EventFightSchema} from "../types/event.js"; import {EventFightSchema} from "../types/event.js";
import type {Dayjs} from "dayjs"; import type {Dayjs} from "dayjs";

Datei anzeigen

@ -18,7 +18,7 @@
*/ */
import type {Perms, UserPerms} from "../types/perms.js"; import type {Perms, UserPerms} from "../types/perms.js";
import {fetchWithToken} from "./repo.js"; import {fetchWithToken} from "./repo";
import {PermsSchema, UserPermsSchema} from "../types/perms.js"; import {PermsSchema, UserPermsSchema} from "../types/perms.js";
export class PermsRepo { export class PermsRepo {

Datei anzeigen

@ -23,7 +23,7 @@ import {cached, cachedFamily} from "./cached.js";
import type {Team} from "../types/team.js"; import type {Team} from "../types/team.js";
import {TeamSchema} from "../types/team.js"; import {TeamSchema} from "../types/team.js";
import {derived, get, writable} from "svelte/store"; import {derived, get, writable} from "svelte/store";
import {dataRepo, fetchWithToken, pageRepo, tokenStore} from "../repo/repo.js"; import {dataRepo, fetchWithToken, pageRepo, tokenStore} from "../repo/repo";
import {z} from "zod"; import {z} from "zod";
export const schemTypes = cached<SchematicType[]>([], () => export const schemTypes = cached<SchematicType[]>([], () =>

2
src/env.d.ts vendored
Datei anzeigen

@ -31,7 +31,7 @@ type SecondaryLocale = "de"
type Locale = PrimaryLocale | SecondaryLocale type Locale = PrimaryLocale | SecondaryLocale
type RouteParameters = {"/dashboard":undefined;"/downloads":undefined;"/":undefined;"/login":undefined;"/[...slug]":{"slug":unknown;};"/admin":undefined;"/announcements":undefined;"/announcements/[...slug]":{"slug":unknown;};"/announcements/tags/[tag]":{"tag":unknown;};"/help":undefined;"/help/[...slug]":{"slug":unknown;};"/ranked/[...gamemode]":{"gamemode":unknown;};"/rules":undefined;"/rules/[mode]":{"mode":unknown;};"/stats/fight":undefined;} type RouteParameters = {"/dashboard":undefined;"/downloads":undefined;"/":undefined;"/login":undefined;"/[...slug]":{"slug":unknown;};"/admin":undefined;"/announcements":undefined;"/announcements/[...slug]":{"slug":unknown;};"/announcements/tags/[tag]":{"tag":unknown;};"/help":undefined;"/help/[...slug]":{"slug":unknown;};"/ranked/[...gamemode]":{"gamemode":unknown;};"/rules":undefined;"/rules/[mode]":{"mode":unknown;};"/stats/fight":undefined;}
type Route = keyof RouteParameters type Route = keyof RouteParameters
type TranslationVariables = {"dashboard.page":object|undefined;"dashboard.title":{"name"?:unknown;}|undefined;"dashboard.rank":{"rank"?:unknown;}|undefined;"dashboard.permissions":object|undefined;"dashboard.buttons.logout":object|undefined;"dashboard.buttons.admin":object|undefined;"dashboard.schematic.upload":object|undefined;"dashboard.schematic.home":object|undefined;"dashboard.schematic.dir":object|undefined;"dashboard.schematic.head.type":object|undefined;"dashboard.schematic.head.name":object|undefined;"dashboard.schematic.head.owner":object|undefined;"dashboard.schematic.head.updated":object|undefined;"dashboard.schematic.head.replaceColor":object|undefined;"dashboard.schematic.head.allowReplay":object|undefined;"dashboard.schematic.info.path":{"path"?:unknown;}|undefined;"dashboard.schematic.info.replaceColor":object|undefined;"dashboard.schematic.info.allowReplay":object|undefined;"dashboard.schematic.info.type":{"type"?:unknown;}|undefined;"dashboard.schematic.info.updated":{"updated"?:unknown;}|undefined;"dashboard.schematic.info.item":{"item"?:unknown;}|undefined;"dashboard.schematic.info.members":{"members"?:unknown;}|undefined;"dashboard.schematic.info.btn.download":object|undefined;"dashboard.schematic.info.btn.close":object|undefined;"login.page":object|undefined;"login.title":object|undefined;"login.placeholder.username":object|undefined;"login.placeholder.token":object|undefined;"login.label.username":object|undefined;"login.label.token":object|undefined;"login.generateToken":object|undefined;"login.submit":object|undefined;"login.error":object|undefined;"blog.title":object|undefined;"page":object|undefined;"wg.description":object|undefined;"as.description":object|undefined;"ws.description":object|undefined;"mwg.description":object|undefined;"rules":object|undefined;"council":object|undefined;"ranking":object|undefined;"title":{"mode"?:unknown;}|undefined;"warning.title":object|undefined;"warning.text":object|undefined;"stats.title":object|undefined;"navbar.title":object|undefined;"navbar.logo.alt":object|undefined;"navbar.links.home.title":object|undefined;"navbar.links.home.announcements":object|undefined;"navbar.links.home.about":object|undefined;"navbar.links.home.downloads":object|undefined;"navbar.links.home.faq":object|undefined;"navbar.links.rules.title":object|undefined;"navbar.links.rules.gamemode":object|undefined;"navbar.links.rules.wg":object|undefined;"navbar.links.rules.mwg":object|undefined;"navbar.links.rules.ws":object|undefined;"navbar.links.rules.as":object|undefined;"navbar.links.rules.rotating":object|undefined;"navbar.links.rules.megawg":object|undefined;"navbar.links.rules.micro":object|undefined;"navbar.links.rules.sf":object|undefined;"navbar.links.rules.general":object|undefined;"navbar.links.rules.coc":object|undefined;"navbar.links.help.title":object|undefined;"navbar.links.help.center":object|undefined;"navbar.links.help.docs":object|undefined;"navbar.links.account":object|undefined;"status.loading":object|undefined;"status.status":object|undefined;"status.online":object|undefined;"status.offline":object|undefined;"status.players":{"count"?:unknown;}|undefined;"status.version":{"version"?:unknown;}|undefined;"home.page":object|undefined;"home.title.first":object|undefined;"home.title.second":object|undefined;"home.subtitle.1":object|undefined;"home.subtitle.2":object|undefined;"home.subtitle.3":object|undefined;"home.join":object|undefined;"home.benefits.historic.title":object|undefined;"home.benefits.historic.description.1":object|undefined;"home.benefits.historic.description.2":object|undefined;"home.benefits.server.title":object|undefined;"home.benefits.server.description":object|undefined;"home.benefits.events.title":object|undefined;"home.benefits.events.description.1":object|undefined;"home.benefits.events.description.2":object|undefined;"home.prefix.Admin":object|undefined;"home.prefix.Dev":object|undefined;"home.prefix.Mod":object|undefined;"home.prefix.Sup":object|undefined;"home.prefix.Arch":object|undefined;"footer.imprint":object|undefined;"footer.privacy":object|undefined;"footer.coc":object|undefined;"footer.stats":object|undefined;"footer.gamemodes":object|undefined;"footer.announcements":object|undefined;"footer.join":object|undefined;"wg.title":object|undefined;"mwg.title":object|undefined;"ws.title":object|undefined;"as.title":object|undefined;"qg.title":object|undefined;"ranking.heading":{"mode"?:unknown;}|undefined;"announcements.table.time":object|undefined;"announcements.table.blue":object|undefined;"announcements.table.red":object|undefined;"announcements.table.team":object|undefined;"announcements.table.points":object|undefined;} type TranslationVariables = {"dashboard.page":object|undefined;"dashboard.title":{"name"?:unknown;}|undefined;"dashboard.rank":{"rank"?:unknown;}|undefined;"dashboard.permissions":object|undefined;"dashboard.buttons.logout":object|undefined;"dashboard.buttons.admin":object|undefined;"dashboard.schematic.upload":object|undefined;"dashboard.schematic.home":object|undefined;"dashboard.schematic.dir":object|undefined;"dashboard.schematic.head.type":object|undefined;"dashboard.schematic.head.name":object|undefined;"dashboard.schematic.head.owner":object|undefined;"dashboard.schematic.head.updated":object|undefined;"dashboard.schematic.head.replaceColor":object|undefined;"dashboard.schematic.head.allowReplay":object|undefined;"dashboard.schematic.info.path":{"path"?:unknown;}|undefined;"dashboard.schematic.info.replaceColor":object|undefined;"dashboard.schematic.info.allowReplay":object|undefined;"dashboard.schematic.info.type":{"type"?:unknown;}|undefined;"dashboard.schematic.info.updated":{"updated"?:unknown;}|undefined;"dashboard.schematic.info.item":{"item"?:unknown;}|undefined;"dashboard.schematic.info.members":{"members"?:unknown;}|undefined;"dashboard.schematic.info.btn.download":object|undefined;"dashboard.schematic.info.btn.close":object|undefined;"login.page":object|undefined;"login.title":object|undefined;"login.placeholder.username":object|undefined;"login.placeholder.token":object|undefined;"login.label.username":object|undefined;"login.label.token":object|undefined;"login.generateToken":object|undefined;"login.submit":object|undefined;"login.error":object|undefined;"blog.title":object|undefined;"page":object|undefined;"wg.description":object|undefined;"as.description":object|undefined;"ws.description":object|undefined;"mwg.description":object|undefined;"rules":object|undefined;"announcements":object|undefined;"ranking":object|undefined;"title":{"mode"?:unknown;}|undefined;"stats.title":object|undefined;"navbar.title":object|undefined;"navbar.logo.alt":object|undefined;"navbar.links.home.title":object|undefined;"navbar.links.home.announcements":object|undefined;"navbar.links.home.about":object|undefined;"navbar.links.home.downloads":object|undefined;"navbar.links.home.faq":object|undefined;"navbar.links.rules.title":object|undefined;"navbar.links.rules.gamemode":object|undefined;"navbar.links.rules.wg":object|undefined;"navbar.links.rules.mwg":object|undefined;"navbar.links.rules.ws":object|undefined;"navbar.links.rules.as":object|undefined;"navbar.links.rules.qg":object|undefined;"navbar.links.rules.rotating":object|undefined;"navbar.links.rules.megawg":object|undefined;"navbar.links.rules.micro":object|undefined;"navbar.links.rules.sf":object|undefined;"navbar.links.rules.general":object|undefined;"navbar.links.rules.coc":object|undefined;"navbar.links.help.title":object|undefined;"navbar.links.help.center":object|undefined;"navbar.links.help.docs":object|undefined;"navbar.links.account":object|undefined;"status.loading":object|undefined;"status.status":object|undefined;"status.online":object|undefined;"status.offline":object|undefined;"status.players":{"count"?:unknown;}|undefined;"status.version":{"version"?:unknown;}|undefined;"home.page":object|undefined;"home.title.first":object|undefined;"home.title.second":object|undefined;"home.subtitle.1":object|undefined;"home.subtitle.2":object|undefined;"home.subtitle.3":object|undefined;"home.join":object|undefined;"home.benefits.historic.title":object|undefined;"home.benefits.historic.description.1":object|undefined;"home.benefits.historic.description.2":object|undefined;"home.benefits.server.title":object|undefined;"home.benefits.server.description":object|undefined;"home.benefits.events.title":object|undefined;"home.benefits.events.description.1":object|undefined;"home.benefits.events.description.2":object|undefined;"home.prefix.Admin":object|undefined;"home.prefix.Dev":object|undefined;"home.prefix.Mod":object|undefined;"home.prefix.Sup":object|undefined;"home.prefix.Arch":object|undefined;"footer.imprint":object|undefined;"footer.privacy":object|undefined;"footer.coc":object|undefined;"footer.stats":object|undefined;"footer.gamemodes":object|undefined;"footer.announcements":object|undefined;"footer.join":object|undefined;"wg.title":object|undefined;"mwg.title":object|undefined;"ws.title":object|undefined;"as.title":object|undefined;"qg.title":object|undefined;"ranking.heading":{"mode"?:unknown;}|undefined;"announcements.table.time":object|undefined;"announcements.table.blue":object|undefined;"announcements.table.red":object|undefined;"announcements.table.team":object|undefined;"announcements.table.points":object|undefined;"elo.place":object|undefined;"elo.name":object|undefined;"elo.elo":object|undefined;"elo.title":{"mode"?:unknown;}|undefined;"warning.title":object|undefined;"warning.text":object|undefined;}
type Translation = keyof TranslationVariables type Translation = keyof TranslationVariables
type Environment = "none"|"node"|"browser" type Environment = "none"|"node"|"browser"
declare module "astro-i18n" { declare module "astro-i18n" {

Datei anzeigen

@ -124,5 +124,9 @@
"name": "Name", "name": "Name",
"elo": "Elo", "elo": "Elo",
"title": "{# mode #} - Rankings" "title": "{# mode #} - Rankings"
},
"warning": {
"title": "This page is not available in your language.",
"text": "The page you are trying to access is not available in your language. You can still access the original page in German."
} }
} }

Datei anzeigen

@ -15,9 +15,5 @@
"rules": "Rules »", "rules": "Rules »",
"announcements": "Announcements »", "announcements": "Announcements »",
"ranking": "Ranking »", "ranking": "Ranking »",
"title": "{# mode #} - Rules", "title": "{# mode #} - Rules"
"warning": {
"title": "This page is not available in your language.",
"text": "The page you are trying to access is not available in your language. You can still access the original page in German."
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import icon from '../images/logo.png';
import {getImage} from "astro:assets"; import {getImage} from "astro:assets";
import {astroI18n} from "astro-i18n"; import {astroI18n} from "astro-i18n";
const { title, description } = Astro.props.frontmatter || Astro.props; const { title, description } = Astro.props.frontmatter || Astro.props;
import { SEO } from "astro-seo";
const iconImage = await getImage({src: icon, height: 32, width: 32, format: 'png', quality: 100}); const iconImage = await getImage({src: icon, height: 32, width: 32, format: 'png', quality: 100});
--- ---
@ -14,13 +15,16 @@ const iconImage = await getImage({src: icon, height: 32, width: 32, format: 'png
<meta name="viewport" <meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content={description}/>
<meta name="icbm" content="52.370216;4.895168"/> <meta name="icbm" content="52.370216;4.895168"/>
<link rel="icon" type="imgage/png" href={iconImage.src} /> <link rel="icon" type="imgage/png" href={iconImage.src} />
<link rel="stylesheet" href="/fonts/barlow-condensed/barlow-condensed.css" /> <link rel="stylesheet" href="/fonts/barlow-condensed/barlow-condensed.css" />
<title>{title}</title>
<slot name="head" />
<SEO
title={title}
description={description}
/>
<slot name="head" />
</head> </head>
<body class="dark:bg-zinc-800"> <body class="dark:bg-zinc-800">
<slot /> <slot />

Datei anzeigen

@ -2,6 +2,7 @@
import {getCollection} from 'astro:content' import {getCollection} from 'astro:content'
import {astroI18n, createGetStaticPaths, t} from "astro-i18n"; import {astroI18n, createGetStaticPaths, t} from "astro-i18n";
import PageLayout from "../layouts/PageLayout.astro"; import PageLayout from "../layouts/PageLayout.astro";
import LanguageWarning from "../components/LanguageWarning.astro";
export const getStaticPaths = createGetStaticPaths(async () => { export const getStaticPaths = createGetStaticPaths(async () => {
let posts = await getCollection("pages", value => value.id.split("/")[0] === astroI18n.locale); let posts = await getCollection("pages", value => value.id.split("/")[0] === astroI18n.locale);
@ -32,10 +33,7 @@ const { Content } = await page.render();
<PageLayout title={page.data.title}> <PageLayout title={page.data.title}>
<article> <article>
{page.data.german && ( {page.data.german && (
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4" role="alert"> <LanguageWarning />
<div class="font-bold">{t("warning.title", {}, {route: "/rules"})}</div>
<div>{t("warning.text", {}, {route: "/rules"})}</div>
</div>
)} )}
<h1 class="text-left">{page.data.title}</h1> <h1 class="text-left">{page.data.title}</h1>
<Content /> <Content />

Datei anzeigen

@ -4,6 +4,7 @@ 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 {TagSolid, CalendarMonthSolid} from "flowbite-svelte-icons"
import TagComponent from "../../components/TagComponent.astro"; import TagComponent from "../../components/TagComponent.astro";
import LanguageWarning from "../../components/LanguageWarning.astro";
export const getStaticPaths = createGetStaticPaths(async () => { export const getStaticPaths = createGetStaticPaths(async () => {
const posts = await getCollection('announcements', entry => entry.id.split('/')[0] === astroI18n.locale); const posts = await getCollection('announcements', entry => entry.id.split('/')[0] === astroI18n.locale);
@ -49,10 +50,7 @@ const { Content } = await post.render();
year: 'numeric' year: 'numeric'
}).format(post.data.created)} </h5> }).format(post.data.created)} </h5>
{german && ( {german && (
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4" role="alert"> <LanguageWarning />
<div class="font-bold">{t("warning.title", {}, {route: "/rules"})}</div>
<div>{t("warning.text", {}, {route: "/rules"})}</div>
</div>
)} )}
<Content /> <Content />
<script> <script>

Datei anzeigen

@ -2,6 +2,7 @@
import {getCollection, CollectionEntry} from 'astro:content' import {getCollection, CollectionEntry} from 'astro:content'
import {astroI18n, createGetStaticPaths, t} from "astro-i18n"; import {astroI18n, createGetStaticPaths, t} from "astro-i18n";
import PageLayout from "../../layouts/PageLayout.astro"; import PageLayout from "../../layouts/PageLayout.astro";
import LanguageWarning from "../../components/LanguageWarning.astro";
export const getStaticPaths = createGetStaticPaths(async () => { export const getStaticPaths = createGetStaticPaths(async () => {
let posts = await getCollection("rules", value => value.id.split("/")[0] === astroI18n.locale); let posts = await getCollection("rules", value => value.id.split("/")[0] === astroI18n.locale);
@ -34,10 +35,7 @@ const { Content } = await page.render();
<PageLayout title={t("title", {mode: t(`${page.data.translationKey}.title`, {}, {route: "/rules"})}, {route: "/rules"})}> <PageLayout title={t("title", {mode: t(`${page.data.translationKey}.title`, {}, {route: "/rules"})}, {route: "/rules"})}>
<article> <article>
{german && ( {german && (
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4" role="alert"> <LanguageWarning />
<div class="font-bold">{t("warning.title", {}, {route: "/rules"})}</div>
<div>{t("warning.text", {}, {route: "/rules"})}</div>
</div>
)} )}
<Content /> <Content />
</article> </article>