Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to contest in jacob pb stats #360

Merged
merged 5 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup and remove "Best Scores" label
ptlthg committed Jan 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit d1cebae210705a4a35bbc93cec8d3cabe29d02c9
11 changes: 4 additions & 7 deletions src/components/stats/jacob/cropstats.svelte
Original file line number Diff line number Diff line change
@@ -27,11 +27,8 @@
);
</script>

<div class="flex flex-col items-start">
<h3 class="my-2 text-left text-2xl">Best Scores</h3>
<div class="flex max-w-6xl flex-wrap items-center justify-start gap-4">
{#each highest as [crop, amount] (crop)}
<JacobCropStats {jacob} {crop} count={amount} />
{/each}
</div>
<div class="flex max-w-6xl flex-wrap items-center justify-center gap-4">
{#each highest as [crop, amount] (crop)}
<JacobCropStats {jacob} {crop} count={amount} />
{/each}
</div>
22 changes: 9 additions & 13 deletions src/components/stats/jacob/jacob-crop-stats.svelte
Original file line number Diff line number Diff line change
@@ -20,9 +20,9 @@
}
function pb(crop: string) {
const amount = jacob?.stats?.personalBests?.[crop.replace(' ', '') as keyof typeof jacob.stats.personalBests];
const timestamp =
jacob?.stats?.crops?.[crop.replace(' ', '') as keyof typeof jacob.stats.crops]?.personalBestTimestamp;
const key = crop.replace(' ', '');
const amount = jacob?.stats?.personalBests?.[key as keyof typeof jacob.stats.personalBests];
const timestamp = jacob?.stats?.crops?.[key as keyof typeof jacob.stats.crops]?.personalBestTimestamp;
return { amount: amount ? +amount : undefined, timestamp: timestamp ? +timestamp : undefined };
}
@@ -45,16 +45,12 @@
<img src={PROPER_CROP_TO_IMG[crop]} alt="Crop" class="pixelated h-12 w-12 p-1" />

<div class="flex flex-col items-start gap-1">
<div>
<div>
<a
href="/contest/{pbData.timestamp}"
class="text-lg font-semibold leading-none no-underline hover:underline"
>
{pbData.amount?.toLocaleString() ?? 'Not Set!'}
</a>
</div>
</div>
<a
href="/contest/{pbData.timestamp}"
class="text-lg font-semibold leading-none no-underline hover:underline"
>
{pbData.amount?.toLocaleString() ?? 'Not Set!'}
</a>

<Popover.Mobile>
{#snippet trigger()}