From 56faae7eab90915a49c0e7fbd39935f4b6974bbd Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Sat, 1 Aug 2026 10:09:30 +0000 Subject: [PATCH] feat(cc-051): Privacy Center overview page --- src/app/dashboard/privacy/page.tsx | 145 +++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 src/app/dashboard/privacy/page.tsx diff --git a/src/app/dashboard/privacy/page.tsx b/src/app/dashboard/privacy/page.tsx new file mode 100644 index 0000000..afce293 --- /dev/null +++ b/src/app/dashboard/privacy/page.tsx @@ -0,0 +1,145 @@ +'use client'; + +import Link from 'next/link'; +import { useQuery } from '@tanstack/react-query'; +import { apiFetch } from '../../../lib/api'; +import type { AuditLogEntry, AiRequest, Member } from '../../../lib/api'; +import { useSession } from '../../../components/session-provider'; + +const B = '/dashboard'; + +interface PrivacyModule { + label: string; + href: string; + status: 'live' | 'planned' | 'a3'; + desc: string; +} + +const PRIVACY_MODULES: PrivacyModule[] = [ + { label: 'Audit Log', href: `${B}/privacy/audit`, status: 'live', desc: 'Toate acțiunile înregistrate cu actor, timestamp și resursă.' }, + { label: 'Activitate AI', href: `${B}/privacy/ai-activity`, status: 'live', desc: 'Context manifest hash per cerere AI — ce date au fost permise.' }, + { label: 'Roluri & Permisiuni', href: `${B}/privacy/roles`, status: 'live', desc: 'RBAC owner/admin/member — cine are acces la ce.' }, + { label: 'Consimțăminte', href: `${B}/privacy/consents`, status: 'planned', desc: 'Tabel consent_records existent, UI în construcție.' }, + { label: 'Clasificare Date', href: `${B}/privacy/classification`, status: 'planned', desc: 'Clase C0–C4 definite în schema; aplicare sistematică în lucru.' }, + { label: 'Export & Ștergere', href: `${B}/privacy/export`, status: 'planned', desc: 'Portabilitate GDPR + cerere de ștergere cu excepții juridice.' }, + { label: 'Politici Retenție', href: `${B}/privacy/retention`, status: 'a3', desc: 'Politici per categorie de date, faza A3.' }, + { label: 'Evenimente Securitate', href: `${B}/privacy/security`, status: 'a3', desc: 'Acces break-glass, incidente, alertă în timp real.' }, +]; + +const STATUS_LABEL: Record = { live: '● live', planned: 'în lucru', a3: 'a3' }; +const STATUS_CLASS: Record = { + live: 'text-signal-ok', + planned: 'text-signal-warn', + a3: 'text-ink-line', +}; + +export default function PrivacyCenterPage() { + const { activeTenant } = useSession(); + const tenantId = activeTenant?.tenantId ?? ''; + const opts = { enabled: Boolean(tenantId), staleTime: 60_000 }; + + const { data: auditEntries = [] } = useQuery({ + queryKey: ['privacy-audit', tenantId], + queryFn: () => apiFetch('/v1/audit-log?limit=200', { tenantId }), + ...opts, + }); + const { data: aiRequests = [] } = useQuery({ + queryKey: ['privacy-ai', tenantId], + queryFn: () => apiFetch('/v1/ai-requests?limit=200', { tenantId }), + ...opts, + }); + const { data: members = [] } = useQuery({ + queryKey: ['privacy-members', tenantId], + queryFn: () => apiFetch('/v1/tenants/current/members', { tenantId }), + ...opts, + }); + + const liveModules = PRIVACY_MODULES.filter((m) => m.status === 'live').length; + + return ( +
+
+

Privacy Center

+

+ Punct central pentru confidențialitate, transparență și control date. + {liveModules}/{PRIVACY_MODULES.length} module active. +

+
+ + {/* GDPR rights summary */} +
+

+ Drepturile tale ca titular de date +

+
+ {[ + { right: 'Acces', desc: 'Datele tale sunt vizibile în platformă.', available: true }, + { right: 'Rectificare', desc: 'Poți corecta orice date incorecte.', available: true }, + { right: 'Ștergere', desc: 'Cerere de ștergere — în implementare.', available: false }, + { right: 'Portabilitate', desc: 'Export date — în implementare.', available: false }, + { right: 'Opoziție', desc: 'Opt-out procesare AI — parțial.', available: false }, + { right: 'Restricție', desc: 'Limitare procesare — a3.', available: false }, + ].map((r) => ( +
+

{r.right}

+

{r.desc}

+

+ {r.available ? '✓ disponibil' : '○ în lucru'} +

+
+ ))} +
+
+ + {/* Quick stats */} +
+ +

Înregistrări audit

+

{auditEntries.length}

+ + +

Cereri AI loggate

+

{aiRequests.length}

+ + +

Membri workspace

+

{members.length}

+ +
+ + {/* Privacy modules */} +
+

+ Module Privacy & Security +

+
    + {PRIVACY_MODULES.map((mod) => ( +
  • + {mod.status === 'live' ? ( + +
    +

    {mod.label}

    +

    {mod.desc}

    +
    + + {STATUS_LABEL[mod.status]} + + + ) : ( +
    +
    +

    {mod.label}

    +

    {mod.desc}

    +
    + + {STATUS_LABEL[mod.status]} + +
    + )} +
  • + ))} +
+
+
+ ); +}