From cd9748e59f1dd9ef31afb22195b8d5a1346ec5c3 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 16 May 2022 00:09:44 -0500 Subject: start adding auctionprices page --- src/lib/APITypes.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/lib/APITypes.d.ts') diff --git a/src/lib/APITypes.d.ts b/src/lib/APITypes.d.ts index 6402721..6429e8b 100644 --- a/src/lib/APITypes.d.ts +++ b/src/lib/APITypes.d.ts @@ -434,3 +434,22 @@ export interface AccessoryBagUpgrades { list: string[] } } + +export interface SimpleAuctionSchema { + /** The UUID of the auction so we can look it up later. */ + id: string + coins: number + /** + * The timestamp as **seconds** since epoch. It's in seconds instead of ms + * since we don't need to be super exact and so it's shorter. + */ + ts: number + /** Whether the auction was bought or simply expired. */ + success: boolean + bin: boolean +} +export interface ItemAuctionsSchema { + /** The id of the item */ + _id: string + auctions: SimpleAuctionSchema[] +} -- cgit From c057eb0aaed4a746f2d3a4f15688ef21cc6213b3 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 17 May 2022 20:48:54 -0500 Subject: fixes and improved tooltip --- src/lib/APITypes.d.ts | 2 +- src/lib/AuctionPreviewTooltip.svelte | 20 +++++++++----------- src/lib/AuctionPriceScatterplot.svelte | 4 ++-- src/lib/api.ts | 1 + src/routes/auctionprices.svelte | 4 ++-- 5 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src/lib/APITypes.d.ts') diff --git a/src/lib/APITypes.d.ts b/src/lib/APITypes.d.ts index 6429e8b..95231f7 100644 --- a/src/lib/APITypes.d.ts +++ b/src/lib/APITypes.d.ts @@ -450,6 +450,6 @@ export interface SimpleAuctionSchema { } export interface ItemAuctionsSchema { /** The id of the item */ - _id: string + id: string auctions: SimpleAuctionSchema[] } diff --git a/src/lib/AuctionPreviewTooltip.svelte b/src/lib/AuctionPreviewTooltip.svelte index 417f8b3..a3a73fb 100644 --- a/src/lib/AuctionPreviewTooltip.svelte +++ b/src/lib/AuctionPreviewTooltip.svelte @@ -1,34 +1,32 @@ - + {#if lastPreview} - {@const date = new Date(lastPreview.auction.ts * 1000)}

{lastPreview.auction.coins.toLocaleString()} coins

- +
{/if} diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte index 0532f97..cfdbe9b 100644 --- a/src/lib/AuctionPriceScatterplot.svelte +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -57,7 +57,7 @@ diff --git a/src/lib/api.ts b/src/lib/api.ts index 689a952..1721d01 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,2 +1,3 @@ // the trailing slash is required export const API_URL = 'https://skyblock-api.matdoes.dev/' +// export const API_URL = 'http://localhost:8080/' diff --git a/src/routes/auctionprices.svelte b/src/routes/auctionprices.svelte index eccaab7..3c301d0 100644 --- a/src/routes/auctionprices.svelte +++ b/src/routes/auctionprices.svelte @@ -72,11 +72,11 @@
- {#each data as item (item._id)} + {#each data as item (item.id)} {@const binAuctions = item.auctions.filter(i => i.bin)} {@const normalAuctions = item.auctions.filter(i => !i.bin)}
-

{auctionItems[item._id]}

+

{auctionItems[item.id]}

{#if binAuctions.length > 0}

-- cgit 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(-) (limited to 'src/lib/APITypes.d.ts') 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