From 28fa4d70e6e939106e69379c24411ef92fcd1200 Mon Sep 17 00:00:00 2001 From: Lucas Santana Date: Tue, 24 Dec 2024 15:46:22 -0300 Subject: [PATCH] refactor: remove pasta /pages/story MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove pasta /pages/story obsoleta - Consolida componentes de história em /pages/student-dashboard - Mantém consistência na organização de arquivos - Simplifica estrutura de diretórios --- .cursorrules | 42 +++++ CHANGELOG.md | 7 +- src/pages/story/StoryPageDemo.tsx | 260 ------------------------------ src/routes.tsx | 3 +- 4 files changed, 50 insertions(+), 262 deletions(-) delete mode 100644 src/pages/story/StoryPageDemo.tsx diff --git a/.cursorrules b/.cursorrules index 19db8fe..870b509 100644 --- a/.cursorrules +++ b/.cursorrules @@ -124,6 +124,48 @@ "commit_rules": { "pattern": "^(fix|feat|perf|docs|style|refactor|test|chore): [a-z].*$", "message": "Use proper commit message format with prefix" + }, + "changelog_rules": { + "required": true, + "message": "Atualize o CHANGELOG.md antes de fazer commit", + "format": { + "header": [ + "# Changelog", + "", + "Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.", + "", + "O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),", + "e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).", + "" + ], + "version_pattern": "^## \\[(\\d+\\.\\d+\\.\\d+)\\] - \\d{4}-\\d{2}-\\d{2}$", + "version_message": "Use o formato '## [X.Y.Z] - YYYY-MM-DD' para versões" + }, + "patterns": [ + { + "id": "added", + "pattern": "### Adicionado", + "message": "Use '### Adicionado' para novos recursos" + }, + { + "id": "modified", + "pattern": "### Modificado", + "message": "Use '### Modificado' para mudanças em funcionalidades existentes" + }, + { + "id": "technical", + "pattern": "### Técnico", + "message": "Use '### Técnico' para mudanças técnicas/internas" + }, + { + "id": "semantic_version", + "pattern": "^(major|minor|patch):", + "message": "Indique o tipo de mudança: major (quebra compatibilidade), minor (novo recurso) ou patch (correção)" + } + ], + "verify_files": [ + "CHANGELOG.md" + ] } } }, diff --git a/CHANGELOG.md b/CHANGELOG.md index e4cd703..707a85e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,11 @@ e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/). - Melhor performance em navegação ### Modificado +- Reorganização da estrutura de arquivos + - Remoção da pasta /pages/story + - Consolidação dos componentes de história em /pages/student-dashboard + - Melhor organização hierárquica das rotas + - Otimização global de imagens - Conversão automática para WebP - Redimensionamento otimizado por contexto @@ -78,7 +83,7 @@ e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/). - Melhor tratamento de estados de loading e erro - Implementação de componente ImageWithLoading - Sistema de cache de imagens -- Otimizaç��o de URLs de imagem +- Otimização de URLs de imagem - Refatoração de componentes para melhor reuso - Separação de lógica de carregamento de imagens diff --git a/src/pages/story/StoryPageDemo.tsx b/src/pages/story/StoryPageDemo.tsx deleted file mode 100644 index b296dc2..0000000 --- a/src/pages/story/StoryPageDemo.tsx +++ /dev/null @@ -1,260 +0,0 @@ -import React from 'react'; -import { ArrowLeft, ArrowRight, Mic, Volume2, Share2 } from 'lucide-react'; -import { AudioRecorder } from '../../components/story/AudioRecorder'; -import { StoryMetrics } from '../../components/story/StoryMetrics'; -import type { StoryRecording } from '../../types/database'; - -const demoRecording: StoryRecording = { - id: 'demo-recording', - fluency_score: 85, - pronunciation_score: 90, - accuracy_score: 88, - comprehension_score: 92, - words_per_minute: 120, - pause_count: 3, - error_count: 2, - self_corrections: 1, - strengths: [ - 'Ótima pronúncia das palavras', - 'Boa velocidade de leitura', - 'Excelente compreensão do texto' - ], - improvements: [ - 'Reduzir pequenas pausas entre frases', - 'Praticar palavras mais complexas' - ], - suggestions: 'Continue praticando a leitura em voz alta regularmente', - created_at: new Date().toISOString(), - processed_at: new Date().toISOString() -}; - -const demoStory = { - id: 'demo', - student_id: 'demo', - title: 'Uma Aventura Educacional', - content: { - pages: [ - { - text: 'Bem-vindo à demonstração do Histórias Mágicas! Aqui você pode ver como funciona nossa plataforma de leitura interativa...', - image: 'https://images.unsplash.com/photo-1472162072942-cd5147eb3902?auto=format&fit=crop&q=80&w=800&h=600', - }, - { - text: 'Com histórias interativas e educativas, seus alunos aprenderão de forma divertida e envolvente. Cada história é uma nova aventura!', - image: 'https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&q=80&w=800&h=600', - } - ] - }, - status: 'published', - created_at: new Date().toISOString(), - updated_at: new Date().toISOString() -}; - -function RecordingHistoryCard({ recording }: { recording: StoryRecording }) { - const [isExpanded, setIsExpanded] = React.useState(false); - - return ( -
-
-
- - {new Date(recording.created_at).toLocaleDateString()} - -
- -
- - {isExpanded && ( -
-
-
- Palavras por minuto: - {recording.words_per_minute} -
-
- Pausas: - {recording.pause_count} -
-
- Erros: - {recording.error_count} -
-
- Autocorreções: - {recording.self_corrections} -
-
- -
-
-
Pontos Fortes
-
    - {recording.strengths.map((strength, i) => ( -
  • {strength}
  • - ))} -
-
- -
-
Pontos para Melhorar
-
    - {recording.improvements.map((improvement, i) => ( -
  • {improvement}
  • - ))} -
-
- -
-
Sugestões
-

{recording.suggestions}

-
-
-
- )} -
- ); -} - -export function StoryPageDemo(): JSX.Element { - const [currentPage, setCurrentPage] = React.useState(0); - const [isPlaying, setIsPlaying] = React.useState(false); - const [recordings] = React.useState([demoRecording]); - - const metricsData = { - metrics: { - fluency: demoRecording.fluency_score, - pronunciation: demoRecording.pronunciation_score, - accuracy: demoRecording.accuracy_score, - comprehension: demoRecording.comprehension_score - }, - feedback: { - strengths: demoRecording.strengths, - improvements: demoRecording.improvements, - suggestions: demoRecording.suggestions - }, - details: { - wordsPerMinute: demoRecording.words_per_minute, - pauseCount: demoRecording.pause_count, - errorCount: demoRecording.error_count, - selfCorrections: demoRecording.self_corrections - } - }; - - const handleShare = () => { - alert('Funcionalidade de compartilhamento disponível apenas na versão completa!'); - }; - - return ( -
-
-
- - -
- - -
-
- - {/* Dashboard de métricas */} - {recordings.length > 0 && ( - - )} - - {/* Histórico de gravações */} - {recordings.length > 0 && ( -
-

Histórico de Gravações

-
- {recordings.map((recording) => ( - - ))} -
-
- )} - -
- {/* Imagem da página atual */} -
- {`Página -
- -
-

{demoStory.title}

- - {/* Texto da página atual */} -

- {demoStory.content.pages[currentPage].text} -

- - {/* Gravador de áudio */} - { - alert('Gravação disponível apenas na versão completa!'); - }} - /> - - {/* Navegação entre páginas */} -
- - - - Página {currentPage + 1} de {demoStory.content.pages.length} - - - -
-
-
-
-
- ); -} \ No newline at end of file diff --git a/src/routes.tsx b/src/routes.tsx index 6ce7a66..72065fd 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -19,12 +19,13 @@ import { StudentDashboardLayout } from './pages/student-dashboard/StudentDashboa import { StudentStoriesPage } from './pages/student-dashboard/StudentStoriesPage'; import { StudentSettingsPage } from './pages/student-dashboard/StudentSettingsPage'; import { CreateStoryPage } from './pages/student-dashboard/CreateStoryPage'; -import { StoryPageDemo } from './pages/story/StoryPageDemo'; +import { StoryPageDemo } from './pages/demo/StoryPageDemo'; import { StoryPage } from './pages/student-dashboard/StoryPage'; import { ProtectedRoute } from './components/auth/ProtectedRoute'; import { UserManagementPage } from './pages/admin/UserManagementPage'; import { AchievementsPage } from './pages/student-dashboard/AchievementsPage'; import { StudentClassPage } from './pages/student-dashboard/StudentClassPage'; +import { DemoPage } from './pages/demo/DemoPage'; export const router = createBrowserRouter([ {