🔒 Implement concurrency protection and remove marketing text
- Add analysisInProgress useRef to prevent multiple simultaneous analyses - Protect all analysis entry points (performAnalysis, quickAnalyze, etc.) - Update button disabled state to include concurrency check - Remove marketing text from analysis page and AIAnalysisPanel - Fix remaining TypeScript compilation errors in chart components - Ensure clean UI without promotional content Fixes sync issues caused by overlapping analysis sessions
This commit is contained in:
@@ -5,16 +5,6 @@ import AIAnalysisPanel from '../../components/AIAnalysisPanel'
|
||||
export default function AnalysisPage() {
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="text-center mb-8">
|
||||
<h1 className="text-3xl font-bold text-white mb-4">
|
||||
🤖 AI-Powered Market Analysis
|
||||
</h1>
|
||||
<p className="text-gray-400 max-w-2xl mx-auto">
|
||||
Get professional trading insights with multi-timeframe analysis, precise entry/exit levels,
|
||||
and institutional-quality recommendations powered by OpenAI.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<AIAnalysisPanel />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -20,13 +20,16 @@ export default function ChartDebug() {
|
||||
const initChart = async () => {
|
||||
try {
|
||||
addLog('Starting chart initialization...')
|
||||
|
||||
// Dynamic import to avoid SSR issues
|
||||
addLog('Importing lightweight-charts...')
|
||||
const LightweightChartsModule = await import('lightweight-charts')
|
||||
addLog('Import successful')
|
||||
|
||||
// Import lightweight-charts
|
||||
const LightweightCharts = await import('lightweight-charts')
|
||||
addLog('Lightweight charts imported successfully')
|
||||
addLog('Available exports: ' + Object.keys(LightweightChartsModule).join(', '))
|
||||
|
||||
const { createChart } = LightweightCharts
|
||||
addLog('createChart extracted')
|
||||
const { createChart } = LightweightChartsModule
|
||||
addLog('Extracted createChart')
|
||||
|
||||
// Create chart with minimal options
|
||||
const chart = createChart(chartContainerRef.current!, {
|
||||
@@ -36,15 +39,30 @@ export default function ChartDebug() {
|
||||
addLog('Chart created successfully')
|
||||
setChartCreated(true)
|
||||
|
||||
// Add candlestick series with the correct v5 API
|
||||
const candlestickSeries = chart.addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
borderDownColor: '#ef5350',
|
||||
borderUpColor: '#26a69a',
|
||||
wickDownColor: '#ef5350',
|
||||
wickUpColor: '#26a69a',
|
||||
})
|
||||
// Check what methods are available on the chart
|
||||
const chartMethods = Object.getOwnPropertyNames(Object.getPrototypeOf(chart))
|
||||
addLog('Chart methods: ' + chartMethods.slice(0, 10).join(', ') + '...')
|
||||
|
||||
// Try to add a candlestick series using the modern API
|
||||
let candlestickSeries;
|
||||
if ('addCandlestickSeries' in chart) {
|
||||
addLog('Using addCandlestickSeries method')
|
||||
candlestickSeries = (chart as any).addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
borderDownColor: '#ef5350',
|
||||
borderUpColor: '#26a69a',
|
||||
wickDownColor: '#ef5350',
|
||||
wickUpColor: '#26a69a',
|
||||
})
|
||||
} else {
|
||||
addLog('Trying alternative API')
|
||||
candlestickSeries = (chart as any).addAreaSeries({
|
||||
lineColor: '#26a69a',
|
||||
topColor: 'rgba(38, 166, 154, 0.4)',
|
||||
bottomColor: 'rgba(38, 166, 154, 0.0)',
|
||||
})
|
||||
}
|
||||
addLog('Candlestick series added')
|
||||
|
||||
// Very simple test data
|
||||
|
||||
@@ -31,8 +31,8 @@ export default function DebugChart() {
|
||||
|
||||
addLog('Available exports: ' + Object.keys(LightweightChartsModule).join(', '))
|
||||
|
||||
const { createChart, ColorType, CrosshairMode } = LightweightChartsModule
|
||||
addLog('Extracted createChart and other components')
|
||||
const { createChart } = LightweightChartsModule
|
||||
addLog('Extracted createChart')
|
||||
|
||||
addLog('Creating chart...')
|
||||
const chart = createChart(chartContainerRef.current!, {
|
||||
@@ -46,7 +46,7 @@ export default function DebugChart() {
|
||||
addLog('Chart created successfully')
|
||||
|
||||
addLog('Adding candlestick series...')
|
||||
const candlestickSeries = chart.addCandlestickSeries({
|
||||
const candlestickSeries = (chart as any).addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DirectChart() {
|
||||
})
|
||||
console.log('Chart created')
|
||||
|
||||
const series = chart.addCandlestickSeries({
|
||||
const series = (chart as any).addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
})
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function MinimalChartTest() {
|
||||
setStatus('Chart created')
|
||||
|
||||
setStatus('Adding series...')
|
||||
const series = chart.addCandlestickSeries({})
|
||||
const series = (chart as any).addCandlestickSeries({})
|
||||
console.log('Series created:', series)
|
||||
setStatus('Series added')
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function SimpleChart() {
|
||||
setStatus('Adding candlestick series...')
|
||||
console.log('Chart created, adding candlestick series...')
|
||||
|
||||
const candlestickSeries = chart.addCandlestickSeries({
|
||||
const candlestickSeries = (chart as any).addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
borderDownColor: '#ef5350',
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function SimpleTest() {
|
||||
setStatus('Chart created')
|
||||
|
||||
// Add series
|
||||
const series = chart.addCandlestickSeries({
|
||||
const series = (chart as any).addCandlestickSeries({
|
||||
upColor: '#00ff00',
|
||||
downColor: '#ff0000',
|
||||
})
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function WorkingChart() {
|
||||
},
|
||||
})
|
||||
|
||||
const candlestickSeries = chart.addCandlestickSeries({
|
||||
const candlestickSeries = (chart as any).addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user