From c8b5b37d0b13cc0bf17e621530131e22cbbb73d6 Mon Sep 17 00:00:00 2001 From: DarthGigi <47110839+DarthGigi@users.noreply.github.com> Date: Wed, 18 Dec 2024 00:01:00 +0100 Subject: [PATCH] fix(stats): update profile context to use Promise for asynchronous data handling --- src/lib/layouts/stats/AdditionalStats.svelte | 211 ++++-------- src/lib/layouts/stats/Main.svelte | 66 +++- src/lib/layouts/stats/PlayerProfile.svelte | 140 ++++---- src/lib/layouts/stats/Skills.svelte | 18 +- src/lib/layouts/stats/Stats.svelte | 14 +- src/lib/sections/stats/Accessories.svelte | 301 +++++++++--------- src/lib/sections/stats/Armor.svelte | 66 ++-- src/lib/sections/stats/Bestiary.svelte | 2 +- src/lib/sections/stats/Collections.svelte | 2 +- src/lib/sections/stats/CrimsonIsle.svelte | 2 +- src/lib/sections/stats/Dungeons.svelte | 2 +- src/lib/sections/stats/Minions.svelte | 2 +- src/lib/sections/stats/MiscSection.svelte | 2 +- src/lib/sections/stats/Pets.svelte | 171 +++++----- src/lib/sections/stats/Rift.svelte | 4 +- src/lib/sections/stats/Slayer.svelte | 2 +- src/lib/sections/stats/Weapons.svelte | 20 +- .../sections/stats/skills/enchanting.svelte | 2 +- src/lib/sections/stats/skills/farming.svelte | 2 +- src/lib/sections/stats/skills/fishing.svelte | 2 +- src/lib/sections/stats/skills/mining.svelte | 2 +- .../server/constants/NotEnoughUpdates-REPO | 2 +- .../stats/[ign]/[[profile]]/+page.svelte | 12 +- 23 files changed, 525 insertions(+), 522 deletions(-) diff --git a/src/lib/layouts/stats/AdditionalStats.svelte b/src/lib/layouts/stats/AdditionalStats.svelte index 49ac56087..efe16121f 100644 --- a/src/lib/layouts/stats/AdditionalStats.svelte +++ b/src/lib/layouts/stats/AdditionalStats.svelte @@ -6,158 +6,85 @@ import { format as numberFormat } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const defaultPatternDecimal: string = "0,0.##"; const defaultPattern: string = "0,0";
- - - Joined on {dateFormat(profile.stats.joined, "dd MMMM yyyy 'at' HH:mm")} - - - - -
-
-

- Total Skill XP: - - {numberFormat(profile.skills.totalSkillXp, defaultPattern)} - -

-

Total XP gained in all skills except Social and Runecrafting.

