diff options
author | mat <github@matdoes.dev> | 2022-05-18 18:21:03 +0000 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-05-18 18:21:03 +0000 |
commit | 62b39dd911dc3e2b0c97f465057d657d71ccc42b (patch) | |
tree | 50bdc03bd1ec3060cdfc33903d82721b1fa3c8ee | |
parent | aeebc84c5bbecb29707e4ace0ce515cdde0bb27b (diff) | |
download | skyblock-stats-62b39dd911dc3e2b0c97f465057d657d71ccc42b.tar.gz skyblock-stats-62b39dd911dc3e2b0c97f465057d657d71ccc42b.tar.bz2 skyblock-stats-62b39dd911dc3e2b0c97f465057d657d71ccc42b.zip |
show auction item previews
-rw-r--r-- | src/lib/APITypes.d.ts | 1 | ||||
-rw-r--r-- | 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<string, string> + export let auctionItems: Record<string, { display: { name: string }; vanillaId?: string }> 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]} <div class="item-container"> - <h2>{removeFormattingCode(auctionItems[item.id] ?? cleanId(item.id.toLowerCase()))}</h2> + {#if itemData && itemData.vanillaId} + <div class="item-slot-container"> + <Item item={{ ...itemData, id: item.id }} pack={furfskyReborn} headSize={50} isslot /> + </div> + {/if} + <h2> + {removeFormattingCode( + auctionItems[item.id]?.display.name ?? cleanId(item.id.toLowerCase()) + )} + </h2> <div class="auctions-info-text"> {#if binAuctions.length > 0} <p> @@ -173,4 +185,8 @@ .auctions-info-text b { color: var(--theme-main-text); } + + .item-slot-container { + float: right; + } </style> |