feat: add win count display for today's character in the UI
All checks were successful
Build Docker Image / build (push) Successful in 1m24s
All checks were successful
Build Docker Image / build (push) Successful in 1m24s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { db } from '$lib/server/db';
|
||||
import { config } from '$lib/server/db/schema';
|
||||
import { getDailyModeCharacters, getOrCreateTodayCharacter, getYesterdayCharacter } from '$lib/server/daily-character';
|
||||
import { getDailyModeCharacters, getOrCreateTodayCharacter, getYesterdayCharacter, getTodayCharacterWinsCount } from '$lib/server/daily-character';
|
||||
import { like } from 'drizzle-orm';
|
||||
|
||||
export async function load() {
|
||||
@@ -14,6 +14,9 @@ export async function load() {
|
||||
|
||||
const yesterdayCharacter = await getYesterdayCharacter(new Date(), characters);
|
||||
|
||||
// Load the win count for today
|
||||
const winCount = await getTodayCharacterWinsCount(dailyCharacter.id);
|
||||
|
||||
// Load column visibility config
|
||||
const columnConfig = await db
|
||||
.select()
|
||||
@@ -33,6 +36,7 @@ export async function load() {
|
||||
characters,
|
||||
dailyCharacter,
|
||||
yesterdayCharacter,
|
||||
columnVisibility
|
||||
columnVisibility,
|
||||
winCount
|
||||
};
|
||||
}
|
||||
|
||||
@@ -203,9 +203,14 @@
|
||||
<div class="relative mx-auto flex min-h-screen w-full max-w-6xl flex-col px-6 py-8 sm:py-10">
|
||||
<header class="flex flex-col items-start gap-6 w-full">
|
||||
<div class="flex w-full items-center justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="text-3xl font-black uppercase tracking-[0.25em] text-amber-50 sm:text-5xl">
|
||||
Personnage du jour
|
||||
</h1>
|
||||
<p class="mt-2 text-sm text-amber-300">
|
||||
{data.winCount} {data.winCount > 1 ? 'personnes' : 'personne'} ont trouvé aujourd'hui 🎉
|
||||
</p>
|
||||
</div>
|
||||
{#if hasWon}
|
||||
<button
|
||||
class="rounded-full border border-amber-200/40 bg-transparent px-5 py-3 text-sm font-semibold text-amber-100 transition hover:border-amber-200 hover:text-amber-50"
|
||||
|
||||
Reference in New Issue
Block a user