From 29dbeba95d7f9d5ffd95509e74d5b3ad5ba0545a Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Sat, 9 Apr 2022 18:55:52 -0500
Subject: Don't show redundant unit in leaderboard section

Also bump sveltekit version
---
 src/lib/sections/FarmingContests.svelte | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/lib/sections/FarmingContests.svelte')

diff --git a/src/lib/sections/FarmingContests.svelte b/src/lib/sections/FarmingContests.svelte
index ca4f1a7..8eef53d 100644
--- a/src/lib/sections/FarmingContests.svelte
+++ b/src/lib/sections/FarmingContests.svelte
@@ -3,10 +3,15 @@
 	import Emoji from '$lib/Emoji.svelte'
 	import ListItemWithIcon from '$lib/ListItemWithIcon.svelte'
 	import { skyblockItemToUrl } from '$lib/minecraft/inventory'
-	import Item from '$lib/minecraft/Item.svelte'
-	import { cleanId, millisecondsToTime, skyblockTime, toTitleCase } from '$lib/utils'
+	import { skyblockTime } from '$lib/utils'
 
 	export let data: CleanMemberProfile
+
+	let cachedItemUrls: Record<string, string> = {}
+	function cachedSkyblockItemToUrl(item: string) {
+		if (!cachedItemUrls[item]) cachedItemUrls[item] = skyblockItemToUrl(item)
+		return cachedItemUrls[item]
+	}
 </script>
 
 <div class="info-text primary-info-text">
@@ -22,7 +27,7 @@
 			</p>
 			<ul>
 				{#each farmingContest.crops as crop}
-					<ListItemWithIcon src={skyblockItemToUrl(crop.item)}>
+					<ListItemWithIcon src={cachedSkyblockItemToUrl(crop.item)}>
 						<b>{crop.amount.toLocaleString()}</b> collected
 						{#if crop.position}
 							<span class="farming-contest-item-placement">
-- 
cgit 

