From 33f0a64ff653cd50e8fb3edbff26c1ffc118ee3a Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Sun, 10 May 2026 07:59:02 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Persistent=20result=20history=20?= =?UTF-8?q?=E2=80=94=20click=20to=20reload=20old=20scan=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both DocCheckTab and BannerCheckTab now: - Store full scan results per history entry in localStorage - History entries are clickable — loads the saved result immediately - No need to re-scan to see old results - Fallback to last result if specific entry not found - Banner-Check sends HTML email report to mailpit Co-Authored-By: Claude Opus 4.6 (1M context) --- .../sdk/agent/_components/BannerCheckTab.tsx | 20 +++++++++++++--- .../app/sdk/agent/_components/DocCheckTab.tsx | 23 +++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx b/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx index e99ea7c..3fb5a2a 100644 --- a/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx +++ b/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx @@ -55,7 +55,7 @@ export function BannerCheckTab() { try { const s = localStorage.getItem('banner-check-result'); return s ? JSON.parse(s) : null } catch { return null } }) const [categories, setCategories] = useState(['all']) - const [history, setHistory] = useState<{ url: string; date: string; provider: string; violations: number; pct: number }[]>(() => { + const [history, setHistory] = useState<{ url: string; date: string; provider: string; violations: number; pct: number; resultKey: string }[]>(() => { if (typeof window === 'undefined') return [] try { return JSON.parse(localStorage.getItem('banner-check-history') || '[]') } catch { return [] } }) @@ -97,14 +97,17 @@ export function BannerCheckTab() { setResult(data) localStorage.setItem('banner-check-result', JSON.stringify(data)) - // Add to history + // Add to history with persistent result const violations = data.structured_checks?.filter((c: CheckItem) => !c.passed && !c.skipped).length || 0 + const resultKey = `banner-check-result-${Date.now()}` + try { localStorage.setItem(resultKey, JSON.stringify(data)) } catch { /* quota */ } const entry = { url: url.trim(), date: new Date().toISOString(), provider: data.banner_provider || 'Unbekannt', violations, pct: data.completeness_pct ?? 0, + resultKey, } const updated = [entry, ...history].slice(0, 30) setHistory(updated) @@ -117,8 +120,19 @@ export function BannerCheckTab() { } } - const loadFromHistory = (entry: { url: string }) => { + const loadFromHistory = (entry: { url: string; resultKey?: string }) => { setUrl(entry.url) + if (entry.resultKey) { + try { + const saved = localStorage.getItem(entry.resultKey) + if (saved) { setResult(JSON.parse(saved)); return } + } catch {} + } + // Fallback: load last result + try { + const last = localStorage.getItem('banner-check-result') + if (last) setResult(JSON.parse(last)) + } catch {} } const structuredChecks = result?.structured_checks || [] diff --git a/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx b/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx index 8ba9c88..0f9b1b3 100644 --- a/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx +++ b/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx @@ -38,7 +38,7 @@ export function DocCheckTab() { try { const s = localStorage.getItem('doc-check-results'); return s ? JSON.parse(s) : null } catch { return null } }) const [error, setError] = useState(null) - const [history, setHistory] = useState<{ date: string; urls: number; findings: number }[]>(() => { + const [history, setHistory] = useState<{ date: string; urls: number; findings: number; resultKey: string }[]>(() => { if (typeof window === 'undefined') return [] try { return JSON.parse(localStorage.getItem('doc-check-history') || '[]') } catch { return [] } }) @@ -110,7 +110,9 @@ export function DocCheckTab() { setResults(pollData.result) setProgress('') localStorage.setItem('doc-check-results', JSON.stringify(pollData.result)) - const entry = { date: new Date().toISOString(), urls: validEntries.length, findings: pollData.result.total_findings || 0 } + const resultKey = `doc-check-result-${Date.now()}` + try { localStorage.setItem(resultKey, JSON.stringify(pollData.result)) } catch { /* quota */ } + const entry = { date: new Date().toISOString(), urls: validEntries.length, findings: pollData.result.total_findings || 0, resultKey } const updated = [entry, ...history].slice(0, 30) setHistory(updated) localStorage.setItem('doc-check-history', JSON.stringify(updated)) @@ -270,7 +272,20 @@ export function DocCheckTab() {

Letzte Pruefungen

{history.map((h, i) => ( -
+
-
+ ))}