-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
308 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,85 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/stores'; | ||
import type { components } from '$lib/api/api'; | ||
import { Popover } from 'flowbite-svelte'; | ||
export let total: components['schemas']['MedalInventoryDto'] | undefined; | ||
export let earned: components['schemas']['MedalInventoryDto'] | undefined; | ||
export let earned: components['schemas']['EarnedMedalInventoryDto'] | undefined; | ||
export let ranks: { | ||
bronze: number; | ||
silver: number; | ||
gold: number; | ||
platinum: number; | ||
diamond: number; | ||
} = { | ||
bronze: -1, | ||
silver: -1, | ||
gold: -1, | ||
platinum: -1, | ||
diamond: -1, | ||
}; | ||
$: totalBronze = total?.bronze ?? 0; | ||
$: totalSilver = total?.silver ?? 0; | ||
$: totalGold = total?.gold ?? 0; | ||
$: medals = [ | ||
['gold', total?.gold ?? 0], | ||
['silver', total?.silver ?? 0], | ||
['bronze', total?.bronze ?? 0], | ||
] as [keyof typeof ranks, number][]; | ||
$: earnedBronze = earned?.bronze ?? 0; | ||
$: earnedSilver = earned?.silver ?? 0; | ||
$: earnedGold = earned?.gold ?? 0; | ||
$: earnedMedals = [ | ||
['diamond', earned?.diamond ?? 0], | ||
['platinum', earned?.platinum ?? 0], | ||
['gold', earned?.gold ?? 0], | ||
['silver', earned?.silver ?? 0], | ||
['bronze', earned?.bronze ?? 0], | ||
] as [keyof typeof ranks, number][]; | ||
$: profile = $page.params.profile; | ||
</script> | ||
|
||
<div id="Medals"> | ||
<h3 class="text-2xl my-2">Medal Inventory <span class="text-lg ml-1 font-light">(Owned / Earned)</span></h3> | ||
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-evenly w-full"> | ||
<div class="flex items-baseline w-full justify-center gap-2 rounded-md p-2 md:p-4 bg-gray-200 dark:bg-zinc-700"> | ||
{#if ranks.gold > -1} | ||
<h3 class="text-2xl my-2">Earned Medals</h3> | ||
<div class="flex flex-wrap md:flex-row gap-2 md:gap-4 justify-evenly w-full"> | ||
{#each earnedMedals as [medal, count] (medal)} | ||
{#if ranks[medal] > -1} | ||
<a | ||
href="/leaderboard/goldmedals/+{$page.params.id}-{profile}" | ||
class="pd-0.5 px-1.5 bg-gray-100 dark:bg-zinc-800 rounded-md hover:bg-gray-200 hover:dark:bg-zinc-600" | ||
href="/leaderboard/{medal}medals/+{$page.params.id}-{profile}" | ||
class="flex-1 basis-48 flex flex-row gap-3 items-center justify-center p-2 bg-gray-200 dark:bg-zinc-700 rounded-md hover:bg-gray-100 hover:dark:bg-zinc-600" | ||
> | ||
<span class="text-sm xs:text-md sm:text-lg">#</span><span class="text-md xs:text-lg sm:text-xl" | ||
>{ranks.gold}</span | ||
> | ||
</a> | ||
{/if} | ||
<h1 class="text-2xl font-semibold text-yellow-500"> | ||
<span class="font-normal">{totalGold.toLocaleString()} /</span> | ||
{earnedGold.toLocaleString()} | ||
</h1> | ||
<h2>Gold</h2> | ||
</div> | ||
<div class="flex items-baseline w-full justify-center gap-2 rounded-md p-2 md:p-4 bg-gray-200 dark:bg-zinc-700"> | ||
{#if ranks.silver > -1} | ||
<a | ||
href="/leaderboard/silvermedals/+{$page.params.id}-{profile}" | ||
class="pd-0.5 px-1.5 bg-gray-100 dark:bg-zinc-800 rounded-md hover:bg-gray-200 hover:dark:bg-zinc-600" | ||
> | ||
<span class="text-sm xs:text-md sm:text-lg">#</span><span class="text-md xs:text-lg sm:text-xl" | ||
>{ranks.silver}</span | ||
> | ||
<img src="/images/medals/{medal}.webp" alt="Medal" class="w-12 h-12 pixelated" /> | ||
|
||
<span class="text-2xl">{count.toLocaleString()}</span> | ||
|
||
<span class="bg-gray-100 dark:bg-zinc-800 px-1 py-0.5 rounded-md"> | ||
<span class="text-sm">#</span><span class="text-md xs:text-lg sm:text-xl">{ranks[medal]}</span> | ||
</span> | ||
</a> | ||
{/if} | ||
<h1 class="text-2xl font-semibold text-stone-600 dark:text-zinc-300"> | ||
<span class="font-normal">{totalSilver.toLocaleString()} /</span> | ||
{earnedSilver.toLocaleString()} | ||
</h1> | ||
<h2>Silver</h2> | ||
</div> | ||
<div class="flex items-baseline w-full justify-center gap-2 rounded-md p-2 md:p-4 bg-gray-200 dark:bg-zinc-700"> | ||
{#if ranks.bronze > -1} | ||
<a | ||
href="/leaderboard/bronzemedals/+{$page.params.id}-{profile}" | ||
class="pd-0.5 px-1.5 bg-gray-100 dark:bg-zinc-800 rounded-md hover:bg-gray-200 hover:dark:bg-zinc-600" | ||
{:else} | ||
<div | ||
class="flex-1 basis-48 flex flex-row gap-3 items-center justify-center p-2 bg-gray-200 dark:bg-zinc-700 rounded-md" | ||
> | ||
<span class="text-sm xs:text-md sm:text-lg">#</span><span class="text-md xs:text-lg sm:text-xl" | ||
>{ranks.bronze}</span | ||
> | ||
</a> | ||
<img src="/images/medals/{medal}.webp" alt="Medal" class="w-12 h-12 pixelated" /> | ||
|
||
<span class="text-2xl">{count.toLocaleString()}</span> | ||
</div> | ||
{/if} | ||
<h1 class="text-2xl font-semibold text-orange-700"> | ||
<span class="font-normal">{totalBronze.toLocaleString()} /</span> | ||
{earnedBronze.toLocaleString()} | ||
</h1> | ||
<h2>Bronze</h2> | ||
</div> | ||
<Popover> | ||
<p>Earned <span class="first-letter:capitalize inline-block">{medal}</span> Medals</p> | ||
</Popover> | ||
{/each} | ||
</div> | ||
<h3 class="text-2xl my-2">Medal Inventory</h3> | ||
<div class="flex flex-wrap md:flex-row gap-2 md:gap-4 justify-evenly w-full"> | ||
{#each medals as [medal, count] (medal)} | ||
<div | ||
class="flex-1 basis-48 flex flex-row gap-3 items-center justify-center p-2 bg-gray-200 dark:bg-zinc-700 rounded-md" | ||
> | ||
<img src="/images/medals/{medal}.webp" alt="Medal" class="w-12 h-12 pixelated" /> | ||
|
||
<span class="text-2xl">{count.toLocaleString()}</span> | ||
</div> | ||
<Popover> | ||
<p>Currently Owned <span class="first-letter:capitalize inline-block">{medal}</span> Medals</p> | ||
</Popover> | ||
{/each} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.