import React, { useState, useEffect, useRef } from 'react'; import { gsap, ScrollTrigger } from '../lib/gsap.ts'; import { useReducedMotion } from '../hooks/useReducedMotion.ts'; import { IncidentCard } from '../components/diagnostics/IncidentCard.tsx'; import { Skeleton } from '../components/ui/Skeleton.tsx'; import { EmptyState } from '../components/ui/EmptyState.tsx'; import { ErrorState } from '../components/ui/ErrorState.tsx'; import { Input } from '../components/ui/Input.tsx'; import { Select } from '../components/ui/Select.tsx'; import { incidents, healthChecks } from '../data/incidents.ts'; import { IncidentSchema } from '../data/schema.ts'; const IncidentsPage: React.FC = () => { const reduced = useReducedMotion(); const scrollRef = useRef(null); const [search, setSearch] = useState(''); const [severity, setSeverity] = useState('all'); const [loading, setLoading] = useState(true); const [error, setError] = useState(false); useEffect(() => { const timer = setTimeout(() => { try { incidents.forEach(inc => IncidentSchema.parse(inc)); } catch { setError(true); } setLoading(false); }, 300); return () => clearTimeout(timer); }, []); useEffect(() => { if (reduced || loading || !scrollRef.current) return; const ctx = gsap.context(() => { const cards = scrollRef.current?.children; if (cards) { gsap.to(scrollRef.current, { xPercent: -50, ease: 'none', scrollTrigger: { trigger: scrollRef.current?.parentElement, start: 'top bottom', end: 'bottom top', scrub: 1, }, }); } }, scrollRef); return () => ctx.revert(); }, [reduced, loading]); const filtered = incidents.filter(inc => { const matchSearch = inc.name.toLowerCase().includes(search.toLowerCase()) || inc.description.toLowerCase().includes(search.toLowerCase()); const matchSeverity = severity === 'all' || inc.severity === severity; return matchSearch && matchSeverity; }); if (error) { return (

Incident Log

{ setError(false); setLoading(true); setTimeout(() => setLoading(false), 300); }} />
); } return (

Incident Log

A record of all blank-screen failure modes and their resolution.

setSearch(e.target.value)} />