diff --git a/app/api/image/route.ts b/app/api/image/route.ts
new file mode 100644
index 0000000..3c9c79b
--- /dev/null
+++ b/app/api/image/route.ts
@@ -0,0 +1,27 @@
+import { NextRequest, NextResponse } from 'next/server'
+import fs from 'fs/promises'
+import path from 'path'
+
+export async function GET(req: NextRequest) {
+ try {
+ const { searchParams } = new URL(req.url)
+ const filename = searchParams.get('file')
+
+ if (!filename) {
+ return NextResponse.json({ error: 'Filename required' }, { status: 400 })
+ }
+
+ const screenshotsDir = path.join(process.cwd(), 'screenshots')
+ const filePath = path.join(screenshotsDir, filename)
+ const file = await fs.readFile(filePath)
+
+ return new NextResponse(file, {
+ headers: {
+ 'Content-Type': 'image/png',
+ 'Content-Disposition': `inline; filename="${filename}"`
+ }
+ })
+ } catch (e: any) {
+ return NextResponse.json({ error: e.message }, { status: 404 })
+ }
+}
diff --git a/app/api/test-gallery/route.ts b/app/api/test-gallery/route.ts
new file mode 100644
index 0000000..6bcc533
--- /dev/null
+++ b/app/api/test-gallery/route.ts
@@ -0,0 +1,12 @@
+import { NextRequest, NextResponse } from 'next/server'
+
+export async function GET(req: NextRequest) {
+ return NextResponse.json({
+ message: 'Test endpoint working',
+ timestamp: new Date().toISOString(),
+ screenshots: [
+ '/app/screenshots/SOLUSD_240_ai_1752448407811.png',
+ '/app/screenshots/SOLUSD_15_ai_1752441315672.png'
+ ]
+ })
+}
diff --git a/components/AIAnalysisPanel.tsx b/components/AIAnalysisPanel.tsx
index de2d6b3..39539c8 100644
--- a/components/AIAnalysisPanel.tsx
+++ b/components/AIAnalysisPanel.tsx
@@ -475,7 +475,6 @@ export default function AIAnalysisPanel() {
return (
- {console.log('AIAnalysisPanel render - result:', result)}
@@ -1371,23 +1370,14 @@ export default function AIAnalysisPanel() {
{/* Screenshot Gallery */}
{result && result.screenshots && (
- <>
- {console.log('Rendering ScreenshotGallery with:', {
- screenshots: result.screenshots,
- screenshotsLength: result.screenshots.length,
- symbol,
- selectedTimeframes,
- enlargedScreenshot
- })}
- timeframes.find(t => t.value === tf)?.label || tf)}
- enlargedImage={enlargedScreenshot}
- onImageClick={handleScreenshotClick}
- onClose={() => setEnlargedScreenshot(null)}
- />
- >
+ timeframes.find(t => t.value === tf)?.label || tf)}
+ enlargedImage={enlargedScreenshot}
+ onImageClick={handleScreenshotClick}
+ onClose={() => setEnlargedScreenshot(null)}
+ />
)}
{/* Multi-timeframe Screenshot Gallery */}
diff --git a/components/ScreenshotGallery.tsx b/components/ScreenshotGallery.tsx
index aab88e7..391f284 100644
--- a/components/ScreenshotGallery.tsx
+++ b/components/ScreenshotGallery.tsx
@@ -18,15 +18,6 @@ export default function ScreenshotGallery({
onImageClick,
onClose
}: ScreenshotGalleryProps) {
- // Debug logging
- console.log('ScreenshotGallery props:', {
- screenshots,
- symbol,
- timeframes,
- enlargedImage,
- screenshotsLength: screenshots?.length
- })
-
// Handle ESC key to close enlarged image
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
@@ -41,124 +32,14 @@ export default function ScreenshotGallery({
}
}, [enlargedImage, onClose])
- if (screenshots.length === 0) {
- console.log('ScreenshotGallery: No screenshots to display')
-
- // TEMPORARY: Show a test gallery with known screenshots for debugging
- const testScreenshots = [
- '/screenshots/SOLUSD_240_ai_1752447978639.png',
- '/screenshots/SOLUSD_15_ai_1752441315672.png'
- ]
-
- console.log('ScreenshotGallery: Using test screenshots for debugging:', testScreenshots)
-
- return (
- <>
- {/* Test Gallery Grid */}
-
-
-
-
- 🧪
-
- Test Screenshots (Debug Mode)
-
-
- {testScreenshots.length} test images • Click to enlarge
-
-
-
-
- {testScreenshots.map((screenshot, index) => {
- const filename = screenshot.split('/').pop() || ''
- const timeframe = index === 0 ? '4h' : '15m'
-
- return (
-
{
- console.log('Test image clicked:', screenshot)
- onImageClick(screenshot)
- }}
- >
-
-

console.log(`Test image loaded successfully: ${screenshot}`)}
- onError={(e: any) => {
- console.error(`Test image failed to load: ${screenshot}`, e)
- const target = e.target as HTMLImageElement
- target.style.display = 'none'
- }}
- />
-
-
-
-
-
{symbol}
-
{timeframe} Timeframe (Test)
-
-
- Click to view
-
-
-
-
- )
- })}
-
-
-
- {/* Test Enlarged Image Modal */}
- {enlargedImage && (
-
-
e.stopPropagation()}>
-
-

{
- console.error('Failed to load enlarged image:', enlargedImage)
- const target = e.target as HTMLImageElement
- target.alt = 'Failed to load image'
- }}
- />
-
-
-
-
{symbol} Chart Analysis (Test Mode)
-
Debug screenshot • High resolution view
-
-
- ESC to close • Click outside to close
-
-
-
-
-
- )}
- >
- )
- }
+ if (screenshots.length === 0) return null
// Helper function to format screenshot URL
const formatScreenshotUrl = (screenshot: string) => {
// Extract just the filename from the full path
const filename = screenshot.split('/').pop() || screenshot
- // Return the Next.js API route format
- return `/screenshots/${filename}`
+ // Use the new API route with query parameter
+ return `/api/image?file=${filename}`
}
return (
@@ -196,8 +77,6 @@ export default function ScreenshotGallery({
const timeframe = timeframes[index] || extractTimeframeFromFilename(filename)
const imageUrl = formatScreenshotUrl(screenshot)
- console.log(`Screenshot ${index}:`, { screenshot, filename, timeframe, imageUrl })
-
return (
console.log(`Image loaded successfully: ${imageUrl}`)}
onError={(e: any) => {
- console.error(`Failed to load image: ${imageUrl}`, e)
const target = e.target as HTMLImageElement
target.style.display = 'none'
const fallback = target.nextElementSibling as HTMLElement