From 8ba9c7090c88c04d43ca727b7ed012cf5a6b58c8 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 16 May 2022 15:36:06 +0000 Subject: start adding really basic tooltip --- src/lib/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/utils.ts') diff --git a/src/lib/utils.ts b/src/lib/utils.ts index e34d573..c2e4b86 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -219,4 +219,10 @@ export function skyblockTime(year: number, month = 1, day = 1) { if (month) time += 37200000 * (month - 1) if (day) time += 1200000 * (day - 1) return time -} \ No newline at end of file +} + +export interface PreviewedAuctionData { + pageX: number + pageY: number + uuid: string +} -- cgit From b6d23f4334eae873e7d32a4d5bb5f8b3a1a67ce5 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 17 May 2022 16:20:20 +0000 Subject: improved auction price scatterplot --- src/lib/AuctionPreviewTooltip.svelte | 40 +++++++++++++++++--- src/lib/AuctionPriceScatterplot.svelte | 68 +++++++++++++++++++++------------- src/lib/utils.ts | 4 +- svelte.config.js | 18 ++++----- 4 files changed, 89 insertions(+), 41 deletions(-) (limited to 'src/lib/utils.ts') diff --git a/src/lib/AuctionPreviewTooltip.svelte b/src/lib/AuctionPreviewTooltip.svelte index 226feee..223cec2 100644 --- a/src/lib/AuctionPreviewTooltip.svelte +++ b/src/lib/AuctionPreviewTooltip.svelte @@ -1,22 +1,52 @@ -{#if preview} -
-

uuid: {JSON.stringify(preview)}

+ + +{#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 e416163..48a3fa5 100644 --- a/src/lib/AuctionPriceScatterplot.svelte +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -1,34 +1,47 @@ @@ -38,20 +51,23 @@ - + {#each item.auctions as auction} - {@const timestampPercentage = - (auction.ts - earliestTimestamp) / (currentTimestamp - earliestTimestamp)} + {@const [x, y] = getAuctionCoordinates(auction)} showAuctionPreview(e, auction.id)} - on:click={e => showAuctionPreview(e, auction.id)} - on:mouseleave={hideAuctionPreview} + tabindex="-1" /> {/each} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c2e4b86..c094db4 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,3 +1,5 @@ +import type { SimpleAuctionSchema } from "./APITypes" + export const colorCodes: { [key: string]: string } = { '0': '#000000', // black '1': '#0000be', // blue @@ -224,5 +226,5 @@ export function skyblockTime(year: number, month = 1, day = 1) { export interface PreviewedAuctionData { pageX: number pageY: number - uuid: string + auction: SimpleAuctionSchema } diff --git a/svelte.config.js b/svelte.config.js index 23b0e12..222cd8f 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -42,15 +42,15 @@ const config = { }, }, // if the user is on replit or gitpod, use a secure websocket - // server: - // process.env.REPL_ID || process.env.GITPOD_WORKSPACE_ID - // ? { - // hmr: { - // protocol: 'wss', - // port: 443, - // }, - // } - // : {}, + server: + process.env.REPL_ID || process.env.GITPOD_WORKSPACE_ID + ? { + hmr: { + protocol: 'wss', + port: 3001, + }, + } + : {}, }, } } -- cgit