- Fix timeframe parameter handling in enhanced-screenshot API route - Support both 'timeframe' (singular) and 'timeframes' (array) parameters - Add proper sessionId propagation for real-time progress tracking - Enhance MACD analysis prompt with detailed crossover definitions - Add progress tracker service with Server-Sent Events support - Fix Next.js build errors in chart components (module variable conflicts) - Change dev environment port from 9000:3000 to 9001:3000 - Improve AI analysis layout detection logic - Add comprehensive progress tracking through all service layers
96 lines
2.7 KiB
TypeScript
96 lines
2.7 KiB
TypeScript
'use client'
|
|
import React, { useEffect, useRef, useState } from 'react'
|
|
|
|
export default function SimpleTest() {
|
|
const chartContainerRef = useRef<HTMLDivElement>(null)
|
|
const [status, setStatus] = useState('Initializing...')
|
|
|
|
useEffect(() => {
|
|
const initChart = async () => {
|
|
try {
|
|
setStatus('Importing library...')
|
|
|
|
// Test if we can import the library
|
|
const chartModule = await import('lightweight-charts')
|
|
setStatus('Library imported')
|
|
|
|
// Test if we can extract functions
|
|
const { createChart } = chartModule
|
|
setStatus('Functions extracted')
|
|
|
|
if (!chartContainerRef.current) {
|
|
setStatus('No container element')
|
|
return
|
|
}
|
|
|
|
setStatus('Creating chart...')
|
|
|
|
// Create chart with explicit dimensions
|
|
const chart = createChart(chartContainerRef.current, {
|
|
width: 800,
|
|
height: 400,
|
|
layout: {
|
|
background: { color: '#1a1a1a' },
|
|
textColor: '#ffffff',
|
|
},
|
|
})
|
|
|
|
setStatus('Chart created')
|
|
|
|
// Add series
|
|
const series = chart.addCandlestickSeries({
|
|
upColor: '#00ff00',
|
|
downColor: '#ff0000',
|
|
})
|
|
|
|
setStatus('Series added')
|
|
|
|
// Add simple data
|
|
series.setData([
|
|
{ time: '2025-07-14', open: 100, high: 105, low: 95, close: 102 },
|
|
{ time: '2025-07-15', open: 102, high: 107, low: 98, close: 104 },
|
|
{ time: '2025-07-16', open: 104, high: 109, low: 101, close: 106 },
|
|
])
|
|
|
|
setStatus('Data set - Chart should be visible!')
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error)
|
|
setStatus(`Error: ${error}`)
|
|
}
|
|
}
|
|
|
|
initChart()
|
|
}, [])
|
|
|
|
return (
|
|
<div className="min-h-screen bg-gray-900 p-8">
|
|
<h1 className="text-white text-3xl mb-4">Simple Chart Test</h1>
|
|
<div className="text-green-400 text-lg mb-4">Status: {status}</div>
|
|
|
|
<div className="bg-red-500 p-2 mb-4 text-white">
|
|
This red border should help us see if the container is properly sized
|
|
</div>
|
|
|
|
<div
|
|
ref={chartContainerRef}
|
|
className="border-4 border-yellow-500 bg-gray-800"
|
|
style={{
|
|
width: '800px',
|
|
height: '400px',
|
|
display: 'block',
|
|
position: 'relative'
|
|
}}
|
|
>
|
|
<div className="text-white p-4">
|
|
Container content - this should be replaced by the chart
|
|
</div>
|
|
</div>
|
|
|
|
<div className="text-gray-400 mt-4">
|
|
Container ref: {chartContainerRef.current ? 'Available' : 'Not available'}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|