Merge branch 'dev' into 'dev-serverlist'

Dev

See merge request aj2021/l-pa-so!3
This commit is contained in:
Niklas Eifler 2023-12-18 13:11:35 +00:00
commit 94d2c0a751
5 changed files with 21 additions and 9 deletions

1
website/.gitignore vendored
View File

@ -7,3 +7,4 @@ vite.config.ts.timestamp-*
temp
config
backend_files
/static/tournament.json

View File

@ -1,16 +1,26 @@
<script>
import {onMount} from "svelte";
import { onMount } from 'svelte';
let data = {};
onMount(async () => {
let data = {};
let player = [];
let games = [];
onMount(async () => {
const response = await fetch('/api/read-tournament');
data = await response.json();
player = String(data.player).split(",");
games = String(data.games).split(",");
});
</script>
<h2>Aktuelles Tunier</h2>
<h3>Diese Spiele werden Gespielt:</h3>
<p>{data.games}</p>
{#each games as game}
<p>{game}</p>
{/each}
<h3>Die Teilnehmer lauten: </h3>
<p>{data.player}</p>
<h3>Die Teilnehmer lauten:</h3>
{#each player as singlePlayer}
<p>Spieler:</p>
<p>{singlePlayer.split("|")[0]}</p>
<p>Punktzahl:</p>
<p>{singlePlayer.split("|")[1]}</p>
{/each}

View File

@ -5,5 +5,5 @@ export async function GET() {
const filePath = path.resolve('static/tournament.json');
const data = await fs.readFile(filePath, 'utf8');
const json = JSON.parse(data);
return Response.json(json)
return Response.json(json);
}

View File

@ -16,7 +16,7 @@
player = [];
const inputs = document.querySelectorAll('.Teilnehmer');
inputs.forEach((input) => {
player.push(input.value);
player.push(input.value + '|' + 0);
});
return player;
}

View File

@ -0,0 +1 @@
{"games":["Test 1","Test 2","Test 3","Test 4"],"player":["Test 1|0","Test 2|0","Test 3|0","Test 4|0"]}