diff --git a/src/routes/(app)/+page.server.ts b/src/routes/(app)/+page.server.ts index 9edf649..d2dee29 100644 --- a/src/routes/(app)/+page.server.ts +++ b/src/routes/(app)/+page.server.ts @@ -2,6 +2,7 @@ import { db } from '$lib/server/db'; import { match, team, mappool } from '$lib/server/db/schema'; import { eq, desc, count, inArray } from 'drizzle-orm'; +import { getQueueStatus } from '$lib/server/match/engine'; import type { PageServerLoad } from './$types'; export const load: PageServerLoad = async ({ locals }) => { @@ -35,10 +36,14 @@ export const load: PageServerLoad = async ({ locals }) => { .from(match) .where(eq(match.state, 'FINISHED')); + const queueStatus = await getQueueStatus(locals.user.id); + return { authenticated: true as const, recentMatches, liveMatches, + hasActiveMatch: !!queueStatus.matchedMatchId, + activeMatchId: queueStatus.matchedMatchId ?? null, stats: { matches: matchCount.count, finished: finishedCount.count, diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 4565c80..f2e3946 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -225,6 +225,13 @@ Leave Queue + {:else if data.hasActiveMatch} + + View Active Match → + {:else}