diff --git a/src/components/ui/progress.tsx b/src/components/ui/progress.tsx
index 7f96e7b..a726e91 100644
--- a/src/components/ui/progress.tsx
+++ b/src/components/ui/progress.tsx
@@ -12,13 +12,13 @@ const Progress = React.forwardRef<
diff --git a/src/pages/student-dashboard/essays/EssayAnalysis.tsx b/src/pages/student-dashboard/essays/EssayAnalysis.tsx
index 67cd5bc..1a1a44c 100644
--- a/src/pages/student-dashboard/essays/EssayAnalysis.tsx
+++ b/src/pages/student-dashboard/essays/EssayAnalysis.tsx
@@ -40,6 +40,32 @@ interface Essay {
};
}
+interface EssayAnalysisData {
+ id: string;
+ essay_id: string;
+ overall_score: number;
+ suggestions: string;
+ created_at: string;
+ feedback: Array<{
+ structure_feedback: string;
+ content_feedback: string;
+ language_feedback: string;
+ }>;
+ strengths: Array<{
+ strength: string;
+ }>;
+ improvements: Array<{
+ improvement: string;
+ }>;
+ scores: Array<{
+ adequacy: number;
+ coherence: number;
+ cohesion: number;
+ vocabulary: number;
+ grammar: number;
+ }>;
+}
+
export function EssayAnalysis() {
const navigate = useNavigate();
const { id } = useParams();
@@ -70,16 +96,57 @@ export function EssayAnalysis() {
setEssay(essayData);
// Carregar análise
- const { data: analysisData, error: analysisError } = await supabase
+ const { data, error: analysisError } = await supabase
.from('essay_analyses')
- .select('*')
+ .select(`
+ *,
+ feedback:essay_analysis_feedback(
+ structure_feedback,
+ content_feedback,
+ language_feedback
+ ),
+ strengths:essay_analysis_strengths(
+ strength
+ ),
+ improvements:essay_analysis_improvements(
+ improvement
+ ),
+ scores:essay_analysis_scores(
+ adequacy,
+ coherence,
+ cohesion,
+ vocabulary,
+ grammar
+ )
+ `)
.eq('essay_id', id)
.order('created_at', { ascending: false })
.limit(1)
.single();
if (analysisError) throw analysisError;
- setAnalysis(analysisData);
+
+ // Transformar os dados para o formato esperado
+ const analysisData = data as EssayAnalysisData;
+ const analysis: EssayAnalysis = {
+ ...analysisData,
+ feedback: {
+ structure: analysisData.feedback[0]?.structure_feedback || '',
+ content: analysisData.feedback[0]?.content_feedback || '',
+ language: analysisData.feedback[0]?.language_feedback || ''
+ },
+ strengths: analysisData.strengths?.map((s: { strength: string }) => s.strength) || [],
+ improvements: analysisData.improvements?.map((i: { improvement: string }) => i.improvement) || [],
+ criteria_scores: {
+ adequacy: analysisData.scores[0]?.adequacy || 0,
+ coherence: analysisData.scores[0]?.coherence || 0,
+ cohesion: analysisData.scores[0]?.cohesion || 0,
+ vocabulary: analysisData.scores[0]?.vocabulary || 0,
+ grammar: analysisData.scores[0]?.grammar || 0
+ }
+ };
+
+ setAnalysis(analysis);
} catch (error) {
console.error('Erro ao carregar dados:', error);
} finally {
@@ -93,158 +160,150 @@ export function EssayAnalysis() {
return (
-
-
-
+
+
+ {/* Título e Tipo */}
+
+
{essay.title}
+
{essay.essay_type.title} • {essay.essay_genre.title}
-
-
- {/* Pontuação Geral */}
-
-
- Pontuação Geral
-
-
-
-
- {analysis.overall_score}
+ {/* Grid de Cards */}
+
+ {/* Pontuação Geral */}
+
+
+
+
{analysis.overall_score}
+
/100
- /100
-
-
-
+
Pontuação Geral
+
+
- {/* Pontos Fortes */}
-
-
-
-
- Pontos Fortes
-
-
-
-
- {analysis.strengths.map((strength, index) => (
- - {strength}
- ))}
-
-
-
+ {/* Pontos Fortes */}
+
+
+
+
+ Pontos Fortes
+
+
+
+
+ {analysis.strengths.map((strength, index) => (
+ - {strength}
+ ))}
+
+
+
- {/* Pontos a Melhorar */}
-
-
-
-
- Pontos a Melhorar
-
-
-
-
- {analysis.improvements.map((improvement, index) => (
- - {improvement}
- ))}
-
-
-
+ {/* Pontos a Melhorar */}
+
+
+
+
+ Pontos a Melhorar
+
+
+
+
+ {analysis.improvements.map((improvement, index) => (
+ - {improvement}
+ ))}
+
+
+
- {/* Feedback Detalhado */}
-
-
- Feedback Detalhado
-
-
-
-
Estrutura
-
{analysis.feedback.structure}
-
-
-
Conteúdo
-
{analysis.feedback.content}
-
-
-
Linguagem
-
{analysis.feedback.language}
-
-
-
+ {/* Feedback Detalhado */}
+
+
+ Feedback Detalhado
+
+
+
+
Estrutura
+
{analysis.feedback.structure}
+
+
+
Conteúdo
+
{analysis.feedback.content}
+
+
+
Linguagem
+
{analysis.feedback.language}
+
+
+
- {/* Critérios de Avaliação */}
-
-
- Critérios de Avaliação
-
-
-
-
-
Adequação ao Gênero
-
{analysis.criteria_scores.adequacy}%
+ {/* Critérios de Avaliação */}
+
+
+ Critérios de Avaliação
+
+
+
+
+ Adequação ao Gênero
+ {analysis.criteria_scores.adequacy}%
+
+
-
-
-
-
-
Coerência
-
{analysis.criteria_scores.coherence}%
+
+
+ Coerência
+ {analysis.criteria_scores.coherence}%
+
+
-
-
-
-
-
Coesão
-
{analysis.criteria_scores.cohesion}%
+
+
+ Coesão
+ {analysis.criteria_scores.cohesion}%
+
+
-
-
-
-
-
Vocabulário
-
{analysis.criteria_scores.vocabulary}%
+
+
+ Vocabulário
+ {analysis.criteria_scores.vocabulary}%
+
+
-
-
-
-
-
Gramática
-
{analysis.criteria_scores.grammar}%
+
+
+ Gramática
+ {analysis.criteria_scores.grammar}%
+
+
-
-
-
-
+
+
- {/* Sugestões */}
-
-
- Sugestões para Melhoria
-
-
-
- {analysis.suggestions}
-
-
-
+ {/* Sugestões */}
+
+
+ Sugestões para Melhoria
+
+
+
+ {analysis.suggestions}
+
+
+
+
);