From 04b154ba2475d704343f3c86fdaef58d0e1cad8a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Jan 2026 22:53:33 +0000 Subject: [PATCH] debug: Enhanced diagnostic page with import testing --- src/App.test.tsx | 148 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 135 insertions(+), 13 deletions(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index ac68e03d..e4e900c0 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,31 +1,153 @@ +import { useState, useEffect } from 'react'; + function AppTest() { + const [logs, setLogs] = useState(['🎹 Piano Tutor - Diagnóstico']); + const [error, setError] = useState(null); + + useEffect(() => { + const addLog = (msg: string) => setLogs(prev => [...prev, msg]); + + try { + addLog('✅ React renderizado'); + addLog('✅ useEffect executado'); + + // Test localStorage + try { + localStorage.setItem('test', 'ok'); + localStorage.removeItem('test'); + addLog('✅ localStorage funciona'); + } catch (e) { + addLog('❌ localStorage com problema: ' + e); + } + + // Test imports + addLog('🔍 Testando imports...'); + + import('./hooks/useGamification') + .then(() => { + addLog('✅ useGamification importado'); + }) + .catch(e => { + addLog('❌ Erro no useGamification: ' + e.message); + setError(e.toString()); + }); + + import('./pages/StudentDashboard') + .then(() => { + addLog('✅ StudentDashboard importado'); + }) + .catch(e => { + addLog('❌ Erro no StudentDashboard: ' + e.message); + setError(e.toString()); + }); + + import('./services/handPostureDetection.v2') + .then(() => { + addLog('✅ handPostureDetection.v2 importado'); + }) + .catch(e => { + addLog('❌ Erro no handPostureDetection.v2: ' + e.message); + setError(e.toString()); + }); + + import('./services/temporalSync') + .then(() => { + addLog('✅ temporalSync importado'); + }) + .catch(e => { + addLog('❌ Erro no temporalSync: ' + e.message); + setError(e.toString()); + }); + + import('./hooks/usePremiumPosture') + .then(() => { + addLog('✅ usePremiumPosture importado'); + }) + .catch(e => { + addLog('❌ Erro no usePremiumPosture: ' + e.message); + setError(e.toString()); + }); + } catch (e: any) { + addLog('❌ ERRO CRÍTICO: ' + e.message); + setError(e.toString()); + } + }, []); + return (
-
-

🎹

-

Piano Tutor

-

Carregando...

+
+

🔍 Piano Tutor - Diagnóstico

+ +
+ {logs.map((log, i) => ( +
+ {log} +
+ ))} +
+ + {error && ( +
+

⚠️ Erro Detectado:

+
+              {error}
+            
+
+ )} +
-

✅ React carregado

-

✅ Vite funcionando

-

⚙️ Testando componentes...

+

📍 URL: {window.location.href}

+

+ 🌐 User Agent: {navigator.userAgent.substring(0, 80)}... +

+

⏰ Timestamp: {new Date().toLocaleString()}