From 62b39dd911dc3e2b0c97f465057d657d71ccc42b Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 18 May 2022 18:21:03 +0000 Subject: show auction item previews --- src/lib/APITypes.d.ts | 1 + src/routes/auctionprices.svelte | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/lib/APITypes.d.ts b/src/lib/APITypes.d.ts index 95231f7..e01a950 100644 --- a/src/lib/APITypes.d.ts +++ b/src/lib/APITypes.d.ts @@ -451,5 +451,6 @@ export interface SimpleAuctionSchema { export interface ItemAuctionsSchema { /** The id of the item */ id: string + sbId: string auctions: SimpleAuctionSchema[] } diff --git a/src/routes/auctionprices.svelte b/src/routes/auctionprices.svelte index 95e062b..c630e60 100644 --- a/src/routes/auctionprices.svelte +++ b/src/routes/auctionprices.svelte @@ -24,9 +24,11 @@ import AuctionPriceScatterplot from '$lib/AuctionPriceScatterplot.svelte' import AuctionPreviewTooltip from '$lib/AuctionPreviewTooltip.svelte' import { browser } from '$app/env' + import Item from '$lib/minecraft/Item.svelte' + import furfskyReborn from 'skyblock-assets/matchers/furfsky_reborn.json' export let data: ItemAuctionsSchema[] - export let auctionItems: Record + export let auctionItems: Record let currentlyPreviewedAuction: PreviewedAuctionData | null @@ -38,7 +40,7 @@ $: { pageNumber = 0 allMatchingItemIds = Object.entries(auctionItems) - .filter(a => removeFormattingCode(a[1].toLowerCase()).includes(queryNormalized)) + .filter(a => removeFormattingCode(a[1]?.display.name.toLowerCase()).includes(queryNormalized)) .map(a => a[0]) } $: { @@ -102,8 +104,18 @@ {#each data as item (item.id)} {@const binAuctions = item.auctions.filter(i => i.bin)} {@const normalAuctions = item.auctions.filter(i => !i.bin)} + {@const itemData = auctionItems[item.sbId]}
-

{removeFormattingCode(auctionItems[item.id] ?? cleanId(item.id.toLowerCase()))}

+ {#if itemData && itemData.vanillaId} +
+ +
+ {/if} +

+ {removeFormattingCode( + auctionItems[item.id]?.display.name ?? cleanId(item.id.toLowerCase()) + )} +

{#if binAuctions.length > 0}

@@ -173,4 +185,8 @@ .auctions-info-text b { color: var(--theme-main-text); } + + .item-slot-container { + float: right; + } -- cgit