feat: redesign match play and add broadcast tooling
This commit is contained in:
46
src/lib/components/broadcast/History.svelte
Normal file
46
src/lib/components/broadcast/History.svelte
Normal file
@@ -0,0 +1,46 @@
|
||||
<script lang="ts">
|
||||
import { fly } from 'svelte/transition';
|
||||
import { SIDE_COLORS, modColor } from '$lib/components/match/theme';
|
||||
import { numberFormat, type OverlayProps } from './context';
|
||||
import Panel from './Panel.svelte';
|
||||
|
||||
const { data, accent }: OverlayProps = $props();
|
||||
const view = $derived(data.view);
|
||||
</script>
|
||||
|
||||
{#if view}
|
||||
<Panel {accent} edge="top">
|
||||
<div class="flex h-full flex-col gap-2 overflow-hidden p-5">
|
||||
<div class="text-sm font-bold tracking-[0.25em] text-zinc-400 uppercase">Maps</div>
|
||||
{#each view.maps as map (map.index)}
|
||||
{@const slot = view.slots.find((each) => each.id === map.slotId)}
|
||||
{@const winner = view.sides.find((side) => side.id === map.winner)}
|
||||
<div
|
||||
in:fly={{ x: -30, duration: 400 }}
|
||||
class="flex items-center gap-3 rounded-lg bg-white/5 px-3 py-2 text-lg"
|
||||
>
|
||||
<span
|
||||
class="rounded px-2 text-base font-black text-zinc-950"
|
||||
style="background:{modColor(slot?.category ?? '')}">{slot?.label ?? '?'}</span
|
||||
>
|
||||
<span class="min-w-0 flex-1 truncate text-zinc-300">{slot?.title ?? ''}</span>
|
||||
{#each view.sides as side (side.id)}
|
||||
<span
|
||||
class="w-28 text-right tabular-nums {map.winner === side.id
|
||||
? 'font-bold'
|
||||
: 'text-zinc-500'}"
|
||||
style={map.winner === side.id ? `color:${SIDE_COLORS[side.color].text}` : ''}
|
||||
>{numberFormat.format(map.totals[side.id] ?? 0)}</span
|
||||
>
|
||||
{/each}
|
||||
{#if winner}<span
|
||||
class="size-3 rounded-full"
|
||||
style="background:{SIDE_COLORS[winner.color].solid}"
|
||||
></span>{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="text-lg text-zinc-500">No maps played yet.</div>
|
||||
{/each}
|
||||
</div>
|
||||
</Panel>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user