Minimax correcao

This commit is contained in:
2026-04-02 11:45:46 +00:00
parent ca2bdc19ab
commit 3132bb73a2
30 changed files with 118 additions and 1337 deletions
+2 -31
View File
@@ -2,9 +2,8 @@ import React, { useState } from 'react';
import NotificationBell from './NotificationBell';
import { TeamPresence } from './TeamPresence';
import { Link, useLocation, useNavigate } from 'react-router-dom';
import { Menu, X, FolderOpen, Layers, ClipboardCheck, LogOut, TrendingUp, Sun, Moon, HelpCircle, Shield, Wrench, Terminal, LayoutDashboard, Package, Thermometer, User } from 'lucide-react';
import { Menu, X, FolderOpen, Layers, ClipboardCheck, TrendingUp, Sun, Moon, HelpCircle, Shield, Wrench, Terminal, LayoutDashboard, Package, Thermometer, User } from 'lucide-react';
import { clsx } from 'clsx';
import { useLogto } from '@logto/react';
import { TechnicalManual } from './TechnicalManual';
import { useAuth } from '../context/useAuth';
@@ -20,8 +19,7 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
return saved === 'dark' || (!saved && window.matchMedia('(prefers-color-scheme: dark)').matches);
});
const location = useLocation();
const { signOut } = useLogto();
const { isAdmin, isUser, isDeveloper, appUser, isSignedIn } = useAuth();
const { isAdmin, isUser, isDeveloper, appUser } = useAuth();
// Helper to get role display name
const getRoleDisplay = () => {
@@ -54,14 +52,6 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
}
}, [appUser, location.pathname, navigate]);
// Redirect to login if not signed in (except for login and callback pages)
React.useEffect(() => {
const publicPaths = ['/login', '/callback'];
if (!isSignedIn && !publicPaths.includes(location.pathname)) {
navigate('/login');
}
}, [isSignedIn, location.pathname, navigate]);
interface NavItem {
icon: React.ElementType;
label: string;
@@ -87,10 +77,6 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
return false;
};
const handleLogout = () => {
signOut(window.location.origin);
};
if (location.pathname === '/login' || location.pathname === '/callback') {
return <>{children}</>;
}
@@ -216,14 +202,6 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
)}
</button>
<button
onClick={handleLogout}
className="flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold text-text-secondary hover:text-error hover:bg-error/5 transition-all w-full"
>
<LogOut size={18} />
Sair
</button>
<div className="pt-2 flex items-center justify-between px-2">
<div className="flex items-center gap-2">
<NotificationBell />
@@ -348,13 +326,6 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
{isDarkMode ? <Sun size={20} className="text-yellow-500" /> : <Moon size={20} className="text-primary" />}
{isDarkMode ? 'Modo Claro' : 'Modo Escuro'}
</button>
<button
onClick={handleLogout}
className="flex items-center gap-4 w-full text-text-main font-bold"
>
<LogOut size={20} />
Sair
</button>
</div>
</div>