From e936af208650992cb356670edd25b11db478d448 Mon Sep 17 00:00:00 2001 From: Gigi <47110839+DarthGigi@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:18:00 +0100 Subject: [PATCH] Add miscellaneous stats section with virtual list support (#31) * feat: add svelte-tiny-virtual-list dependency * feat: add miscellaneous stats section and related components * feat: enhance AdditionStat component with rarity color support * feat: update Items component title style to be font-semibold * feat: add styles for virtual list wrapper and inner components --- package.json | 1 + pnpm-lock.yaml | 8 +++ src/app.css | 8 +++ src/lib/components/AdditionStat.svelte | 35 +++++++++---- src/lib/layouts/stats/Items.svelte | 2 +- src/lib/layouts/stats/Main.svelte | 2 + src/lib/sections/stats/MiscSection.svelte | 43 +++++++++++++++ src/lib/sections/stats/misc/auctions.svelte | 39 ++++++++++++++ src/lib/sections/stats/misc/claimed.svelte | 24 +++++++++ src/lib/sections/stats/misc/damage.svelte | 17 ++++++ src/lib/sections/stats/misc/dragons.svelte | 36 +++++++++++++ src/lib/sections/stats/misc/endstone.svelte | 17 ++++++ src/lib/sections/stats/misc/essence.svelte | 29 +++++++++++ src/lib/sections/stats/misc/gifts.svelte | 17 ++++++ src/lib/sections/stats/misc/jerry.svelte | 17 ++++++ src/lib/sections/stats/misc/kills.svelte | 39 ++++++++++++++ .../sections/stats/misc/mythological.svelte | 51 ++++++++++++++++++ src/lib/sections/stats/misc/pet.svelte | 25 +++++++++ src/lib/sections/stats/misc/potions.svelte | 20 +++++++ src/lib/sections/stats/misc/races.svelte | 52 +++++++++++++++++++ .../sections/stats/misc/uncategorized.svelte | 29 +++++++++++ src/lib/sections/stats/misc/upgrades.svelte | 19 +++++++ 22 files changed, 518 insertions(+), 12 deletions(-) create mode 100644 src/lib/sections/stats/MiscSection.svelte create mode 100644 src/lib/sections/stats/misc/auctions.svelte create mode 100644 src/lib/sections/stats/misc/claimed.svelte create mode 100644 src/lib/sections/stats/misc/damage.svelte create mode 100644 src/lib/sections/stats/misc/dragons.svelte create mode 100644 src/lib/sections/stats/misc/endstone.svelte create mode 100644 src/lib/sections/stats/misc/essence.svelte create mode 100644 src/lib/sections/stats/misc/gifts.svelte create mode 100644 src/lib/sections/stats/misc/jerry.svelte create mode 100644 src/lib/sections/stats/misc/kills.svelte create mode 100644 src/lib/sections/stats/misc/mythological.svelte create mode 100644 src/lib/sections/stats/misc/pet.svelte create mode 100644 src/lib/sections/stats/misc/potions.svelte create mode 100644 src/lib/sections/stats/misc/races.svelte create mode 100644 src/lib/sections/stats/misc/uncategorized.svelte create mode 100644 src/lib/sections/stats/misc/upgrades.svelte diff --git a/package.json b/package.json index 6afe2bce..04481d9d 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "svelte": "4.2.18", "svelte-check": "^3.8.2", "svelte-interactions": "^0.2.0", + "svelte-tiny-virtual-list": "^2.1.2", "tailwind-merge": "^2.3.0", "tailwindcss": "^3.4.4", "tslib": "^2.6.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 500cfa62..87f44415 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -163,6 +163,9 @@ importers: svelte-interactions: specifier: ^0.2.0 version: 0.2.0(svelte@4.2.18) + svelte-tiny-virtual-list: + specifier: ^2.1.2 + version: 2.1.2 tailwind-merge: specifier: ^2.3.0 version: 2.3.0 @@ -2339,6 +2342,9 @@ packages: typescript: optional: true + svelte-tiny-virtual-list@2.1.2: + resolution: {integrity: sha512-jeP/WMvgFUR4mYXHGPiCexjX5DuzSO+3xzHNhxfcsFyy+uYPtnqI5UGb383swpzQAyXB0OBqYfzpYihD/5gxnA==} + svelte@4.2.18: resolution: {integrity: sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==} engines: {node: '>=16'} @@ -4567,6 +4573,8 @@ snapshots: postcss-load-config: 4.0.2(postcss@8.4.38) typescript: 5.5.2 + svelte-tiny-virtual-list@2.1.2: {} + svelte@4.2.18: dependencies: '@ampproject/remapping': 2.3.0 diff --git a/src/app.css b/src/app.css index 57a6b5b3..026358ac 100644 --- a/src/app.css +++ b/src/app.css @@ -229,3 +229,11 @@ filter: url(#enchanted-glint) drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.4)); } } + +.virtual-list-wrapper { + @apply overflow-y-auto overflow-x-hidden; +} + +.virtual-list-inner { + @apply overflow-hidden; +} diff --git a/src/lib/components/AdditionStat.svelte b/src/lib/components/AdditionStat.svelte index 82679fbb..f56bf7fd 100644 --- a/src/lib/components/AdditionStat.svelte +++ b/src/lib/components/AdditionStat.svelte @@ -1,4 +1,5 @@ - -
{text}:
- {data} - {#if subData} - {subData} - {/if} - + +
+
+ {text}: +
+ + + + {data} + - {#if asterisk} - * - {/if} + {#if subData} + {subData} + {/if} + + + {#if asterisk} + * + {/if} +
{#if asterisk} diff --git a/src/lib/layouts/stats/Items.svelte b/src/lib/layouts/stats/Items.svelte index 054701d8..0a99c950 100644 --- a/src/lib/layouts/stats/Items.svelte +++ b/src/lib/layouts/stats/Items.svelte @@ -10,7 +10,7 @@
{#if title} -

{title}

+

{title}

{/if} {#if subtitle}

{subtitle}

diff --git a/src/lib/layouts/stats/Main.svelte b/src/lib/layouts/stats/Main.svelte index 6eac4216..e180c010 100644 --- a/src/lib/layouts/stats/Main.svelte +++ b/src/lib/layouts/stats/Main.svelte @@ -11,6 +11,7 @@ import Dungeons from "$lib/sections/stats/Dungeons.svelte"; import Inventory from "$lib/sections/stats/Inventory.svelte"; import Minions from "$lib/sections/stats/Minions.svelte"; + import MiscSection from "$lib/sections/stats/MiscSection.svelte"; import Pets from "$lib/sections/stats/Pets.svelte"; import Rift from "$lib/sections/stats/Rift.svelte"; import SkillsSection from "$lib/sections/stats/SkillsSection.svelte"; @@ -42,6 +43,7 @@ + diff --git a/src/lib/sections/stats/MiscSection.svelte b/src/lib/sections/stats/MiscSection.svelte new file mode 100644 index 00000000..467c8b8c --- /dev/null +++ b/src/lib/sections/stats/MiscSection.svelte @@ -0,0 +1,43 @@ + + +

Miscellaneous

+ + + + + + + + + + + + + + + + + diff --git a/src/lib/sections/stats/misc/auctions.svelte b/src/lib/sections/stats/misc/auctions.svelte new file mode 100644 index 00000000..e4a35378 --- /dev/null +++ b/src/lib/sections/stats/misc/auctions.svelte @@ -0,0 +1,39 @@ + + + +
+ + + + {#each Object.entries(misc.auctions.total_sold) as [rarity, amount]} + {#if rarity !== "total"} + + {/if} + {/each} + +
+
+ + +
+ + + + + + {#each Object.entries(misc.auctions.total_bought) as [rarity, amount]} + {#if rarity !== "total"} + + {/if} + {/each} + +
+
diff --git a/src/lib/sections/stats/misc/claimed.svelte b/src/lib/sections/stats/misc/claimed.svelte new file mode 100644 index 00000000..2076f50d --- /dev/null +++ b/src/lib/sections/stats/misc/claimed.svelte @@ -0,0 +1,24 @@ + + + +
+ {#each Object.entries(misc.claimed_items) as [item, time]} + + {formatDate(time, "'Claimed on' dd MMMM yyyy 'at' HH:mm")} + + {/each} +
+
diff --git a/src/lib/sections/stats/misc/damage.svelte b/src/lib/sections/stats/misc/damage.svelte new file mode 100644 index 00000000..a5f9b292 --- /dev/null +++ b/src/lib/sections/stats/misc/damage.svelte @@ -0,0 +1,17 @@ + + + +
+ {#each Object.entries(misc.damage) as [text, data]} + + {/each} +
+
diff --git a/src/lib/sections/stats/misc/dragons.svelte b/src/lib/sections/stats/misc/dragons.svelte new file mode 100644 index 00000000..fc38594c --- /dev/null +++ b/src/lib/sections/stats/misc/dragons.svelte @@ -0,0 +1,36 @@ + + + +
+ + {#each Object.entries(misc.dragons.most_damage) as [text, data]} + {#if text !== "best"} + + {/if} + {/each} + + + {#each Object.entries(misc.dragons.fastest_kill) as [text, data]} + {#if text !== "best"} + + {/if} + {/each} + + + + {#each Object.entries(misc.dragons.deaths) as [text, data]} + {#if text !== "total"} + + {/if} + {/each} + +
+
diff --git a/src/lib/sections/stats/misc/endstone.svelte b/src/lib/sections/stats/misc/endstone.svelte new file mode 100644 index 00000000..8f5e43f6 --- /dev/null +++ b/src/lib/sections/stats/misc/endstone.svelte @@ -0,0 +1,17 @@ + + + +
+ {#each Object.entries(misc.endstone_protector) as [text, data]} + + {/each} +
+
diff --git a/src/lib/sections/stats/misc/essence.svelte b/src/lib/sections/stats/misc/essence.svelte new file mode 100644 index 00000000..e4c6e747 --- /dev/null +++ b/src/lib/sections/stats/misc/essence.svelte @@ -0,0 +1,29 @@ + + +
+

Essence

+
+ {#each misc.essence as essence} + {@const hasUnlocked = essence.amount} + +
+
+ {essence.name} +
+ Amount: + {format(essence.amount)} +
+
+
+
+ {/each} +
+
diff --git a/src/lib/sections/stats/misc/gifts.svelte b/src/lib/sections/stats/misc/gifts.svelte new file mode 100644 index 00000000..1ba71e27 --- /dev/null +++ b/src/lib/sections/stats/misc/gifts.svelte @@ -0,0 +1,17 @@ + + + +
+ {#each Object.entries(misc.gifts) as [text, data]} + + {/each} +
+
diff --git a/src/lib/sections/stats/misc/jerry.svelte b/src/lib/sections/stats/misc/jerry.svelte new file mode 100644 index 00000000..e0178024 --- /dev/null +++ b/src/lib/sections/stats/misc/jerry.svelte @@ -0,0 +1,17 @@ + + + +
+ {#each Object.entries(misc.season_of_jerry) as [text, data]} + + {/each} +
+
diff --git a/src/lib/sections/stats/misc/kills.svelte b/src/lib/sections/stats/misc/kills.svelte new file mode 100644 index 00000000..6554f6c2 --- /dev/null +++ b/src/lib/sections/stats/misc/kills.svelte @@ -0,0 +1,39 @@ + + +
+

Kills

+
+ + +
+
+
+
Kills
+ 0 ? 20 : 0} scrollDirection="vertical"> +
+
#{index + 1}
+
{misc.kills.kills[index].name}
+
: {format(misc.kills.kills[index].amount)}
+
+
+
+
+
Deaths
+ 0 ? 20 : 0} scrollDirection="vertical"> +
+
#{index + 1}
+
{misc.kills.deaths[index].name}
+
: {format(misc.kills.deaths[index].amount)}
+
+
+
+
+
diff --git a/src/lib/sections/stats/misc/mythological.svelte b/src/lib/sections/stats/misc/mythological.svelte new file mode 100644 index 00000000..4ba31305 --- /dev/null +++ b/src/lib/sections/stats/misc/mythological.svelte @@ -0,0 +1,51 @@ + + + +
+ + + +

Rarities used:

+ {#each Object.entries(misc.mythological_event.burrows_dug_next) as [tier, count]} + {#if tier !== "total"} + + {/if} + {/each} + + + +

Rarities used:

+ {#each Object.entries(misc.mythological_event.burrows_dug_combat) as [tier, count]} + {#if tier !== "total"} + + {/if} + {/each} + + + +

Rarities used:

+ {#each Object.entries(misc.mythological_event.burrows_dug_treasure) as [tier, count]} + {#if tier !== "total"} + + {/if} + {/each} + + + +

Rarities used:

+ {#each Object.entries(misc.mythological_event.burrows_chains_complete) as [tier, count]} + {#if tier !== "total"} + + {/if} + {/each} + +
+
diff --git a/src/lib/sections/stats/misc/pet.svelte b/src/lib/sections/stats/misc/pet.svelte new file mode 100644 index 00000000..9bb94be7 --- /dev/null +++ b/src/lib/sections/stats/misc/pet.svelte @@ -0,0 +1,25 @@ + + + +
+ + + + + + + + + + + +
+
diff --git a/src/lib/sections/stats/misc/potions.svelte b/src/lib/sections/stats/misc/potions.svelte new file mode 100644 index 00000000..3ba2c022 --- /dev/null +++ b/src/lib/sections/stats/misc/potions.svelte @@ -0,0 +1,20 @@ + + + +
+ +

Disabled Potion Effects:

+ {#each misc.effects.disabled as effect} +

{effect.replaceAll("_", " ")}

+ {/each} +
+
+
diff --git a/src/lib/sections/stats/misc/races.svelte b/src/lib/sections/stats/misc/races.svelte new file mode 100644 index 00000000..befab889 --- /dev/null +++ b/src/lib/sections/stats/misc/races.svelte @@ -0,0 +1,52 @@ + + +
+

Races

+
+ {#each Object.entries(misc.races) as [_, race]} +
+
{race.name}
+
+ {#if race.races.with_return} +

With Return:

+
+
+ {#each Object.entries(race.races.with_return) as [_, value]} + + {/each} +
+
+ {/if} + + {#if race.races.no_return} +

No Return:

+
+
+ {#each Object.entries(race.races.no_return) as [_, value]} + + {/each} +
+
+ {/if} + + {#if race.name === "Other"} +
+ {#each Object.entries(race.races) as [_, value]} + {#if "name" in value} + + {/if} + {/each} +
+ {/if} +
+
+ {/each} +
+
diff --git a/src/lib/sections/stats/misc/uncategorized.svelte b/src/lib/sections/stats/misc/uncategorized.svelte new file mode 100644 index 00000000..22ccd83e --- /dev/null +++ b/src/lib/sections/stats/misc/uncategorized.svelte @@ -0,0 +1,29 @@ + + + +
+ {#if misc.uncategorized.soulflow} + + {/if} + + {#if misc.uncategorized.teleporter_pill_consumed} + + {/if} + + {#if misc.uncategorized.reaper_peppers_eaten} + + {/if} + + {#if misc.uncategorized.personal_bank !== "Unknown"} + + {/if} +
+
diff --git a/src/lib/sections/stats/misc/upgrades.svelte b/src/lib/sections/stats/misc/upgrades.svelte new file mode 100644 index 00000000..af1373fb --- /dev/null +++ b/src/lib/sections/stats/misc/upgrades.svelte @@ -0,0 +1,19 @@ + + + +
+ + + + + +
+