UI: ensure dark text on job detail and job history cards (avoid white-on-light backgrounds)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -14,21 +14,39 @@ interface ChartDataPoint {
|
||||
interface TradingViewChartProps {
|
||||
ticker: string;
|
||||
data?: ChartDataPoint[];
|
||||
timeframe?: string;
|
||||
}
|
||||
|
||||
export default function TradingViewChart({ ticker, data }: TradingViewChartProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const TIMEFRAME_HEIGHTS: Record<string, number> = {
|
||||
"1D": 300,
|
||||
"5Min": 250,
|
||||
"15Min": 250,
|
||||
"1H": 350,
|
||||
"1W": 400,
|
||||
};
|
||||
|
||||
export default function TradingViewChart({ ticker, data, timeframe = "1D" }: TradingViewChartProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const height = TIMEFRAME_HEIGHTS[timeframe] ?? 400;
|
||||
|
||||
const isIntraday = ["1Min", "5Min", "15Min", "30Min", "1H"].includes(timeframe);
|
||||
|
||||
useEffect(() => {
|
||||
if (!containerRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const chart = LightweightCharts.createChart(containerRef.current, {
|
||||
height: 400,
|
||||
height,
|
||||
autoSize: true,
|
||||
});
|
||||
|
||||
// Configure time scale based on timeframe and range
|
||||
chart.timeScale().applyOptions({
|
||||
timeVisible: isIntraday,
|
||||
secondsVisible: timeframe === "1Min",
|
||||
});
|
||||
|
||||
const candlestickSeries = chart.addSeries(LightweightCharts.CandlestickSeries, {
|
||||
upColor: "#26a69a",
|
||||
downColor: "#ef5350",
|
||||
@@ -41,13 +59,15 @@ export default function TradingViewChart({ ticker, data }: TradingViewChartProps
|
||||
if (data && data.length > 0) {
|
||||
try {
|
||||
candlestickSeries.setData(data as any);
|
||||
// Fit the visible data range
|
||||
chart.timeScale().fitContent();
|
||||
} catch (err) {
|
||||
console.error(`TradingViewChart: error setting data for ${ticker}`, err);
|
||||
}
|
||||
}
|
||||
|
||||
return () => chart.remove();
|
||||
}, [data, ticker]);
|
||||
}, [data, ticker, isIntraday, timeframe]);
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl shadow-lg p-4">
|
||||
|
||||
Reference in New Issue
Block a user