diff --git a/public/Logo.png b/public/Logo.png
new file mode 100644
index 0000000..95e03f5
Binary files /dev/null and b/public/Logo.png differ
diff --git a/src/App.jsx b/src/App.jsx
index a1d32db..9ca1440 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,4 +1,3 @@
-// App.jsx
import { useState } from 'react';
import { Box, useMediaQuery } from '@mui/material';
import { useTheme } from '@mui/material/styles';
@@ -16,33 +15,39 @@ const DRAWER_EXPANDED = OPEN_WIDTH;
const DRAWER_COLLAPSED = MINI_WIDTH;
const APPBAR_HEIGHT = 64;
-function PrivateRoute({ children }) {
- const { user } = useAuth();
- return user ? children : ;
-}
-
export default function App() {
const theme = useTheme();
const isMobile = useMediaQuery('(max-width:900px)');
- const [zone] = useState('public');
const [drawerExpanded, setDrawerExpanded] = useState(true);
const [currentView, setCurrentView] = useState('Dashboard');
+ const { user, initializing } = useAuth();
const mainLeft = isMobile ? 0 : (drawerExpanded ? DRAWER_EXPANDED : DRAWER_COLLAPSED);
+ // Evita flicker mientras se restaura sesión
+ if (initializing) return null;
+
+ // === RUTAS PÚBLICAS (sin shell) ===
+ if (!user) {
+ return (
+
+ } />
+ } />
+
+ );
+ }
+
+ // === RUTAS PRIVADAS (con shell) ===
return (
<>
{
- // normalize any custom route keys
- setCurrentView(value);
- }}
+ onSelect={(value) => setCurrentView(value)}
onExpandedChange={(expanded) => setDrawerExpanded(expanded)}
/>
@@ -59,23 +64,26 @@ export default function App() {
}}
>
- } />
+ {/* Si ya está autenticado, /login redirige al dashboard */}
+ } />
- {zone === 'public' && currentView === 'Dashboard' && }
- {zone === 'public' && currentView === '/Users/UserManagement' && }
- {zone === 'public' && currentView === '/ProductsManagement/CatalogManagement/ProductCollections' && }
-
+ <>
+ {currentView === 'Dashboard' && }
+ {currentView === '/Users/UserManagement' && }
+ {currentView === '/ProductsManagement/CatalogManagement/ProductCollections' && (
+
+ )}
+ >
}
/>
-
+
>
);
-}
\ No newline at end of file
+}
diff --git a/src/context/AuthContext.jsx b/src/context/AuthContext.jsx
index e5bf5a4..4040490 100644
--- a/src/context/AuthContext.jsx
+++ b/src/context/AuthContext.jsx
@@ -4,10 +4,12 @@ const AuthContext = createContext();
export function AuthProvider({ children }) {
const [user, setUser] = useState(null);
+ const [initializing, setInitializing] = useState(true);
useEffect(() => {
const storedUser = localStorage.getItem('user');
if (storedUser) setUser(JSON.parse(storedUser));
+ setInitializing(false);
}, []);
const login = (userData) => {
@@ -22,7 +24,7 @@ export function AuthProvider({ children }) {
};
return (
-
+
{children}
);
@@ -30,4 +32,4 @@ export function AuthProvider({ children }) {
export function useAuth() {
return useContext(AuthContext);
-}
\ No newline at end of file
+}
diff --git a/src/private/LoginPage.jsx b/src/private/LoginPage.jsx
index 662d76a..7cb33d6 100644
--- a/src/private/LoginPage.jsx
+++ b/src/private/LoginPage.jsx
@@ -15,8 +15,15 @@ export default function LoginPage() {
return (
- Login to Dream Views
+
+ Login
+
+
{
const idToken = cred?.credential;
@@ -42,7 +49,7 @@ export default function LoginPage() {
idToken: googleIdToken,
thalosToken: payload?.token || '',
});
- navigate('/');
+ navigate('/', { replace: true });
}}
onError={(err) => {
console.error('Thalos exchange failed:', err);
@@ -50,7 +57,16 @@ export default function LoginPage() {
}}
/>
)}
+
+
+ By
+
+
);
-}
\ No newline at end of file
+}