mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-16 21:37:51 +00:00
fix: corrige erros de tipagem no ExercisePage
Some checks failed
Docker Build and Push / build (push) Has been cancelled
Some checks failed
Docker Build and Push / build (push) Has been cancelled
- Adiciona interfaces para Story e StoryRecording - Corrige tipagem no sort de recordings - Melhora type safety no acesso aos dados type: fix scope: typescript breaking: false
This commit is contained in:
parent
9840fe76b0
commit
634fa6fb48
@ -80,3 +80,6 @@
|
||||
- Adicionada validação para palavras repetidas
|
||||
- Implementado sistema de feedback temporário
|
||||
- Otimizadas transições e animações
|
||||
- Corrigidos erros de tipagem no ExercisePage
|
||||
- Adicionadas interfaces para Story e StoryRecording
|
||||
- Melhorada type safety no acesso aos dados
|
||||
|
||||
@ -13,6 +13,18 @@ interface ExerciseWord {
|
||||
syllable_pattern: string | null;
|
||||
}
|
||||
|
||||
interface StoryRecording {
|
||||
id: string;
|
||||
created_at: string;
|
||||
improvements: string[];
|
||||
}
|
||||
|
||||
interface Story {
|
||||
id: string;
|
||||
story_recordings: StoryRecording[];
|
||||
// ... outros campos necessários
|
||||
}
|
||||
|
||||
export function ExercisePage() {
|
||||
const { id: storyId, type } = useParams();
|
||||
const navigate = useNavigate();
|
||||
@ -67,8 +79,10 @@ export function ExercisePage() {
|
||||
}
|
||||
|
||||
// Ordenar gravações por data e pegar a mais recente
|
||||
const latestRecording = story.story_recordings
|
||||
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0];
|
||||
const latestRecording = (story as Story).story_recordings
|
||||
.sort((a: StoryRecording, b: StoryRecording) =>
|
||||
new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
||||
)[0];
|
||||
|
||||
setExerciseData({
|
||||
story,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user