+ {#await profile} + Loading + {:then profile} + + Joined on {dateFormat(profile.stats.joined, "dd MMMM yyyy 'at' HH:mm")} + + + + +
+
+

+ Total Skill XP: + + {numberFormat(profile.skills.totalSkillXp, defaultPattern)} + +

+

Total XP gained in all skills except Social and Runecrafting.

+
+
+

+ Average Level: + + {profile.skills.averageSkillLevel.toFixed(2)} + +

+

Average skill level over all skills except Social and Runecrafting, includes progress to next level.

+
+
+

+ Average Level without progress: + + {numberFormat(profile.skills.averageSkillLevelWithProgress, defaultPatternDecimal)} + +

+

Average skill level without including partial level progress.

+
-
-

- Average Level: + + + {((profile.stats.fairySouls.found / profile.stats.fairySouls.total) * 100).toFixed(2)}% of fairy souls found. + + +
+
+

Networth

+

Networth calculations by SkyHelper.

+
+
+
    + {#each Object.entries(profile.stats.networth.types) as [key, value]} +
  • + {key.replace(/_/g, " ")}: + + {formatNumber(value.total)} + +
  • + {/each} +
+
+

+ Unsoulbound Networth: - {profile.skills.averageSkillLevel.toFixed(2)} + {formatNumber(profile.stats.networth.unsoulboundNetworth)} -

-

Average skill level over all skills except Social and Runecrafting, includes progress to next level.

-
-
-

- Average Level without progress: +
+ Total Networth: - {numberFormat(profile.skills.averageSkillLevelWithProgress, defaultPatternDecimal)} + {numberFormat(profile.stats.networth.networth, defaultPattern)} ({formatNumber(profile.stats.networth.networth)}) -

-

Average skill level without including partial level progress.

-
-
- - - {((profile.stats.fairySouls.found / profile.stats.fairySouls.total) * 100).toFixed(2)}% of fairy souls found. - - - -
-
-

Networth

-

Networth calculations by SkyHelper.

-
-
-
    - {#each Object.entries(profile.stats.networth.types) as [key, value]} -
  • - {key.replace(/_/g, " ")}: - - {formatNumber(value.total)} - -
  • - {/each} -
+

-

- Unsoulbound Networth: - - {formatNumber(profile.stats.networth.unsoulboundNetworth)} - -
- Total Networth: - - {numberFormat(profile.stats.networth.networth, defaultPattern)} ({formatNumber(profile.stats.networth.networth)}) - -

-
-
+ + {/await}
diff --git a/src/lib/layouts/stats/Main.svelte b/src/lib/layouts/stats/Main.svelte index 11f7251b6..86adc042c 100644 --- a/src/lib/layouts/stats/Main.svelte +++ b/src/lib/layouts/stats/Main.svelte @@ -28,7 +28,11 @@
- + {#await profile} + Loading + {:then} + + {/await}
@@ -52,34 +56,74 @@
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
- + {#await profile} + Loading + {:then} + + {/await}
diff --git a/src/lib/layouts/stats/PlayerProfile.svelte b/src/lib/layouts/stats/PlayerProfile.svelte index e4c7fb70d..5c2915b2e 100644 --- a/src/lib/layouts/stats/PlayerProfile.svelte +++ b/src/lib/layouts/stats/PlayerProfile.svelte @@ -9,7 +9,7 @@ import Star from "lucide-svelte/icons/star"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const iconMapper: Record = { TWITTER: "x-twitter.svg", YOUTUBE: "youtube.svg", @@ -24,86 +24,90 @@
- Stats for -
-
-
- {profile.rank?.tag} - {#if profile.rank?.plus} - {profile.rank?.plus} - {/if} + {#await profile} + Loading stats for... + {:then profile} + Stats for +
+
+
+ {profile.rank?.tag} + {#if profile.rank?.plus} + {profile.rank?.plus} + {/if} +
+
-
+ {profile.username}
- {profile.username} -
- on - - - {profile.profile_cute_name} - + on + + + {profile.profile_cute_name} + - - {#each profile.profiles as otherProfile} - - {otherProfile.cute_name} - {#if otherProfile.game_mode === "bingo"} - 🎲 - {/if} - - {/each} - - + + {#each profile.profiles as otherProfile} + + {otherProfile.cute_name} + {#if otherProfile.game_mode === "bingo"} + 🎲 + {/if} + + {/each} + + + {/await}
+ {#await profile then profile} + { + await navigator.share({ + url: location.href, + title: `Stats for ${profile.username} on Hypixel` + }); + }}> + + - { - await navigator.share({ - url: location.href, - title: `Stats for ${profile.username} on Hypixel` - }); - }}> - - + + Plancke + - - Plancke - + + Elite + - - Elite - - - - - {#each Object.entries(profile.social) as [key, value]} - {#if key === "DISCORD"} - - {:else} - - {/if} - {/each} + + {#each Object.entries(profile.social) as [key, value]} + {#if key === "DISCORD"} + + {:else} + + {/if} + {/each} + {/await} (showMore = !showMore)}> {#if showMore} diff --git a/src/lib/layouts/stats/Skills.svelte b/src/lib/layouts/stats/Skills.svelte index dce698564..e0d0c0cf7 100644 --- a/src/lib/layouts/stats/Skills.svelte +++ b/src/lib/layouts/stats/Skills.svelte @@ -3,15 +3,19 @@ import type { Stats as StatsType } from "$lib/types/stats"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile");
- + {#await profile} + Loading + {:then profile} + -
- {#each Object.entries(profile.skills.skills) as [skillName, skillData]} - - {/each} -
+
+ {#each Object.entries(profile.skills.skills) as [skillName, skillData]} + + {/each} +
+ {/await}
diff --git a/src/lib/layouts/stats/Stats.svelte b/src/lib/layouts/stats/Stats.svelte index cbd5bbf5d..d93aa4760 100644 --- a/src/lib/layouts/stats/Stats.svelte +++ b/src/lib/layouts/stats/Stats.svelte @@ -5,13 +5,17 @@ import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); - const stats = getPlayerStats(profile); + const stats = async () => getPlayerStats(await profile);
- {#each Object.entries(stats) as [statName, statData]} - - {/each} + {#await stats} + Loading + {:then stats} + {#each Object.entries(stats) as [statName, statData]} + + {/each} + {/await}
diff --git a/src/lib/sections/stats/Accessories.svelte b/src/lib/sections/stats/Accessories.svelte index 791955fed..5ce7b8dca 100644 --- a/src/lib/sections/stats/Accessories.svelte +++ b/src/lib/sections/stats/Accessories.svelte @@ -1,174 +1,177 @@ - {#if accessories.accessories.length > 0} -
- - - -
-
-

Accessories Breakdown

-

From your accessory bag.

-
-
-
    -
  • - 22 MP - × - {accessories.magicalPower.rarities.mythic.amount} Accs. - = - {accessories.magicalPower.rarities.mythic.magicalPower} MP -
  • -
  • - 16 MP - × - {accessories.magicalPower.rarities.legendary.amount} Accs. - = - {accessories.magicalPower.rarities.legendary.magicalPower} MP -
  • -
  • - 12 MP - × - {accessories.magicalPower.rarities.epic.amount} Accs. - = - {accessories.magicalPower.rarities.epic.magicalPower} MP -
  • -
  • - 8 MP - × - {accessories.magicalPower.rarities.rare.amount} Accs. - = - {accessories.magicalPower.rarities.rare.magicalPower} MP -
  • -
  • - 5 MP - × - {accessories.magicalPower.rarities.uncommon.amount} Accs. - = - {accessories.magicalPower.rarities.uncommon.magicalPower} MP -
  • -
  • - 3 MP - × - {accessories.magicalPower.rarities.common.amount} Accs. - = - {accessories.magicalPower.rarities.common.magicalPower} MP -
  • -
  • - 3 MP - × - {accessories.magicalPower.rarities.special.amount} Accs. - = - {accessories.magicalPower.rarities.special.magicalPower} MP -
  • -
  • - 5 MP - × - {accessories.magicalPower.rarities.very_special.amount} Accs. - = - {accessories.magicalPower.rarities.very_special.magicalPower} MP -
  • -
-
- -
-
    - {#if accessories.magicalPower.abiphone > 0} + {#await profile} + Loading + {:then profile} + {@const accessories = profile.accessories} + {#if accessories.accessories.length > 0} +
    + + + +
    +
    +

    Accessories Breakdown

    +

    From your accessory bag.

    +
    +
    +
    • - Abicase: + 22 MP + × + {accessories.magicalPower.rarities.mythic.amount} Accs. = - +{accessories.magicalPower.abiphone} MP + {accessories.magicalPower.rarities.mythic.magicalPower} MP
    • - {/if} - {#if accessories.magicalPower.riftPrism > 0}
    • - Rift Prism: + 16 MP + × + {accessories.magicalPower.rarities.legendary.amount} Accs. = - +{accessories.magicalPower.riftPrism} MP + {accessories.magicalPower.rarities.legendary.magicalPower} MP
    • - {/if} - {#if accessories.magicalPower.hegemony.amount > 0 && accessories.magicalPower.hegemony.rarity}
    • - Hegemony Artifact: + 12 MP + × + {accessories.magicalPower.rarities.epic.amount} Accs. = - +{accessories.magicalPower.hegemony} MP + {accessories.magicalPower.rarities.epic.magicalPower} MP
    • - {/if} -
    -
    -

    - Total: - - {accessories.magicalPower.total} Magical Power - -

    -
    -
    -
    -
    - - {#each accessories.accessories as accessory} - {#if accessory.isInactive === false} - - {/if} - {/each} - -

    - Enrichments: - {accessories.enrichments.missing}× Missing Enrichment! -

    - -
    - - {#each accessories.accessories as accessory} - {#if accessory.isInactive === true} - - {/if} - {/each} - - -
    +
  • + 8 MP + × + {accessories.magicalPower.rarities.rare.amount} Accs. + = + {accessories.magicalPower.rarities.rare.magicalPower} MP +
  • +
  • + 5 MP + × + {accessories.magicalPower.rarities.uncommon.amount} Accs. + = + {accessories.magicalPower.rarities.uncommon.magicalPower} MP +
  • +
  • + 3 MP + × + {accessories.magicalPower.rarities.common.amount} Accs. + = + {accessories.magicalPower.rarities.common.magicalPower} MP +
  • +
  • + 3 MP + × + {accessories.magicalPower.rarities.special.amount} Accs. + = + {accessories.magicalPower.rarities.special.magicalPower} MP +
  • +
  • + 5 MP + × + {accessories.magicalPower.rarities.very_special.amount} Accs. + = + {accessories.magicalPower.rarities.very_special.magicalPower} MP +
  • +
+
- {#if accessories.missing.length > 0 || accessories.upgrades.length > 0} - - -

Missing Accessories

-
- - {#if accessories.missing.length > 0} - - {#each accessories.missing as accessory} - - {/each} - +
+
    + {#if accessories.magicalPower.abiphone > 0} +
  • + Abicase: + = + +{accessories.magicalPower.abiphone} MP +
  • + {/if} + {#if accessories.magicalPower.riftPrism > 0} +
  • + Rift Prism: + = + +{accessories.magicalPower.riftPrism} MP +
  • + {/if} + {#if accessories.magicalPower.hegemony.amount > 0 && accessories.magicalPower.hegemony.rarity} +
  • + Hegemony Artifact: + = + +{accessories.magicalPower.hegemony} MP +
  • + {/if} +
+
+

+ Total: + + {accessories.magicalPower.total} Magical Power + +

+
+
+
+
+ + {#each accessories.accessories as accessory} + {#if accessory.isInactive === false} + {/if} - {#if accessories.upgrades.length > 0} - - {#each accessories.upgrades as accessory} - - {/each} - + {/each} + +

+ Enrichments: + {accessories.enrichments.missing}× Missing Enrichment! +

+ +
+ + {#each accessories.accessories as accessory} + {#if accessory.isInactive === true} + {/if} - - - {/if} -
- {:else} -

{profile.username} doesn't have any accessories.

- {/if} + {/each} +
+ +
+ + {#if accessories.missing.length > 0 || accessories.upgrades.length > 0} + + +

Missing Accessories

+
+ + {#if accessories.missing.length > 0} + + {#each accessories.missing as accessory} + + {/each} + + {/if} + {#if accessories.upgrades.length > 0} + + {#each accessories.upgrades as accessory} + + {/each} + + {/if} + +
+ {/if} +
+ {:else} +

{profile.username} doesn't have any accessories.

+ {/if} + {/await} diff --git a/src/lib/sections/stats/Armor.svelte b/src/lib/sections/stats/Armor.svelte index 4440f1e25..6aaccfc9c 100644 --- a/src/lib/sections/stats/Armor.svelte +++ b/src/lib/sections/stats/Armor.svelte @@ -8,39 +8,41 @@ import type { Stats as StatsType } from "$lib/types/stats"; import { getContext } from "svelte"; - const profile = getContext("profile"); - - const armor = profile.items.armor; - const equipment = profile.items.equipment; - const wardrobe = profile.items.wardrobe; - - const firstWardrobeItems = wardrobe.map((wardrobeItems) => wardrobeItems.find((piece) => piece)); + const profile = getContext>("profile"); - -
- {#if armor.set_name} -

- Set: - {armor.set_name} -

- {/if} -
- {#each armor.armor as piece} - - {/each} - -
+{#await profile} + Loading +{:then profile} + {@const armor = profile.items.armor} + {@const equipment = profile.items.equipment} + {@const wardrobe = profile.items.wardrobe} + {@const firstWardrobeItems = wardrobe.map((wardrobeItems) => wardrobeItems.find((piece) => piece))} + +
+ {#if armor.set_name} +

+ Set: + {armor.set_name} +

+ {/if} +
+ {#each armor.armor as piece} + + {/each} + +
- - {#each equipment.equipment as piece} - - {/each} - - + + {#each equipment.equipment as piece} + + {/each} + + - - {#each firstWardrobeItems as _, i} - - {/each} - + + {#each firstWardrobeItems as _, i} + + {/each} + +{/await} diff --git a/src/lib/sections/stats/Bestiary.svelte b/src/lib/sections/stats/Bestiary.svelte index 92af59976..1107cabdd 100644 --- a/src/lib/sections/stats/Bestiary.svelte +++ b/src/lib/sections/stats/Bestiary.svelte @@ -7,7 +7,7 @@ import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const bestiary = profile.bestiary; diff --git a/src/lib/sections/stats/Collections.svelte b/src/lib/sections/stats/Collections.svelte index e5496133d..8b95862b7 100644 --- a/src/lib/sections/stats/Collections.svelte +++ b/src/lib/sections/stats/Collections.svelte @@ -8,7 +8,7 @@ import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const collections = profile.collections; diff --git a/src/lib/sections/stats/CrimsonIsle.svelte b/src/lib/sections/stats/CrimsonIsle.svelte index c958c0475..b5972a3a4 100644 --- a/src/lib/sections/stats/CrimsonIsle.svelte +++ b/src/lib/sections/stats/CrimsonIsle.svelte @@ -8,7 +8,7 @@ import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const isle = profile.crimson_isle; diff --git a/src/lib/sections/stats/Dungeons.svelte b/src/lib/sections/stats/Dungeons.svelte index b025906c0..fd4e1de51 100644 --- a/src/lib/sections/stats/Dungeons.svelte +++ b/src/lib/sections/stats/Dungeons.svelte @@ -10,7 +10,7 @@ import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const dungeons = profile.dungeons; diff --git a/src/lib/sections/stats/Minions.svelte b/src/lib/sections/stats/Minions.svelte index 4f14a7c12..3c64a852a 100644 --- a/src/lib/sections/stats/Minions.svelte +++ b/src/lib/sections/stats/Minions.svelte @@ -6,7 +6,7 @@ import type { Stats as StatsType } from "$lib/types/stats"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const minions = profile.minions; diff --git a/src/lib/sections/stats/MiscSection.svelte b/src/lib/sections/stats/MiscSection.svelte index 70fe34170..6c63e8355 100644 --- a/src/lib/sections/stats/MiscSection.svelte +++ b/src/lib/sections/stats/MiscSection.svelte @@ -17,7 +17,7 @@ import Uncategorized from "./misc/uncategorized.svelte"; import Upgrades from "./misc/upgrades.svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); setContext("misc", profile.misc); diff --git a/src/lib/sections/stats/Pets.svelte b/src/lib/sections/stats/Pets.svelte index d23fcd092..c026d16f9 100644 --- a/src/lib/sections/stats/Pets.svelte +++ b/src/lib/sections/stats/Pets.svelte @@ -1,9 +1,9 @@
- - - -
-

Pet score is calculated based on how many unique pets you have and the rarity of these pets.

-

You gain an additional score for each max level pet you have!

-
-
-
- - - + {#await profile} + Loading + {:then profile} + {@const pets = profile.pets} + + + +
+

Pet score is calculated based on how many unique pets you have and the rarity of these pets.

+

You gain an additional score for each max level pet you have!

+
+
+
+ + + + {/await}
- {@const activePet = pets.pets.find((pet) => pet.active === true)} - {#if activePet !== undefined} -
-
- -
-

{activePet.rarity} {activePet.display_name}

-

Level {activePet.level.level}

-
-
- -
- {/if} -
- {@const uniquePets = uniqBy(pets.pets, "type")} - {@const otherPets = pets.pets.filter((pet) => !uniquePets.includes(pet))} - - - {#each uniquePets as pet} - {#if !pet.active} + {#await profile} + Loading + {:then profile} + {@const pets = profile.pets} + {@const activePet = pets.pets.find((pet) => pet.active === true)} + {#if activePet !== undefined}
- -

LVL {pet.level.level}

+
+ +
+

{activePet.rarity} {activePet.display_name}

+

Level {activePet.level.level}

+
+
+
{/if} - {/each} + {/await}
+ {#await profile} + Loading + {:then profile} + {@const pets = profile.pets} + {@const uniquePets = uniqBy(pets.pets, "type")} + {@const otherPets = pets.pets.filter((pet) => !uniquePets.includes(pet))} - {#if otherPets.length > 0 || pets.missing.length > 0} -
- {#if otherPets.length > 0} - - -

Show More Pets

-
-
- - - {#each otherPets as pet} -
- -

LVL {pet.level.level}

-
- {/each} -
-
-
- {/if} - {#if pets.missing.length > 0} - - -

Missing Pets

-
-
- - - {#each pets.missing as pet} -
- -
- {/each} -
-
-
- {/if} -
- {/if} + + {#each uniquePets as pet} + {#if !pet.active} +
+ +

LVL {pet.level.level}

+
+ {/if} + {/each} +
+ + {#if otherPets.length > 0 || pets.missing.length > 0} +
+ {#if otherPets.length > 0} + + +

Show More Pets

+
+
+ + + {#each otherPets as pet} +
+ +

LVL {pet.level.level}

+
+ {/each} +
+
+
+ {/if} + {#if pets.missing.length > 0} + + +

Missing Pets

+
+
+ + + {#each pets.missing as pet} +
+ +
+ {/each} +
+
+
+ {/if} +
+ {/if} + {/await}
diff --git a/src/lib/sections/stats/Rift.svelte b/src/lib/sections/stats/Rift.svelte index 9af5e9f0d..b685bc9aa 100644 --- a/src/lib/sections/stats/Rift.svelte +++ b/src/lib/sections/stats/Rift.svelte @@ -2,13 +2,13 @@ import AdditionStat from "$lib/components/AdditionStat.svelte"; import Chip from "$lib/components/Chip.svelte"; import Items from "$lib/layouts/stats/Items.svelte"; - import { format } from "numerable"; import { cn } from "$lib/shared/utils"; import type { Stats as StatsType } from "$lib/types/stats"; import { formatDate, formatDistanceToNowStrict } from "date-fns"; + import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const rift = profile.rift; diff --git a/src/lib/sections/stats/Slayer.svelte b/src/lib/sections/stats/Slayer.svelte index 9afacafc8..20fafc5ae 100644 --- a/src/lib/sections/stats/Slayer.svelte +++ b/src/lib/sections/stats/Slayer.svelte @@ -7,7 +7,7 @@ import { format } from "numerable"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const slayer = profile.slayer; diff --git a/src/lib/sections/stats/Weapons.svelte b/src/lib/sections/stats/Weapons.svelte index e1c85756f..38d9da7ff 100644 --- a/src/lib/sections/stats/Weapons.svelte +++ b/src/lib/sections/stats/Weapons.svelte @@ -5,17 +5,23 @@ import type { Stats as StatsType } from "$lib/types/stats"; import { getContext } from "svelte"; - const profile = getContext("profile"); - - const weapons = profile.items.weapons; + const profile = getContext>("profile");
- + {#await profile} + Loading + {:then profile} + + {/await}
- {#each weapons.weapons as weapon} - - {/each} + {#await profile} + Loading + {:then profile} + {#each profile.items.weapons.weapons as weapon} + + {/each} + {/await}
diff --git a/src/lib/sections/stats/skills/enchanting.svelte b/src/lib/sections/stats/skills/enchanting.svelte index 3141df8dc..353d8ff05 100644 --- a/src/lib/sections/stats/skills/enchanting.svelte +++ b/src/lib/sections/stats/skills/enchanting.svelte @@ -8,7 +8,7 @@ import { getContext } from "svelte"; import { fade } from "svelte/transition"; - const profile = getContext("profile"); + const profile = getContext>("profile");

Enchanting

diff --git a/src/lib/sections/stats/skills/farming.svelte b/src/lib/sections/stats/skills/farming.svelte index 8bb581e54..53462c784 100644 --- a/src/lib/sections/stats/skills/farming.svelte +++ b/src/lib/sections/stats/skills/farming.svelte @@ -10,7 +10,7 @@ import ChevronDown from "lucide-svelte/icons/chevron-down"; import { getContext } from "svelte"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const highestPriorityFarmingTool = profile.items.farming_tools.highest_priority_tool; const farmingTools = profile.items.farming_tools.tools; diff --git a/src/lib/sections/stats/skills/fishing.svelte b/src/lib/sections/stats/skills/fishing.svelte index 947507cc4..7ea353dfa 100644 --- a/src/lib/sections/stats/skills/fishing.svelte +++ b/src/lib/sections/stats/skills/fishing.svelte @@ -13,7 +13,7 @@ import { getContext } from "svelte"; import { fade } from "svelte/transition"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const highestPriorityFishingTool = profile.items.fishing_tools.highest_priority_tool; const fishingTools = profile.items.fishing_tools.tools; diff --git a/src/lib/sections/stats/skills/mining.svelte b/src/lib/sections/stats/skills/mining.svelte index 689b71e8b..26017c71c 100644 --- a/src/lib/sections/stats/skills/mining.svelte +++ b/src/lib/sections/stats/skills/mining.svelte @@ -10,7 +10,7 @@ import { getContext } from "svelte"; import { fade } from "svelte/transition"; - const profile = getContext("profile"); + const profile = getContext>("profile"); const highestPriorityMiningTool = profile.items.mining_tools.highest_priority_tool; const miningTools = profile.items.mining_tools.tools; diff --git a/src/lib/server/constants/NotEnoughUpdates-REPO b/src/lib/server/constants/NotEnoughUpdates-REPO index 746a61047..58c6eac1b 160000 --- a/src/lib/server/constants/NotEnoughUpdates-REPO +++ b/src/lib/server/constants/NotEnoughUpdates-REPO @@ -1 +1 @@ -Subproject commit 746a61047e031ad8e30f354b43785b24f4655de6 +Subproject commit 58c6eac1b9ca0b52f997eb41a9c275aa1bfe4a98 diff --git a/src/routes/stats/[ign]/[[profile]]/+page.svelte b/src/routes/stats/[ign]/[[profile]]/+page.svelte index 0bc2a4264..6782d627b 100644 --- a/src/routes/stats/[ign]/[[profile]]/+page.svelte +++ b/src/routes/stats/[ign]/[[profile]]/+page.svelte @@ -4,13 +4,9 @@ export let data: PageData; - (async () => { - console.log(await data.user); - })(); + // (async () => { + // console.log(await data.user); + // })(); -{#await data.user then user} - {#if user && user.profiles} -
- {/if} -{/await} +