From b592102566cf914659f3b9badacdc32b04c1518f Mon Sep 17 00:00:00 2001
From: Zickles <76439587+Zickles@users.noreply.github.com>
Date: Thu, 13 Jun 2024 10:46:47 -0400
Subject: [PATCH] feat(pets): add pets section (#2)
---
src/lib/components/Item.svelte | 11 ++--
src/lib/layouts/stats/Main.svelte | 2 +
src/lib/sections/stats/Pets.svelte | 98 ++++++++++++++++++++++++++++++
3 files changed, 107 insertions(+), 4 deletions(-)
create mode 100644 src/lib/sections/stats/Pets.svelte
diff --git a/src/lib/components/Item.svelte b/src/lib/components/Item.svelte
index ebd6a9176..5d33a7e70 100644
--- a/src/lib/components/Item.svelte
+++ b/src/lib/components/Item.svelte
@@ -7,7 +7,7 @@
export let piece: Item;
- const itemNameHtml = renderLore(piece.tag.display.Name ?? piece.display_name ?? "???");
+ const itemNameHtml = renderLore((piece.tag.display && piece.tag.display.Name) ?? piece.display_name ?? "???");
const isMulticolor = (itemNameHtml.match(/<\/span>/g) || []).length > 1;
const bgColor = getRarityClass(piece.rarity as string, "bg");
const enchanted = isEnchanted(piece);
@@ -37,9 +37,12 @@
- {#each piece.tag.display.Lore as lore}
- {@html renderLore(lore)}
- {/each}
+ {#if piece.tag.display && piece.tag.display.Lore}
+ {#each piece.tag.display.Lore as lore}
+ {@html renderLore(lore)}
+ {/each}
+ {/if}
+
diff --git a/src/lib/layouts/stats/Main.svelte b/src/lib/layouts/stats/Main.svelte
index 835ae4d68..37a32e0b3 100644
--- a/src/lib/layouts/stats/Main.svelte
+++ b/src/lib/layouts/stats/Main.svelte
@@ -7,6 +7,7 @@
import Weapons from "$lib/sections/stats/Weapons.svelte";
import type { FullProfile } from "$lib/types/globals";
import { setContext } from "svelte";
+ import Pets from "$lib/sections/stats/Pets.svelte";
export let profile;
export let profiles;
@@ -22,6 +23,7 @@
+