mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-17 05:47:52 +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
|
- Adicionada validação para palavras repetidas
|
||||||
- Implementado sistema de feedback temporário
|
- Implementado sistema de feedback temporário
|
||||||
- Otimizadas transições e animações
|
- 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;
|
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() {
|
export function ExercisePage() {
|
||||||
const { id: storyId, type } = useParams();
|
const { id: storyId, type } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -67,8 +79,10 @@ export function ExercisePage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ordenar gravações por data e pegar a mais recente
|
// Ordenar gravações por data e pegar a mais recente
|
||||||
const latestRecording = story.story_recordings
|
const latestRecording = (story as Story).story_recordings
|
||||||
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0];
|
.sort((a: StoryRecording, b: StoryRecording) =>
|
||||||
|
new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
||||||
|
)[0];
|
||||||
|
|
||||||
setExerciseData({
|
setExerciseData({
|
||||||
story,
|
story,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user