feat: version 4.2.0 -- Informe de estado del proyecto con IA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||
import { ArrowLeft } from 'lucide-react';
|
||||
import { ArrowLeft, FileText } from 'lucide-react';
|
||||
import { ProjectReportDialog } from './ProjectReportDialog.jsx';
|
||||
import { getAiStatus } from '../../services/ai.js';
|
||||
import { useUi } from '../../context/ui-context.jsx';
|
||||
import { useAsync } from '../../hooks/useAsync.js';
|
||||
import { useUserDrafts } from '../../hooks/useDraftForm.js';
|
||||
@@ -44,6 +47,9 @@ export default function ProyectoDetallePage() {
|
||||
const deepLinkActivityTab = searchParams.get('activityTab') || undefined;
|
||||
|
||||
const { data: project, reload } = useAsync(() => getProject(projectId), [projectId]);
|
||||
// Informe con IA: solo si el superadmin configuro la clave (el backend valida lectura del proyecto).
|
||||
const { data: aiStatus } = useAsync(() => getAiStatus().catch(() => ({ enabled: false })), []);
|
||||
const [reportOpen, setReportOpen] = useState(false);
|
||||
|
||||
if (!project) return <div className="text-muted">{t('common_loading')}</div>;
|
||||
|
||||
@@ -55,7 +61,13 @@ export default function ProyectoDetallePage() {
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 }}>
|
||||
<h2 className="page-title mt-0">{project.code} — {project.name}</h2>
|
||||
<StatusBadge name={project.status_name} color={project.status_color} />
|
||||
{aiStatus?.enabled && (
|
||||
<div style={{ marginLeft: 'auto' }}>
|
||||
<Button variant="standard" icon={FileText} onClick={() => setReportOpen(true)}>{t('ai_report_button')}</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<ProjectReportDialog open={reportOpen} projectId={projectId} onClose={() => setReportOpen(false)} />
|
||||
|
||||
<Tabs
|
||||
tabs={[
|
||||
|
||||
Reference in New Issue
Block a user