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:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "project-linkedcorp-frontend",
|
||||
"private": true,
|
||||
"version": "3.1.1",
|
||||
"version": "3.1.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -5,6 +5,7 @@ export const messages = {
|
||||
user_modules: 'Módulos',
|
||||
user_modules_hint: 'Marca los módulos que este usuario puede usar. Lo que no esté marcado no aparece en su menú y el sistema le niega el acceso.',
|
||||
user_modules_saved: 'Módulos actualizados. El usuario verá el cambio al recargar.',
|
||||
dashboard_no_projects_module: 'Bienvenido. Usa el menú de la izquierda para ir a los módulos que tienes habilitados.',
|
||||
nav_projects: 'Proyectos',
|
||||
nav_organization: 'Organizacion',
|
||||
nav_config: 'Configuracion',
|
||||
@@ -527,6 +528,7 @@ export const messages = {
|
||||
user_modules: 'Modules',
|
||||
user_modules_hint: 'Check the modules this user can use. Unchecked modules are hidden from their menu and access is denied.',
|
||||
user_modules_saved: 'Modules updated. The user will see the change after reloading.',
|
||||
dashboard_no_projects_module: 'Welcome. Use the menu on the left to open the modules enabled for you.',
|
||||
nav_projects: 'Projects',
|
||||
nav_organization: 'Organization',
|
||||
nav_config: 'Settings',
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user