Skip to content

Commit

Permalink
Add New Jacob Medals (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptlthg authored Nov 16, 2023
1 parent 1e15fa3 commit dfcb53b
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 98 deletions.
7 changes: 7 additions & 0 deletions src/components/stats/contests/participation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<div class="text-sm xs:text-xl sm:text-2xl font-mono">
{entry.collected?.toLocaleString()}
</div>
{#if entry.medal && entry.medal !== 'none'}
<img
class="inline-block w-6 h-6 pixelated"
src="/images/medals/{entry.medal}.webp"
alt="Earned Medal"
/>
{/if}
</div>
</div>
</a>
8 changes: 2 additions & 6 deletions src/components/stats/jacob/contest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
<span class="text-xs">{ranking ? `/ ${participants}` : ''}</span>
</h3>
<h3 class="text-lg font-semibold flex flex-row items-center gap-1">
{#if medal === 'gold'}
<img class="inline-block w-5 h-5 pixelated" src="/images/medals/gold.webp" alt="Earned Medal" />
{:else if medal === 'silver'}
<img class="inline-block w-5 h-5 pixelated" src="/images/medals/silver.webp" alt="Earned Medal" />
{:else if medal === 'bronze'}
<img class="inline-block w-5 h-5 pixelated" src="/images/medals/bronze.webp" alt="Earned Medal" />
{#if medal && medal !== 'none'}
<img class="inline-block w-6 h-6 pixelated" src="/images/medals/{medal}.webp" alt="Earned Medal" />
{/if}
{(collected ?? 0).toLocaleString()}
</h3>
Expand Down
4 changes: 4 additions & 0 deletions src/components/stats/jacob/jacobinfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
bronze: number;
silver: number;
gold: number;
platinum: number;
diamond: number;
participations: number;
firstPlaces: number;
} = {
bronze: -1,
silver: -1,
gold: -1,
platinum: -1,
diamond: -1,
participations: -1,
firstPlaces: -1,
};
Expand Down
112 changes: 57 additions & 55 deletions src/components/stats/jacob/medals.svelte
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>
71 changes: 61 additions & 10 deletions src/lib/api/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ export interface paths {
"/Contests/at/{year}": {
get: {
parameters: {
query?: {
now?: boolean;
};
path: {
year: number;
};
Expand Down Expand Up @@ -2055,6 +2058,11 @@ export interface components {
/** Format: int32 */
participants?: number;
};
/**
* Format: int32
* @enum {integer}
*/
Crop: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
CropCollectionsDataPointDto: {
/** Format: int64 */
timestamp?: number;
Expand Down Expand Up @@ -2098,6 +2106,18 @@ export interface components {
/** Format: int32 */
color?: number;
};
EarnedMedalInventoryDto: {
/** Format: int32 */
bronze?: number;
/** Format: int32 */
silver?: number;
/** Format: int32 */
gold?: number;
/** Format: int32 */
platinum?: number;
/** Format: int32 */
diamond?: number;
};
EditEventDto: {
name?: string | null;
description?: string | null;
Expand Down Expand Up @@ -2176,16 +2196,54 @@ export interface components {
eventId?: string;
status?: components["schemas"]["EventMemberStatus"];
amountGained?: string | null;
startConditions?: components["schemas"]["StartConditions"];
startConditions?: components["schemas"]["EventMemberStartConditions"];
lastUpdated?: string | null;
disqualified?: boolean;
notes?: string | null;
};
EventMemberStartConditions: {
initialCollection?: {
[key: string]: number;
};
increasedCollection?: {
[key: string]: number;
};
countedCollection?: {
[key: string]: number;
};
toolStates?: {
[key: string]: components["schemas"]["EventToolState"];
};
tools?: {
[key: string]: number;
};
};
/**
* Format: int32
* @enum {integer}
*/
EventMemberStatus: 0 | 1 | 2 | 3;
EventToolCounterState: {
/** Format: int64 */
initial?: number;
/** Format: int64 */
previous?: number;
/** Format: int64 */
current?: number;
/** Format: int64 */
uncounted?: number;
};
EventToolState: {
skyblockId?: string;
crop?: components["schemas"]["Crop"];
/** Format: int64 */
firstSeen?: number;
/** Format: int64 */
lastSeen?: number;
isActive?: boolean;
counter?: components["schemas"]["EventToolCounterState"];
cultivating?: components["schemas"]["EventToolCounterState"];
};
ExcludedTimespan: {
/** Format: int64 */
start?: number;
Expand All @@ -2197,6 +2255,7 @@ export interface components {
armor?: components["schemas"]["ItemDto"][];
tools?: components["schemas"]["ItemDto"][];
equipment?: components["schemas"]["ItemDto"][];
accessories?: components["schemas"]["ItemDto"][];
};
FarmingWeightAllProfilesDto: {
selectedProfileId?: string | null;
Expand Down Expand Up @@ -2363,7 +2422,7 @@ export interface components {
};
JacobDataDto: {
medals?: components["schemas"]["MedalInventoryDto"];
earnedMedals?: components["schemas"]["MedalInventoryDto"];
earnedMedals?: components["schemas"]["EarnedMedalInventoryDto"];
perks?: components["schemas"]["JacobPerksDto"];
/** Format: int32 */
participations?: number;
Expand Down Expand Up @@ -2617,14 +2676,6 @@ export interface components {
hypixel?: string | null;
youtube?: string | null;
};
StartConditions: {
collection?: {
[key: string]: number;
};
tools?: {
[key: string]: number;
};
};
StrippedContestParticipationDto: {
/** Format: int32 */
collected?: number;
Expand Down
Loading

0 comments on commit dfcb53b

Please sign in to comment.