diff --git a/frontend/src/lib/PriceChart.svelte b/frontend/src/lib/PriceChart.svelte new file mode 100644 index 0000000..4be1074 --- /dev/null +++ b/frontend/src/lib/PriceChart.svelte @@ -0,0 +1,281 @@ + + +{#if coords.length === 0} +

no price checks yet — hit refresh to start tracking.

+{:else} +
+ + (hover = null)} + > + + + + + + + + + + + + + + + + + + + + + + {#each gridLines as g} + + + {g.v.toFixed(0)} + + {/each} + + + {#if targetY != null} + + + target {target?.toFixed(0)} + + {/if} + + + + + + + + + {#each coords as c, i} + + {/each} + + + {#if active} + + + + + + {fmtMoney(active.price)} + + + {fmtFull(active.fetched_at)} + + + {/if} + + + + {fmtDay(points[0].fetched_at)} + + {#if points.length > 1} + + {fmtDay(points[points.length - 1].fetched_at)} + + {/if} + + +
+ + low {fmtMoney(coords[lowIdx].price)} + high {fmtMoney(coords[highIdx].price)} + + {#if latest} + + now {fmtMoney(latest.price)}{onSale ? ' ✦' : ''} + + {/if} +
+
+{/if} diff --git a/frontend/src/routes/lists/[id]/+page.svelte b/frontend/src/routes/lists/[id]/+page.svelte index 64e571f..ba2043a 100644 --- a/frontend/src/routes/lists/[id]/+page.svelte +++ b/frontend/src/routes/lists/[id]/+page.svelte @@ -3,6 +3,7 @@ import { page } from '$app/state'; import { ApiError } from '$lib/api'; import { auth } from '$lib/auth.svelte'; + import PriceChart from '$lib/PriceChart.svelte'; import { lists, listsApi, @@ -403,18 +404,8 @@
{#if historyLoading}

loading history…

- {:else if history.length === 0} -

no price checks yet — hit refresh to start tracking.

{:else} - + {/if}
{/if}