From 1482422f2f5b236cdcdff4429ae06bb55dca4083 Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Sun, 17 May 2026 12:46:13 -0700 Subject: Add stack start and stop scripts --- frontend/components/PriceChart.tsx | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 frontend/components/PriceChart.tsx (limited to 'frontend/components') diff --git a/frontend/components/PriceChart.tsx b/frontend/components/PriceChart.tsx new file mode 100644 index 0000000..8ce4ea9 --- /dev/null +++ b/frontend/components/PriceChart.tsx @@ -0,0 +1,46 @@ +"use client"; + +import dynamic from "next/dynamic"; +import type { Data, Layout } from "plotly.js"; +import type { HistoryPoint } from "@/types/api"; + +const Plot = dynamic(() => import("react-plotly.js"), { ssr: false }); + +type Props = { + symbol: string; + points: HistoryPoint[]; +}; + +export function PriceChart({ symbol, points }: Props) { + const x = points.map((point) => point.date); + const y = points.map((point) => point.close ?? null); + const data: Data[] = [ + { + x, + y, + type: "scatter", + mode: "lines", + name: symbol, + line: { color: "#C2AA7A", width: 2.4 }, + fill: "tozeroy", + fillcolor: "rgba(194,170,122,0.10)" + } + ]; + const layout: Partial = { + autosize: true, + height: 360, + margin: { l: 52, r: 18, t: 18, b: 38 }, + paper_bgcolor: "rgba(0,0,0,0)", + plot_bgcolor: "rgba(0,0,0,0)", + hovermode: "x unified", + font: { family: "IBM Plex Mono, monospace", color: "#8E8676" }, + xaxis: { showgrid: false, zeroline: false }, + yaxis: { showgrid: true, gridcolor: "#232934", tickprefix: "$", tickformat: ",.2f" } + }; + + if (!points.length) { + return
No price history available for this period.
; + } + + return ; +} -- cgit v1.3-2-g0d8e