fix: version 3.1.2 -- Panel sin datos de proyectos para usuarios sin ese modulo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Milton Gonzalez
2026-10-23 14:33:41 -05:00
parent 72890e37d9
commit c64a16064f
8 changed files with 29 additions and 5 deletions
@@ -2,6 +2,7 @@ import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useUi } from '../../context/ui-context.jsx';
import { useAuth } from '../../context/auth-context.jsx';
import { hasModule } from '../../utils/modules.js';
import { useAsync } from '../../hooks/useAsync.js';
import { getSummary } from '../../services/dashboard.js';
import { KpiCard } from '../../components/KpiCard.jsx';
@@ -78,7 +79,23 @@ function ActivityRows({ activities, onOpen }) {
));
}
// Todo el Panel son datos de proyectos: sin ese modulo se muestra solo la bienvenida, sin llamar
// a /dashboard (que el backend tambien bloquea con 403).
export default function DashboardPage() {
const { t } = useUi();
const { user } = useAuth();
if (!hasModule(user, 'projects')) {
return (
<div>
<h2 className="page-title mt-0">{t('dashboard_title')}</h2>
<p className="text-muted">{t('dashboard_no_projects_module')}</p>
</div>
);
}
return <ProjectsDashboard />;
}
function ProjectsDashboard() {
const { t } = useUi();
const navigate = useNavigate();
const { user } = useAuth();