fix: Verifikation — Suchfeld statt 654 Mini-Kacheln + Lazy-Load

- SuggestEvidenceModal: Suchfeld + max 20 Ergebnisse statt alle Kacheln
- Verification page: Mitigations nur on-demand laden (nicht beim Seitenstart)
- Deutlich schnellerer Seitenaufbau

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-07 18:33:21 +02:00
parent 969658261f
commit 78d7273b82
2 changed files with 43 additions and 17 deletions
@@ -14,6 +14,12 @@ export function SuggestEvidenceModal({
const [selectedMitigation, setSelectedMitigation] = useState<string>('')
const [suggested, setSuggested] = useState<SuggestedEvidence[]>([])
const [loadingSuggestions, setLoadingSuggestions] = useState(false)
const [search, setSearch] = useState('')
const filtered = search.trim()
? mitigations.filter(m => (m.title || '').toLowerCase().includes(search.toLowerCase()))
: mitigations
const displayed = filtered.slice(0, 20) // Show max 20 at a time
async function handleSelectMitigation(mitigationId: string) {
setSelectedMitigation(mitigationId)
@@ -41,22 +47,35 @@ export function SuggestEvidenceModal({
</svg>
</button>
</div>
<p className="text-sm text-gray-500 mb-3">
Waehlen Sie eine Massnahme, um passende Nachweismethoden vorgeschlagen zu bekommen.
<p className="text-sm text-gray-500 mb-2">
Waehlen Sie eine Massnahme ({mitigations.length} gesamt). Suchen Sie nach Name:
</p>
<div className="flex flex-wrap gap-2">
{mitigations.map(m => (
<input
type="text" value={search} onChange={e => setSearch(e.target.value)}
placeholder="Massnahme suchen..."
className="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg mb-3 focus:ring-2 focus:ring-purple-400 dark:bg-gray-700 dark:border-gray-600 dark:text-white"
/>
<div className="max-h-[200px] overflow-auto space-y-1">
{displayed.map(m => (
<button
key={m.id} onClick={() => handleSelectMitigation(m.id)}
className={`px-3 py-1.5 text-xs rounded-lg border transition-colors ${
className={`w-full text-left px-3 py-2 text-xs rounded-lg border transition-colors ${
selectedMitigation === m.id
? 'border-purple-400 bg-purple-50 text-purple-700 font-medium'
: 'border-gray-200 bg-white text-gray-700 hover:border-purple-300'
: 'border-gray-100 bg-white text-gray-700 hover:border-purple-300 hover:bg-gray-50'
}`}
>
{m.title}
{m.title || '(Ohne Titel)'}
</button>
))}
{filtered.length > 20 && (
<p className="text-xs text-gray-400 text-center py-1">
{filtered.length - 20} weitere Suchbegriff eingeben um zu filtern
</p>
)}
{filtered.length === 0 && (
<p className="text-xs text-gray-400 text-center py-2">Keine Massnahmen gefunden</p>
)}
</div>
</div>
<div className="flex-1 overflow-auto p-6">