removing tournaments from index that has already started
This commit is contained in:
parent
9b0e4f7fe3
commit
8e0acb7bc8
2 changed files with 16 additions and 11 deletions
|
|
@ -7,7 +7,12 @@
|
|||
let tournamentList = $state(props.data.tournaments ?? []);
|
||||
|
||||
function sortTournaments(list: TournamentInfo[]): TournamentInfo[] {
|
||||
return [...list].sort((a, b) => {
|
||||
const now = new Date().getTime();
|
||||
return [...list]
|
||||
.filter(
|
||||
(tournament) => !tournament.start_at || new Date(tournament.start_at).getTime() >= now
|
||||
)
|
||||
.sort((a, b) => {
|
||||
const timeA = a.start_at ? new Date(a.start_at).getTime() : Number.POSITIVE_INFINITY;
|
||||
const timeB = b.start_at ? new Date(b.start_at).getTime() : Number.POSITIVE_INFINITY;
|
||||
if (!Number.isNaN(timeA) && !Number.isNaN(timeB) && timeA !== timeB) {
|
||||
|
|
@ -82,7 +87,7 @@
|
|||
<div class="min-h-screen bg-slate-950 text-slate-100">
|
||||
<div class="mx-auto max-w-6xl space-y-12 px-4 py-16 sm:py-20">
|
||||
<header class="space-y-3 text-center">
|
||||
<p class="text-xs tracking-[0.4em] text-indigo-300 uppercase">VBytes LAN</p>
|
||||
<p class="text-xs uppercase tracking-[0.4em] text-indigo-300">VBytes LAN</p>
|
||||
<h1 class="text-4xl font-bold sm:text-5xl">Turneringar</h1>
|
||||
</header>
|
||||
|
||||
|
|
@ -91,9 +96,9 @@
|
|||
{#each tournaments() as tournament}
|
||||
<a href={`/tournament/${tournament.slug}`}>
|
||||
<article
|
||||
class="group flex w-full max-w-md min-w-md flex-col rounded-3xl border border-slate-800 bg-gradient-to-br from-slate-900/80 via-slate-900/70 to-slate-900/50 p-8 shadow-xl transition duration-200 hover:-translate-y-1 hover:border-indigo-400/70 hover:shadow-indigo-500/25"
|
||||
class="min-w-md group flex w-full max-w-md flex-col rounded-3xl border border-slate-800 bg-gradient-to-br from-slate-900/80 via-slate-900/70 to-slate-900/50 p-8 shadow-xl transition duration-200 hover:-translate-y-1 hover:border-indigo-400/70 hover:shadow-indigo-500/25"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3 text-xs tracking-wide uppercase">
|
||||
<div class="flex items-center justify-between gap-3 text-xs uppercase tracking-wide">
|
||||
<span class="font-semibold text-indigo-200">{tournament.game}</span>
|
||||
<span
|
||||
class="rounded-full border border-slate-700 px-3 py-1 text-[0.7rem] font-semibold text-slate-300"
|
||||
|
|
|
|||
Loading…
Reference in a new issue