From 154c25ca361625126c13f37be5f99adbc3fac088 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 7 Aug 2024 22:19:04 +0200 Subject: [PATCH] Lixfel anmerkungen #2 --- src/components/Navbar.svelte | 5 ++- src/components/PostComponent.astro | 9 ++++-- src/i18n/common/de.json | 37 ++++++++++++---------- src/i18n/common/en.json | 31 +++++++++--------- src/pages/index.astro | 50 +++++++++++++++++++++++------- src/pages/publics/[mode].astro | 47 ++++++++++++++++++++++++++++ src/pages/publics/index.astro | 34 -------------------- src/pages/regeln/index.astro | 1 + 8 files changed, 132 insertions(+), 82 deletions(-) create mode 100644 src/pages/publics/[mode].astro delete mode 100644 src/pages/publics/index.astro diff --git a/src/components/Navbar.svelte b/src/components/Navbar.svelte index 49caa28..af6dfe8 100644 --- a/src/components/Navbar.svelte +++ b/src/components/Navbar.svelte @@ -85,9 +85,6 @@ {t("navbar.links.rules.micro")} {t("navbar.links.rules.sf")} -

{t("navbar.links.rules.general")}

- {t("navbar.links.rules.publics")} - {t("navbar.links.rules.ranked")} diff --git a/src/components/PostComponent.astro b/src/components/PostComponent.astro index 4996bdd..9a9d0f3 100644 --- a/src/components/PostComponent.astro +++ b/src/components/PostComponent.astro @@ -11,13 +11,16 @@ interface Props { post: CollectionEntry<"announcements"> } -const { post } = Astro.props as Props; +const { post, slim }: { + post: CollectionEntry<"announcements">, + slim: boolean, +} = Astro.props as Props; const postUrl = l(`/announcements/${post.slug.split("/").slice(1).join("/")}`); --- - -
+ +
{post.data.image != null ? ( diff --git a/src/i18n/common/de.json b/src/i18n/common/de.json index cf48ae1..fe9ed6b 100644 --- a/src/i18n/common/de.json +++ b/src/i18n/common/de.json @@ -12,32 +12,36 @@ }, "join": "Jetzt Spielen", "benefits": { - "historic": { - "title": "Historische Spielmodi", + "fights": { + "title": "Spannende Kämpfe", "description": { - "1": "Kämpfe mit Deinen alten WarGears und WarShips!", - "2": "von 1.7 WarGears bis 1.12 WarShips kannst du deine alte Technik wiederverwenden!" + "1": "Messe dich mit anderen Spielern in der Arena und zeige, dass du der beste bist.", + "2": "Von der kleinen Kampfmaschine bis zum riesigen Schlachtschiff kann alles gebaut werden." } }, - "server": { + "bau": { "title": "Eigene Bauserver", - "description": "Um beste Performance zu gewährleisten verfügt jeder Spieler einen eigenen Bauserver, welcher unabhängig von anderen Bauservern arbeitet." + "description": "Jeder Spieler bekommt einen eigenen Bauserver, auf dem ohne Einschränkungen und Lags mit FaWe und Axiom gebaut werden kann." }, - "events": { - "title": "Regelmäßige Events", + "minigames": { + "title": "Kleine Pause gefällig?", "description": { - "1": "Teste dein Können mit deinem Team bei regelmäßig stattfindenden Events.", - "2": "Unser eigenes Eventsystem ist vielseitig verwendbar und ermöglicht einzigartige Kämpfe!" + "1": "Neben der Arena gibt es auch noch Minigames, die du mit anderen Spielern spielen kannst.", + "2": "Klassiker wie MissleWars, TowerRun oder TNTLeague warten auf dich." } }, + "open": { + "title": "Free & Open", + "description": "Das Spielen auf SteamWar ist komplett Kostenlos und unsere Software ist Open Source." + }, "read": "Mehr Lesen" }, "prefix": { - "Admin": "Administrator", - "Dev": "Developer", - "Mod": "Moderator", - "Sup": "Supporter", - "Arch": "Architekt" + "admin": "Administrator", + "developer": "Developer", + "moderator": "Moderator", + "supporter": "Supporter", + "builder": "Architekt" } }, "status": { @@ -218,7 +222,8 @@ "rules": "Regelwerk »", "announcements": "Ankündigungen »", "ranking": "Rangliste »", - "title": "{# mode #} - Regelwerk" + "title": "{# mode #} - Regelwerk", + "publics": "Publics »" }, "stats": { "title": "Kampf Statistiken" diff --git a/src/i18n/common/en.json b/src/i18n/common/en.json index f895c97..1dd3555 100644 --- a/src/i18n/common/en.json +++ b/src/i18n/common/en.json @@ -34,32 +34,35 @@ }, "join": "Join Now", "benefits": { - "historic": { - "title": "Historical Gamemodes", + "fights": { + "title": "Exciting Fights", "description": { - "1": "Play with your old WarGears and WarShips!", - "2": "You can play with your old tech from 1.7 WarGear to 1.12 WarShips" + "1": "Compete with other players in the arena and show that you are the best.", + "2": "From small combat machines to huge battleships, everything can be built." } }, "server": { "title": "Own Build Server", - "description": "To garantuee the best performance, every player has his own build server, which runs independently from other servers." + "description": "Every player gets their own build server to ensure maximum performance and minimal limitations with leading tools like FaWe or Axiom" }, - "events": { - "title": "Regular Turnaments", + "minigames": { + "title": "Need a Break?", "description": { - "1": "Test your skills in regular turnaments!", - "2": "Our own event system is very flexible and allows us to create unique turnaments." + "1": "Besides the Arena, you can also play minigames with other players.", + "2": "like MissleWars, Towerrun or TNTLeague" } }, + "open": { + "description": "Playing on SteamWar is completely free and our software is open source." + }, "read": "Read More" }, "prefix": { - "Admin": "Admin", - "Dev": "Developer", - "Mod": "Moderator", - "Sup": "Supporter", - "Arch": "Builder" + "admin": "Admin", + "developer": "Developer", + "moderator": "Moderator", + "supporter": "Supporter", + "builder": "Builder" } }, "footer": { diff --git a/src/pages/index.astro b/src/pages/index.astro index 73a60e3..59850e1 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,18 +1,36 @@ --- +import dayjs from "dayjs"; import NavbarLayout from "@layouts/NavbarLayout.astro"; +import {getCollection} from "astro:content"; +import {astroI18n} from "astro-i18n"; import {Image} from "astro:assets"; import Card from "@components/Card.svelte"; import localBau from "@images/2023-10-08_20.43.43.png"; -import {CaretRight, Archive, Rocket, Bell} from "@astropub/icons"; +import {CaretRight, Pause, Rocket, Code, Crosshair1} from "@astropub/icons"; import {t} from "astro-i18n"; import {l} from "@utils/util"; import PlayerCount from "@components/PlayerCount.svelte"; import "../../public/fonts/barlow-condensed/barlow-condensed.css"; import {Player} from "../components/types/data"; +import PostComponent from "../components/PostComponent.astro"; const teamMember: { [key: string]: Player[]} = await fetch("http://127.0.0.1:1337/data/team") .then(value => value.json()); + +const posts = await getCollection("announcements", entry => entry.id.split("/")[0] === astroI18n.locale); + +const germanPosts = await getCollection("announcements", entry => entry.id.split("/")[0] === astroI18n.fallbackLocale); + +germanPosts.forEach(value => { + if (posts.find(post => post.data.key === value.data.key)) { + return; + } else { + posts.push(value); + } +}); + +const latestPost = posts.sort((a, b) => dayjs(b.data.created).unix() - dayjs(a.data.created).unix()).at(0); --- @@ -106,32 +124,40 @@ const teamMember: { [key: string]: Player[]} = await fetch("http://127.0.0.1:133 customElements.define("drop-in", DropIn); +
+ +
- -

{t("home.benefits.historic.title")}

-

{t("home.benefits.historic.description.1")}

-

{t("home.benefits.historic.description.2")}

+ +

{t("home.benefits.fights.title")}

+

{t("home.benefits.fights.description.1")}

+

{t("home.benefits.fights.description.2")}

-

{t("home.benefits.server.title")}

-

{t("home.benefits.server.description")}

+

{t("home.benefits.bau.title")}

+

{t("home.benefits.bau.description")}

- -

{t("home.benefits.events.title")}

-

{t("home.benefits.events.description.1")}

-

{t("home.benefits.events.description.2")}

+ +

{t("home.benefits.minigames.title")}

+

{t("home.benefits.minigames.description.1")}

+

{t("home.benefits.minigames.description.2")}

+
+ + +

{t("home.benefits.open.title")}

+

{t("home.benefits.open.description")}

{Object.entries(teamMember).map(([prefix, players]) => (
-

{t("home.prefix." + prefix)}

+

{t("home.prefix." + prefix.replace("PREFIX_", "").toLowerCase())}

{players.map(v => ( diff --git a/src/pages/publics/[mode].astro b/src/pages/publics/[mode].astro new file mode 100644 index 0000000..88d0bf1 --- /dev/null +++ b/src/pages/publics/[mode].astro @@ -0,0 +1,47 @@ +--- +import {createGetStaticPaths} from "astro-i18n"; +import PageLayout from "../../layouts/PageLayout.astro"; +import {getCollection} from "astro:content"; +import {l} from "../../util/util"; +import { Image } from "astro:assets"; +import Card from "@components/Card.svelte"; +import XRayPreview from "@components/publics/XRayPreview.svelte"; +import {t} from "astro-i18n"; + +const { mode } = Astro.props; + +export const getStaticPaths = createGetStaticPaths(async () => { + const gamemodes = await getCollection("modes"); + + return gamemodes.map((entry) => ({ + props: { + mode: entry, + }, + params: { + mode: entry.id, + }, + })); +}); + +const publics = await getCollection("publics", entry => entry.data.gamemode.id == mode.id); +--- + + +

{t(`${mode.data.translationKey}.title`)}

+
+ diff --git a/src/pages/publics/index.astro b/src/pages/publics/index.astro deleted file mode 100644 index b93d0c5..0000000 --- a/src/pages/publics/index.astro +++ /dev/null @@ -1,34 +0,0 @@ ---- -import PageLayout from "../../layouts/PageLayout.astro"; -import {getCollection} from "astro:content"; -import {l} from "../../util/util"; -import { Image } from "astro:assets"; -import Card from "@components/Card.svelte"; -import XRayPreview from "@components/publics/XRayPreview.svelte"; -import {t} from "astro-i18n"; - -const gamemodes = await getCollection("modes"); -const publics = await getCollection("publics"); ---- - - - {gamemodes.filter(value => publics.map(value1 => value1.data.gamemode.id).includes(value.id)).map((gamemode) => ( -

{t(`${gamemode.data.translationKey}.title`)}

-
- {publics.filter(value => value.data.gamemode.id == gamemode.id).map((pub) => ( - - -
- - {pub.data.name} - {pub.data.xray && {pub.data.name}} - -
-

{pub.data.name}

-

{pub.data.description}

-
-
- ))} -
- ))} -
diff --git a/src/pages/regeln/index.astro b/src/pages/regeln/index.astro index 425861c..fc19c64 100644 --- a/src/pages/regeln/index.astro +++ b/src/pages/regeln/index.astro @@ -31,6 +31,7 @@ const modes = await getCollection("modes", entry => entry.data.main);
{t("rules." + value.data.translationKey + ".description")}