player scores working yayyyy
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import type { PageProps } from './$types';
|
||||
let { params }: PageProps = $props();
|
||||
let { params, data }: PageProps = $props();
|
||||
|
||||
function ordinal(n: number) {
|
||||
const s = ['th', 'st', 'nd', 'rd'];
|
||||
@@ -75,12 +75,21 @@
|
||||
<div>loading</div>
|
||||
{:then eventData}
|
||||
{@const event = eventData[0]}
|
||||
{console.log(event)}
|
||||
<div class="flex justify-center">
|
||||
<div class="w-full flex-col px-[5vw] text-center">
|
||||
<div
|
||||
style:background-color={event.state === 1
|
||||
? 'color-mix(in srgb, #fe640b 18%, transparent)'
|
||||
: event.state === 2
|
||||
? 'color-mix(in srgb, #a6e3a1 18%, transparent)'
|
||||
: ''}
|
||||
class="align-text-middle my-7 h-10 w-full rounded-2xl border-2 border-solid border-ctp-surface1"
|
||||
>
|
||||
{event.name} - {event.division}
|
||||
{#if event.state == 1}- ONGOING
|
||||
{:else if event.state == 2}- FINISHED
|
||||
{/if}
|
||||
</div>
|
||||
{#each event.registeredPlayers as bracket, bi}
|
||||
{#if bi > 0}
|
||||
@@ -92,7 +101,7 @@
|
||||
<div class="bracket-vertical-sep"></div>
|
||||
</div>
|
||||
{#each bracket.items as player}
|
||||
<div class="player-box h-30" style="--c:{player.teamColor}">
|
||||
<div class="player-box" style="--c:{player.teamColor}">
|
||||
<div class="player-ghost" aria-hidden="true">
|
||||
<svg viewBox="0 0.1 100 0.6" preserveAspectRatio="none" class="ghost-svg">
|
||||
<text
|
||||
@@ -114,6 +123,13 @@
|
||||
</div>
|
||||
{#if player.placement !== 0}
|
||||
<div class="player-placement goldman">{ordinal(player.placement)}</div>
|
||||
<div class="resultContainer flex justify-center">
|
||||
{#each player.playerScores as score}
|
||||
<div class="mx-5 my-1 rounded border-2" style="border-color:{player.teamColor}">
|
||||
Run {score.resultIndex + 1}: {score.result}{event.resultPresets[0].unit}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="player-placement-gap"></div>
|
||||
{/if}
|
||||
@@ -123,10 +139,23 @@
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-10 flex w-full justify-center">
|
||||
<a
|
||||
class="flex justify-center rounded border-2 border-solid border-white bg-ctp-surface2 p-4"
|
||||
href="/event/scoring/{eventId}">Score This Event</a
|
||||
>
|
||||
</div>
|
||||
{#if data.user}
|
||||
<div class="mt-10 flex w-full justify-center">
|
||||
<a
|
||||
class="flex justify-center rounded border-2 border-solid border-white bg-ctp-surface2 p-4"
|
||||
href="/event/scoring/{eventId}">Score This Event</a
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
{/await}
|
||||
|
||||
<style>
|
||||
.resultContainer {
|
||||
flex-direction: column;
|
||||
}
|
||||
@media (max-width: 479px) {
|
||||
.resultContainer {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user