Lixfel anmerkungen #1
This commit is contained in:
@@ -9,33 +9,10 @@ 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 type {Player} from "@components/types/data";
|
||||
import {Player} from "../components/types/data";
|
||||
|
||||
const teamMember = await fetch("http://127.0.0.1:1337/data/team").then(value => value.json());
|
||||
|
||||
function groupByGroup(array) {
|
||||
const groups = new Map<string, Player[]>();
|
||||
|
||||
for (let user of array) {
|
||||
if (groups.has(user.prefix)) {
|
||||
groups.get(user.prefix).push(user);
|
||||
} else {
|
||||
groups.set(user.prefix, [user]);
|
||||
}
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
const groupedTeamMember = groupByGroup(teamMember);
|
||||
|
||||
function mapMap<T, K, J>(i: Map<T, K>, fn: (key: T, value: K) => J): J[] {
|
||||
const arr = [];
|
||||
for (let [key, value] of i) {
|
||||
arr.push(fn(key, value));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
const teamMember: { [key: string]: Player[]} = await fetch("http://127.0.0.1:1337/data/team")
|
||||
.then(value => value.json());
|
||||
---
|
||||
|
||||
<NavbarLayout title={t("home.page")} description="SteamWar.de Homepage">
|
||||
@@ -150,16 +127,13 @@ function mapMap<T, K, J>(i: Map<T, K>, fn: (key: T, value: K) => J): J[] {
|
||||
<p class="mt-4">{t("home.benefits.events.description.2")}</p>
|
||||
</Card>
|
||||
</div>
|
||||
<a class="btn btn-ghost px-8 my-4 flex" href={l("/about")}>{t("home.benefits.read")}
|
||||
<CaretRight width="24" heigth="24"/>
|
||||
</a>
|
||||
</section>
|
||||
<section class="w-full py-12">
|
||||
{mapMap(groupedTeamMember, (key, value) => (
|
||||
{Object.entries(teamMember).map(([prefix, players]) => (
|
||||
<div class="flex items-center flex-col">
|
||||
<h2 class="dark:text-white text-4xl font-bold">{t("home.prefix." + key)}</h2>
|
||||
<h2 class="dark:text-white text-4xl font-bold">{t("home.prefix." + prefix)}</h2>
|
||||
<div class="flex my-4 md:flex-row flex-col flex-wrap justify-center">
|
||||
{value.map(v => (
|
||||
{players.map(v => (
|
||||
<Card extraClasses="py-24 px-12" client:idle>
|
||||
<figure class="flex flex-col items-center">
|
||||
<figcaption class="text-center mb-4 text-2xl">{v.name}</figcaption>
|
||||
|
||||
@@ -5,5 +5,6 @@ import {t} from "astro-i18n";
|
||||
---
|
||||
|
||||
<PageLayout title={t("stats.title")}>
|
||||
<h1>{t("stats.title")}</h1>
|
||||
<FightStatistics client:only="svelte"/>
|
||||
</PageLayout>
|
||||
Reference in New Issue
Block a user