diff --git a/src/lib/config.ts b/src/lib/config.ts index cdff734..f24c838 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -32,3 +32,14 @@ export const RACE_PICTOGRAM_HEIGHT: number = 384; // export const SUBSTITUTION_CARD_ASPECT_WIDTH: number = 413; // export const SUBSTITUTION_CARD_ASPECT_HEIGHT: number = 625; + +// Define the background colors the picks will have depending on the raceresult +export const PXX_COLORS: string[] = []; +PXX_COLORS[-1] = "auto"; +PXX_COLORS[0] = "#C2FBCC"; // 1 Point +PXX_COLORS[6] = "#C2FBCC"; +PXX_COLORS[1] = "#6CDB7E"; // 3 Points +PXX_COLORS[5] = "#6CDB7E"; +PXX_COLORS[2] = "#07B725"; // 6 Points +PXX_COLORS[4] = "#07B725"; +PXX_COLORS[3] = "#EFBF04"; // 10 Points diff --git a/src/routes/racepicks/+page.svelte b/src/routes/racepicks/+page.svelte index 9b68558..6a1be00 100644 --- a/src/routes/racepicks/+page.svelte +++ b/src/routes/racepicks/+page.svelte @@ -22,6 +22,7 @@ AVATAR_WIDTH, DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_WIDTH, + PXX_COLORS, RACE_PICTOGRAM_HEIGHT, RACE_PICTOGRAM_WIDTH, } from "$lib/config"; @@ -99,21 +100,6 @@ placement: "right", }; }; - - // Define the background colors the picks will have depending on the raceresult - const pxxcolors: string[] = []; - pxxcolors[-1] = "auto"; - pxxcolors[0] = "#C2FBCC"; // 1 Point - pxxcolors[6] = "#C2FBCC"; - pxxcolors[1] = "#6CDB7E"; // 3 Points - pxxcolors[5] = "#6CDB7E"; - pxxcolors[2] = "#07B725"; // 6 Points - pxxcolors[4] = "#07B725"; - pxxcolors[3] = "#EFBF04"; // 10 Points - - const dnfcolors: string[] = []; - dnfcolors[-1] = "auto"; - dnfcolors[0] = "#EFBF04"; {#if data.currentrace} @@ -258,34 +244,34 @@ - - - - + + + + @@ -314,7 +300,7 @@ {@const driver = getdriver(pxx)}
P{(race?.pxx ?? -100) - 3 + index}: - + {driver?.code}
@@ -328,7 +314,7 @@ {@const driver = getdriver(dnf)}
DNF: - + {driver?.code}
@@ -369,9 +355,9 @@ {#each data.raceresults as result} {@const race = getrace(result.race)} {@const pick = picks.filter((pick: RacePick) => pick.race === race?.id)[0]} - {@const pxxcolor = pxxcolors[result.pxxs.indexOf(pick?.pxx ?? "Invalid")]} + {@const pxxcolor = PXX_COLORS[result.pxxs.indexOf(pick?.pxx ?? "Invalid")]} {@const dnfcolor = - result.dnfs.indexOf(pick?.dnf ?? "Invalid") >= 0 ? dnfcolors[0] : dnfcolors[-1]} + result.dnfs.indexOf(pick?.dnf ?? "Invalid") >= 0 ? PXX_COLORS[3] : PXX_COLORS[-1]} {#if pick}