From 67164cff0980b241e230ca9d8389f9344c201c34 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Tue, 18 Mar 2025 18:54:19 +0100 Subject: [PATCH] Racepicks: Make table scroll on both axes, always show race+avatars --- src/routes/racepicks/+page.svelte | 256 ++++++++++++++++-------------- 1 file changed, 141 insertions(+), 115 deletions(-) diff --git a/src/routes/racepicks/+page.svelte b/src/routes/racepicks/+page.svelte index f1464a2..abc9a84 100644 --- a/src/routes/racepicks/+page.svelte +++ b/src/routes/racepicks/+page.svelte @@ -70,7 +70,12 @@ {#if $pbUser && data.currentrace} {#await Promise.all( [data.drivers, data.currentpickedusers, pickedusers, outstandingusers], ) then [drivers, currentpicked, picked, outstanding]} - + + @@ -196,14 +201,20 @@ {/if} -
-
+
+
-
+
- {#await Promise.all( [data.races, data.raceresults, data.drivers], ) then [races, raceresults, drivers]} - {#each raceresults as result} - {@const race = get_by_value(races, "id", result.race)} - - -
- - - - - - - - {race?.name.slice(0, 9)}{(race?.name.length ?? 9) > 9 ? "." : ""} - -
- - -
- Result: -
- {#each result.pxxs as pxx, index} - {@const driver = get_by_value(drivers, "id", pxx)} -
- P{(race?.pxx ?? -100) - 3 + index}: - - {driver?.code} - + +
+ {#await data.currentpickedusers then currentpicked} + {#each currentpicked as user} +
+ +
+ + - {/each} - - {#if result.dnfs.length > 0} -
- {/if} - - {#each result.dnfs as dnf} - {@const driver = get_by_value(drivers, "id", dnf)} -
- DNF: - - {driver?.code} - -
- {/each} -
-
- {/each} - {/await} -
- - -
- - {#await Promise.all( [data.currentpickedusers, data.racepicks, data.races, data.drivers, data.raceresults], ) then [currentpicked, racepicks, races, drivers, raceresults]} - {#each currentpicked as user} - {@const picks = racepicks.filter((pick: RacePick) => pick.user === user.id)} - -
- -
- -
+ {/each} + {/await} +
+
- {#each raceresults as result} - {@const race = get_by_value(races, "id", result.race)} - {@const pick = picks.filter((pick: RacePick) => pick.race === race?.id)[0]} - {@const pxxcolor = PXX_COLORS[result.pxxs.indexOf(pick?.pxx ?? "Invalid")]} - {@const dnfcolor = - result.dnfs.indexOf(pick?.dnf ?? "Invalid") >= 0 ? PXX_COLORS[3] : PXX_COLORS[-1]} +
+ +
+ {#await Promise.all( [data.races, data.raceresults, data.drivers], ) then [races, raceresults, drivers]} + {#each raceresults as result} + {@const race = get_by_value(races, "id", result.race)} - {#if pick} -
-
- - {get_by_value(drivers, "id", pick?.pxx ?? "")?.code} - - - {get_by_value(drivers, "id", pick?.dnf ?? "")?.code} +
+ + + + + + + + {race?.name.slice(0, 9)}{(race?.name.length ?? 9) > 9 ? "." : ""} + +
+ + +
+ Result: +
+ {#each result.pxxs as pxx, index} + {@const driver = get_by_value(drivers, "id", pxx)} +
+ P{(race?.pxx ?? -100) - 3 + index}: + + {driver?.code}
-
- {:else} -
- {/if} - {/each} -
- {/each} - {/await} + {/each} + + {#if result.dnfs.length > 0} +
+ {/if} + + {#each result.dnfs as dnf} + {@const driver = get_by_value(drivers, "id", dnf)} +
+ DNF: + + {driver?.code} + +
+ {/each} +
+
+ {/each} + {/await} +
+ + +
+ + {#await Promise.all( [data.currentpickedusers, data.racepicks, data.races, data.drivers, data.raceresults], ) then [currentpicked, racepicks, races, drivers, raceresults]} + {#each currentpicked as user} + {@const picks = racepicks.filter((pick: RacePick) => pick.user === user.id)} + +
+ {#each raceresults as result} + {@const race = get_by_value(races, "id", result.race)} + {@const pick = picks.filter((pick: RacePick) => pick.race === race?.id)[0]} + {@const pxxcolor = PXX_COLORS[result.pxxs.indexOf(pick?.pxx ?? "Invalid")]} + {@const dnfcolor = + result.dnfs.indexOf(pick?.dnf ?? "Invalid") >= 0 ? PXX_COLORS[3] : PXX_COLORS[-1]} + + {#if pick} +
+
+ + {get_by_value(drivers, "id", pick?.pxx ?? "")?.code} + + + {get_by_value(drivers, "id", pick?.dnf ?? "")?.code} + +
+
+ {:else} +
+ {/if} + {/each} +
+ {/each} + {/await} +