[Dashboard] Backend/Frontend actualizados — Endpoint Ámbitos con Planes
BACKEND (ambitos.js):
- Nuevo endpoint GET /api/ambitos/:codigo/proyecto
- Devuelve estructura compatible con frontend existente
- Planes con hitos, métricas y nodos (igual que proyectos)
FRONTEND (ProyectoDashboard.tsx):
- Cambiado default de 'P2601' a 'A04'
- Fetch desde /ambitos/${codigo}/proyecto en lugar de /proyectos
- Mantiene compatibilidad con interfaz existente
DATOS ACTUALIZADOS:
- 29 hitos totales
- 21 completados ✅
- 8 pendientes/legacy ⏳🛑
- 6 planes: A04.P001 a A04.P006
- 60 horas totales (14.5h presencial + 45.5h remoto)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cafa07303b
commit
5b384a1b37
@@ -131,7 +131,7 @@ function DonutChart({ segments, size = 140, strokeWidth = 18, centerLabel, cente
|
||||
|
||||
|
||||
/* ═══════════ MAIN COMPONENT ═══════════ */
|
||||
export default function ProyectoDashboard({ codigo = 'P2601' }: { codigo?: string }) {
|
||||
export default function ProyectoDashboard({ codigo = 'A04' }: { codigo?: string }) {
|
||||
const [proyecto, setProyecto] = useState<Proyecto | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
@@ -144,8 +144,9 @@ export default function ProyectoDashboard({ codigo = 'P2601' }: { codigo?: strin
|
||||
const fetchProyecto = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/proyectos/${codigo}`);
|
||||
if (!res.ok) throw new Error('Proyecto no encontrado');
|
||||
// Usar endpoint de ambitos en lugar de proyectos
|
||||
const res = await fetch(`${API_URL}/ambitos/${codigo}/proyecto`);
|
||||
if (!res.ok) throw new Error('Ámbito no encontrado');
|
||||
const data = await res.json();
|
||||
setProyecto(data);
|
||||
setExpandedFases(new Set(data.fases.map((f: Fase) => f.id)));
|
||||
|
||||
Reference in New Issue
Block a user