2023-09-20 20:52:40 +02:00
|
|
|
---
|
2023-12-25 21:54:40 +01:00
|
|
|
import NavbarLayout from "@layouts/NavbarLayout.astro";
|
2023-09-24 16:33:14 +02:00
|
|
|
|
2024-02-11 11:16:23 +01:00
|
|
|
import {Image} from "astro:assets";
|
2024-02-21 23:59:14 +01:00
|
|
|
import Card from "@components/Card.svelte";
|
2023-12-25 21:54:40 +01:00
|
|
|
import localBau from "@images/2023-10-08_20.43.43.png";
|
2023-12-23 15:36:22 +01:00
|
|
|
import {CaretRight, Archive, Rocket, Bell} from "@astropub/icons";
|
2023-11-05 22:27:20 +01:00
|
|
|
import {t} from "astro-i18n";
|
2023-12-25 21:54:40 +01:00
|
|
|
import {l} from "@utils/util";
|
|
|
|
import PlayerCount from "@components/PlayerCount.svelte";
|
2023-12-23 15:36:22 +01:00
|
|
|
import "../../public/fonts/barlow-condensed/barlow-condensed.css";
|
2023-12-25 21:54:40 +01:00
|
|
|
import type {Player} from "@components/types/data";
|
2023-10-12 21:02:57 +02:00
|
|
|
|
2024-01-06 15:48:25 +01:00
|
|
|
const teamMember = await fetch("http://127.0.0.1:1337/data/team").then(value => value.json());
|
2023-10-12 21:02:57 +02:00
|
|
|
|
|
|
|
function groupByGroup(array) {
|
2023-12-23 15:36:22 +01:00
|
|
|
const groups = new Map<string, Player[]>();
|
2023-10-12 21:02:57 +02:00
|
|
|
|
2023-12-23 15:36:22 +01:00
|
|
|
for (let user of array) {
|
|
|
|
if (groups.has(user.prefix)) {
|
|
|
|
groups.get(user.prefix).push(user);
|
|
|
|
} else {
|
|
|
|
groups.set(user.prefix, [user]);
|
|
|
|
}
|
|
|
|
}
|
2023-10-12 21:02:57 +02:00
|
|
|
|
2023-12-23 15:36:22 +01:00
|
|
|
return groups;
|
2023-10-12 21:02:57 +02:00
|
|
|
}
|
|
|
|
|
2023-12-23 15:36:22 +01:00
|
|
|
const groupedTeamMember = groupByGroup(teamMember);
|
2023-10-12 21:02:57 +02:00
|
|
|
|
|
|
|
function mapMap<T, K, J>(i: Map<T, K>, fn: (key: T, value: K) => J): J[] {
|
2023-12-23 15:36:22 +01:00
|
|
|
const arr = [];
|
|
|
|
for (let [key, value] of i) {
|
|
|
|
arr.push(fn(key, value));
|
|
|
|
}
|
|
|
|
return arr;
|
2023-10-12 21:02:57 +02:00
|
|
|
}
|
2023-09-20 20:52:40 +02:00
|
|
|
---
|
|
|
|
|
2023-10-12 21:02:57 +02:00
|
|
|
<NavbarLayout title={t("home.page")} description="SteamWar.de Homepage">
|
2023-12-23 15:36:22 +01:00
|
|
|
<div class="w-full h-screen relative mb-4">
|
2024-02-11 11:16:23 +01:00
|
|
|
<Image src={localBau} alt="Bau" width="1920" height="1080" densities={[1.5, 2, 3, 4]}
|
|
|
|
class="w-full object-cover rounded-b-2xl shadow-2xl dark:brightness-75"
|
|
|
|
style="height: calc(100vh + 1rem)" draggable="false"/>
|
2023-12-23 15:36:22 +01:00
|
|
|
<drop-in class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center">
|
2024-02-11 11:16:23 +01:00
|
|
|
<h1 class="text-4xl sm:text-6xl md:text-8xl font-extrabold text-white -translate-y-16 opacity-0 barlow"
|
|
|
|
style="transition: transform .7s ease-out, opacity .7s linear; text-shadow: 2px 2px 5px black;">
|
|
|
|
<span class="text-yellow-400">{t("home.title.first")}</span><span
|
|
|
|
class="text-neutral-600">{t("home.title.second")}</span>
|
2023-12-23 15:36:22 +01:00
|
|
|
</h1>
|
|
|
|
<text-carousel class="h-20 w-full relative select-none">
|
|
|
|
<h2 class="-translate-y-16">{t("home.subtitle.1")}</h2>
|
2024-02-11 11:16:23 +01:00
|
|
|
<h2>{t("home.subtitle.2")}
|
|
|
|
<PlayerCount client:only="svelte"/>
|
|
|
|
</h2>
|
2023-12-23 15:36:22 +01:00
|
|
|
<h2>{t("home.subtitle.3")}</h2>
|
|
|
|
</text-carousel>
|
2024-02-11 11:16:23 +01:00
|
|
|
<a href={l("join")} class="btn mt-32 px-8 flex opacity-0 -translate-y-16"
|
|
|
|
style="transition: transform .3s ease-out, opacity .3s linear">{t("home.join")}
|
|
|
|
<CaretRight width="24" heigth="24"/>
|
|
|
|
</a>
|
2023-12-23 15:36:22 +01:00
|
|
|
<script>
|
2024-02-11 11:16:23 +01:00
|
|
|
class TextCarousel extends HTMLElement {
|
|
|
|
current = 0;
|
|
|
|
|
|
|
|
connectedCallback() {
|
|
|
|
this._current.classList.add("!opacity-100");
|
|
|
|
|
|
|
|
for (let i = 0; i < this.children.length; i++) {
|
|
|
|
if (i !== this.current) {
|
|
|
|
this.children[i].classList.add("translate-y-8");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
this.next();
|
|
|
|
}, 5000);
|
|
|
|
}
|
|
|
|
|
|
|
|
get _current() {
|
|
|
|
return this.children[this.current];
|
|
|
|
}
|
|
|
|
|
|
|
|
next() {
|
|
|
|
this._current.classList.remove("!opacity-100");
|
|
|
|
this._current.classList.add("translate-y-8");
|
|
|
|
this._current.classList.remove("!delay-500");
|
|
|
|
this.current = (this.current + 1) % this.children.length;
|
|
|
|
this._current.classList.add("!opacity-100");
|
|
|
|
this._current.classList.remove("translate-y-8");
|
|
|
|
this._current.classList.add("!delay-500");
|
|
|
|
}
|
2023-12-23 15:36:22 +01:00
|
|
|
}
|
|
|
|
|
2024-02-11 11:16:23 +01:00
|
|
|
class DropIn extends HTMLElement {
|
|
|
|
connectedCallback() {
|
|
|
|
for (let child of this.children) {
|
|
|
|
if (child.classList.contains("opacity-0")) {
|
|
|
|
child.classList.remove("opacity-0");
|
|
|
|
child.classList.remove("-translate-y-16");
|
|
|
|
} else {
|
|
|
|
child.children[0].classList.remove("opacity-0");
|
|
|
|
child.children[0].classList.remove("-translate-y-16");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-23 15:36:22 +01:00
|
|
|
}
|
2023-09-24 16:33:14 +02:00
|
|
|
|
2024-02-11 11:16:23 +01:00
|
|
|
customElements.define("text-carousel", TextCarousel);
|
|
|
|
customElements.define("drop-in", DropIn);
|
2023-12-23 15:36:22 +01:00
|
|
|
</script>
|
|
|
|
</drop-in>
|
|
|
|
</div>
|
|
|
|
<section class="w-full flex flex-col items-center justify-center shadow-2xl rounded-b-2xl pb-8">
|
|
|
|
<div class="py-10 flex flex-col lg:flex-row">
|
2024-02-25 10:03:47 +01:00
|
|
|
<Card client:idle>
|
2024-02-11 11:16:23 +01:00
|
|
|
<Archive heigth="64" width="64"/>
|
2023-12-23 15:36:22 +01:00
|
|
|
<h1>{t("home.benefits.historic.title")}</h1>
|
|
|
|
<p>{t("home.benefits.historic.description.1")}</p>
|
|
|
|
<p>{t("home.benefits.historic.description.2")}</p>
|
2024-02-21 23:59:14 +01:00
|
|
|
</Card>
|
2024-02-25 10:03:47 +01:00
|
|
|
<Card client:idle>
|
2024-02-11 11:16:23 +01:00
|
|
|
<Rocket heigth="64" width="64"/>
|
2023-12-23 15:36:22 +01:00
|
|
|
<h1>{t("home.benefits.server.title")}</h1>
|
|
|
|
<p>{t("home.benefits.server.description")}</p>
|
2024-02-21 23:59:14 +01:00
|
|
|
</Card>
|
2024-02-25 10:03:47 +01:00
|
|
|
<Card client:idle>
|
2024-02-11 11:16:23 +01:00
|
|
|
<Bell heigth="64" width="64"/>
|
2023-12-23 15:36:22 +01:00
|
|
|
<h1>{t("home.benefits.events.title")}</h1>
|
|
|
|
<p>{t("home.benefits.events.description.1")}</p>
|
|
|
|
<p>{t("home.benefits.events.description.2")}</p>
|
2024-02-21 23:59:14 +01:00
|
|
|
</Card>
|
2023-12-23 15:36:22 +01:00
|
|
|
</div>
|
2024-02-11 11:16:23 +01:00
|
|
|
<a class="btn px-8 flex" href={l("/about")}>{t("home.benefits.read")}
|
|
|
|
<CaretRight width="24" heigth="24"/>
|
|
|
|
</a>
|
2023-12-23 15:36:22 +01:00
|
|
|
</section>
|
|
|
|
<section class="w-full py-12">
|
|
|
|
{mapMap(groupedTeamMember, (key, value) => (
|
|
|
|
<div class="flex items-center flex-col">
|
|
|
|
<h2 class="dark:text-white text-4xl font-bold">{t("home.prefix." + key)}</h2>
|
|
|
|
<div class="flex my-4 md:flex-row flex-col flex-wrap justify-center">
|
|
|
|
{value.map(v => (
|
2024-02-21 23:59:14 +01:00
|
|
|
<Card extraClasses="py-24 px-12" client:idle>
|
2023-12-23 15:36:22 +01:00
|
|
|
<figure class="flex flex-col items-center">
|
|
|
|
<figcaption class="text-center mb-4 text-2xl">{v.name}</figcaption>
|
2024-02-12 19:13:02 +01:00
|
|
|
<Image src={`${import.meta.env.PUBLIC_API_SERVER}/data/skin/${v.uuid}`}
|
2024-02-11 11:16:23 +01:00
|
|
|
class="transition duration-300 ease-in-out hover:scale-110 hover:drop-shadow-2xl"
|
|
|
|
alt={v.name + "s bust"} width="150" height="150"/>
|
2023-12-23 15:36:22 +01:00
|
|
|
</figure>
|
2024-02-21 23:59:14 +01:00
|
|
|
</Card>
|
2023-12-23 15:36:22 +01:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</section>
|
2023-09-24 16:33:14 +02:00
|
|
|
</NavbarLayout>
|
|
|
|
|
|
|
|
<style>
|
2024-02-11 11:16:23 +01:00
|
|
|
text-carousel {
|
|
|
|
> * {
|
|
|
|
@apply absolute top-0 left-0 w-full text-xl sm:text-4xl italic text-white text-center opacity-0;
|
|
|
|
transition: transform .5s ease-out, opacity .5s linear;
|
|
|
|
text-shadow: 2px 2px 5px black;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.barlow {
|
|
|
|
font-family: Barlow Condensed, serif;
|
|
|
|
}
|
|
|
|
|
|
|
|
.card {
|
|
|
|
@apply w-72 border-2 bg-zinc-50 border-gray-100 flex flex-col items-center p-8 m-4 rounded-xl shadow-lg transition-transform duration-300 ease-in-out
|
|
|
|
dark:bg-zinc-900 dark:border-gray-800 dark:text-gray-100
|
|
|
|
hover:scale-105;
|
|
|
|
|
|
|
|
> h1 {
|
|
|
|
@apply text-xl font-bold mt-4;
|
|
|
|
}
|
|
|
|
|
|
|
|
> p {
|
|
|
|
@apply mt-4;
|
|
|
|
}
|
|
|
|
|
|
|
|
> svg {
|
|
|
|
@apply transition-transform duration-300 ease-in-out hover:scale-110 hover:drop-shadow-2xl
|
|
|
|
}
|
|
|
|
}
|
2023-09-24 16:33:14 +02:00
|
|
|
</style>
|