Compare commits

...

4 Commits

Author SHA1 Message Date
082bb72ec1 Seasonpicks: Disable countdown until seasonpicks will be locked
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 28s
2025-03-14 01:45:57 +01:00
b9413fcfcd Lib: Allow customizing finished text in Countdown 2025-03-14 01:45:40 +01:00
a0d75d6411 Lib: Rename fetch_seasonpicks to fetch_visibleseasonpicks 2025-03-14 01:24:24 +01:00
8ee212bbf3 Seasonpicks: Fix slightly scrollable teamwinner/podiums in accordion 2025-03-14 01:20:25 +01:00
5 changed files with 27 additions and 10 deletions

View File

@ -18,6 +18,9 @@
<!-- Prefetch data specified in "load" functions on link hover -->
<body data-theme="formula11Theme" data-sveltekit-preload-data="hover">
<!-- SvelteKit inserts the body contents here -->
<div style="display: contents; user-select: none; -moz-user-select: none">%sveltekit.body%</div>
<!-- TODO: The fucking user-select: none doesn't work in firefox -->
<div style="display: contents; user-select: none; -moz-user-select: -moz-none">
%sveltekit.body%
</div>
</body>
</html>

View File

@ -1,10 +1,11 @@
<script lang="ts">
interface CountdownProps {
date: string;
gotext?: string;
extraclass?: string;
}
let { date, extraclass = "" }: CountdownProps = $props();
let { date, gotext = "Go Go Go", extraclass = "" }: CountdownProps = $props();
// Set the date we're counting down to
const countDownDate = new Date(date).getTime();
@ -35,6 +36,6 @@
{#if distance > 0}
{days + "d " + hours + "h " + minutes + "m "}
{:else}
GO GO GO GO
{gotext}
{/if}
</span>

View File

@ -140,7 +140,7 @@ export const fetch_currentrace = async (
};
/**
* Fetch all [RacePicks] from the database
* Fetch all visible [RacePicks] from the database
*/
export const fetch_visibleracepicks = async (
fetch: (_: any) => Promise<Response>,
@ -174,9 +174,9 @@ export const fetch_currentracepick = async (
};
/**
* Fetch all [SeasonPicks] from the database
* Fetch all visible [SeasonPicks] from the database
*/
export const fetch_seasonpicks = async (
export const fetch_visibleseasonpicks = async (
fetch: (_: any) => Promise<Response>,
): Promise<SeasonPick[]> => {
const seasonpicks: SeasonPick[] = await pb

View File

@ -22,6 +22,7 @@
TEAM_BANNER_HEIGHT,
TEAM_BANNER_WIDTH,
} from "$lib/config";
import Countdown from "$lib/components/Countdown.svelte";
let { data }: { data: PageData } = $props();
@ -165,7 +166,7 @@
<div
class="card max-h-[155px] w-full min-w-40 overflow-y-scroll p-2 shadow lg:max-w-40"
>
<h1 class="mb-2 text-nowrap font-bold">Teamwinners:</h1>
<h1 class="text-nowrap font-bold">Teamwinners:</h1>
<div class="mt-1 grid grid-cols-4 gap-x-0 gap-y-0.5">
{#each teamwinners.slice(0, 12) as winner}
<LazyImage
@ -183,7 +184,7 @@
<div
class="card max-h-[155px] w-full min-w-40 overflow-y-scroll p-2 shadow lg:max-w-40"
>
<h1 class="mb-2 text-nowrap font-bold">Podiums:</h1>
<h1 class="text-nowrap font-bold">Podiums:</h1>
<div class="mt-1 grid grid-cols-4 gap-x-0 gap-y-0.5">
{#each podiums as podium}
<LazyImage
@ -481,3 +482,13 @@
{/await}
</div>
</div>
{#await Promise.all([data.seasonpicks, data.currentrace]) then [seasonpicks, currentrace]}
{#if seasonpicks.length <= 0 && currentrace}
<div class="card mx-auto w-fit p-2 shadow">
<span class="mr-2 text-xl font-medium">Season pick modification will be locked in</span>
<Countdown date={currentrace.qualidate} gotext="0d 0h 0m" extraclass="font-bold text-xl" />
<span class="ml-2 text-xl font-medium">.</span>
</div>
{/if}
{/await}

View File

@ -3,8 +3,9 @@ import {
fetch_drivers,
fetch_hottakes,
fetch_seasonpickedusers,
fetch_seasonpicks,
fetch_visibleseasonpicks,
fetch_teams,
fetch_currentrace,
} from "$lib/fetch";
import type { PageLoad } from "../$types";
@ -14,9 +15,10 @@ export const load: PageLoad = async ({ fetch, depends }) => {
return {
teams: fetch_teams(fetch),
drivers: fetch_drivers(fetch),
seasonpicks: fetch_seasonpicks(fetch),
seasonpicks: fetch_visibleseasonpicks(fetch),
hottakes: fetch_hottakes(fetch),
seasonpickedusers: fetch_seasonpickedusers(fetch),
currentrace: fetch_currentrace(fetch), // Used for countdown
seasonpick: await fetch_currentseasonpick(fetch),
};