diff --git a/src/Root.tsx b/src/Root.tsx
index 7bffd1c..a725cdc 100644
--- a/src/Root.tsx
+++ b/src/Root.tsx
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import App from './App.tsx';
import AdminApp from './AdminApp.tsx';
+import { ErrorBoundary } from './components/ErrorBoundary.tsx';
export default function Root() {
const [simulatedDomain] = useState<'student' | 'admin'>(() => {
@@ -33,8 +34,10 @@ export default function Root() {
}, [isAdmin]);
return (
-
+
+
+
);
}
diff --git a/src/components/AdminContentManager.tsx b/src/components/AdminContentManager.tsx
index ef07b79..5642c29 100644
--- a/src/components/AdminContentManager.tsx
+++ b/src/components/AdminContentManager.tsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import {
GraduationCap, Plus, Edit, Trash2, FolderPlus, FilePlus, ChevronRight,
- ArrowLeft, Film, Youtube, RefreshCw, Layers, CheckCircle
+ ArrowLeft, Film, Youtube, RefreshCw, Layers, CheckCircle, CheckCircle2
} from 'lucide-react';
interface Lesson {
@@ -510,9 +510,10 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
@@ -579,8 +580,9 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
/>
-
-
- {editingLesson ? 'Salvar Aula' : 'Criar Aula'}
+
+
+ {editingLesson ? 'Salvar Aula' : 'Criar Aula'}
@@ -922,8 +925,9 @@ export default function AdminContentManager({ token }: AdminContentManagerProps)
setShowActivityModal(false)} className="px-4 py-2 text-sm text-zinc-400 hover:text-white">
Cancelar
-
- Salvar Atividade
+
+
+ Salvar Atividade
diff --git a/src/components/AdminDashboard.tsx b/src/components/AdminDashboard.tsx
index 571cbd8..1bbe0b0 100644
--- a/src/components/AdminDashboard.tsx
+++ b/src/components/AdminDashboard.tsx
@@ -924,7 +924,7 @@ export default function AdminDashboard({ token }: AdminDashboardProps) {
) : (
)}
- {isSavingSettings ? 'Salvando...' : 'Salvar Configurações'}
+ {isSavingSettings ? 'Salvando...' : 'Salvar Configurações'}
diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx
new file mode 100644
index 0000000..e34b874
--- /dev/null
+++ b/src/components/ErrorBoundary.tsx
@@ -0,0 +1,60 @@
+import React, { Component, ErrorInfo, ReactNode } from 'react';
+import { RefreshCw, AlertTriangle } from 'lucide-react';
+
+interface Props {
+ children: ReactNode;
+}
+
+interface State {
+ hasError: boolean;
+ error: Error | null;
+}
+
+export class ErrorBoundary extends Component {
+ public state: State = {
+ hasError: false,
+ error: null
+ };
+
+ public static getDerivedStateFromError(error: Error): State {
+ return { hasError: true, error };
+ }
+
+ public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
+ console.error('Uncaught error caught by ErrorBoundary:', error, errorInfo);
+ }
+
+ private handleReload = () => {
+ this.setState({ hasError: false, error: null });
+ window.location.reload();
+ };
+
+ public render() {
+ if (this.state.hasError) {
+ return (
+
+
+
+
+
Recarregando Interface
+
+ Uma alteração de estrutura foi detectada pelo navegador. Clique no botão abaixo para restaurar a página.
+
+
+
+
+ Restaurar Página
+
+
+
+ );
+ }
+
+ return this.props.children;
+ }
+}