feat(cookie): 2. Sicht Banner-Kategorie + Fehl-Einsortierung

CookieResultView bekommt einen Umschalter [Rechtliche Rolle] ↔
[Banner-Kategorie] (Notwendig/Funktional/Statistik/Marketing). In beiden
Sichten zeigt jede Cookie-Zeile '→ sollte: Marketing', wenn die tatsächliche
Kategorie laut Library von der deklarierten abweicht (rot bei Tracker als
notwendig, § 25 TDDDG). Neue KPI 'Falsch einsortiert'. Backend liefert dazu
cookie_categories (name→actual_category) aus big_lib im cookie-check-Output;
Seite lädt cookie-check einmal und reicht es an beide Komponenten.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 10:33:33 +02:00
parent af8906b156
commit b0115cb10b
6 changed files with 201 additions and 45 deletions
@@ -17,6 +17,7 @@ export default function SnapshotDetail(
) {
const { snapshotId } = useUnwrap(params)
const [snap, setSnap] = useState<any>(null)
const [check, setCheck] = useState<any>(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
@@ -34,6 +35,16 @@ export default function SnapshotDetail(
return () => { cancelled = true }
}, [snapshotId])
// Library-Abgleich einmal laden (Findings + cookie_categories für beide Views).
useEffect(() => {
let cancelled = false
fetch(`/api/sdk/v1/agent/snapshots/${snapshotId}/cookie-check`)
.then(r => r.json())
.then(d => { if (!cancelled) setCheck(d) })
.catch(() => { if (!cancelled) setCheck(null) })
return () => { cancelled = true }
}, [snapshotId])
const hasCookies = (snap?.cmp_vendors?.length ?? 0) > 0
return (
@@ -47,8 +58,8 @@ export default function SnapshotDetail(
<div className="text-sm text-red-600">Snapshot nicht gefunden.</div>
) : hasCookies ? (
<>
<CookieLibraryPanel snapshotId={snapshotId} />
<CookieResultView snapshot={snap} />
<CookieLibraryPanel snapshotId={snapshotId} data={check ?? undefined} />
<CookieResultView snapshot={snap} cookieCategories={check?.cookie_categories} />
</>
) : (
<div className="text-sm text-gray-500">