'use client' import React, { useEffect, useState, useCallback, use } from 'react' import { useRouter } from 'next/navigation' import { ClassificationBadge } from '../../_components/ClassificationBadge' interface CRAProject { id: string name: string intended_use: string primary_language: string | null connected_to_internet: boolean has_software_updates: boolean processes_personal_data: boolean is_critical_infra_supplier: boolean cra_classification: string | null classification_rationale: string[] status: string } const CLASSIFICATION_DESC: Record = { NOT_IN_SCOPE: 'Dein Produkt enthaelt keine digitalen Elemente nach CRA-Definition. Es ist nicht vom CRA betroffen.', STANDARD: 'Default-Kategorie fuer Produkte mit digitalen Elementen. Self-Assessment (Modul A) ist der typische Pfad.', IMPORTANT_I: 'Annex III Klasse I — Wichtige Produkte mit erhoehten Anforderungen. Self-Assessment OR Harmonized Standard moeglich.', IMPORTANT_II: 'Annex III Klasse II — Wichtige Produkte mit hohem Sicherheitsbedarf. Harmonized Standard ODER EUCC ODER Notified Body.', CRITICAL: 'Annex IV — Kritische Produkte (z.B. HSM, Smart-Meter-Gateways). Notified-Body-Assessment Pflicht.', } export default function ScopeCheckPage({ params, }: { params: Promise<{ projectId: string }> }) { const { projectId } = use(params) const router = useRouter() const [project, setProject] = useState(null) const [loading, setLoading] = useState(true) const [checking, setChecking] = useState(false) const [error, setError] = useState('') const tenant = '00000000-0000-0000-0000-000000000001' const load = useCallback(async () => { try { const res = await fetch(`/api/sdk/v1/cra/projects/${projectId}`, { headers: { 'X-Tenant-ID': tenant }, }) if (!res.ok) throw new Error(await res.text()) setProject(await res.json()) } catch (e) { setError(e instanceof Error ? e.message : 'Fehler beim Laden') } finally { setLoading(false) } }, [projectId]) useEffect(() => { load() }, [load]) const runScopeCheck = async () => { setChecking(true) setError('') try { const res = await fetch(`/api/sdk/v1/cra/projects/${projectId}/scope-check`, { method: 'POST', headers: { 'X-Tenant-ID': tenant }, }) if (!res.ok) throw new Error(await res.text()) setProject(await res.json()) } catch (e) { setError(e instanceof Error ? e.message : 'Klassifikation fehlgeschlagen') } finally { setChecking(false) } } if (loading) return

Laedt...

if (!project) return null const hasResult = !!project.cra_classification return (
← Zurueck zum Projekt

Scope-Check & Klassifikation

Schritt 2 von 3 — Wir matchen dein Intake gegen Annex III/IV des CRA.

{error && (
{error}
)}

Aktuelle Intake-Daten

{hasResult && (

Ergebnis

{CLASSIFICATION_DESC[project.cra_classification!]}

{project.classification_rationale?.length > 0 && (

Begruendung

    {project.classification_rationale.map((r, i) =>
  • {r}
  • )}
)}
{project.cra_classification === 'NOT_IN_SCOPE' && (

Produkt ist nicht im CRA-Scope. Keine weiteren Schritte noetig.

)}
)}
) } function Field({ label, value, fullWidth }: { label: string; value: string; fullWidth?: boolean }) { return (
{label}
{value}
) }