From c751f25801ece673a7ecbd55986599ba069ed6e9 Mon Sep 17 00:00:00 2001 From: DuckySoLucky Date: Sun, 15 Dec 2024 20:02:08 +0100 Subject: [PATCH] fix(stats): small fixes --- src/lib/components/Bonus.svelte | 8 +++++++- src/lib/sections/stats/Armor.svelte | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/components/Bonus.svelte b/src/lib/components/Bonus.svelte index 2e78697c..fb42b577 100644 --- a/src/lib/components/Bonus.svelte +++ b/src/lib/components/Bonus.svelte @@ -9,13 +9,19 @@ export { classNames as class }; const statsData = Object.entries(stats); + + function formatValue(value: string) { + return parseFloat(value) + .toFixed(2) + .replace(/\.?0+$/, ""); + }

{title} {#each statsData as [key, value], index} - {value}{STATS_DATA[key].suffix} + {formatValue(value as string)}{STATS_DATA[key].suffix} {STATS_DATA[key].nameTiny} {#if statsData.length - 1 !== index} diff --git a/src/lib/sections/stats/Armor.svelte b/src/lib/sections/stats/Armor.svelte index 03040bef..0119fd84 100644 --- a/src/lib/sections/stats/Armor.svelte +++ b/src/lib/sections/stats/Armor.svelte @@ -18,10 +18,14 @@ -

- Set: - {armor.set_name} -

+
+ {#if armor.set_name} +

+ Set: + {armor.set_name} +

+ {/if} +
{#each armor.armor as piece} {/each}