import { useState, useEffect } from 'react' import type { IncidentListItem } from '../services/incidentsApi' import { fetchIncidentsRaw } from '../services/incidentsApi' export function IncidentTable() { const [incidents, setIncidents] = useState([]) const [searchTerm, setSearchTerm] = useState('') useEffect(() => { fetchIncidentsRaw() .then(setIncidents) .catch(() => setIncidents([])) }, []); const filteredIncidents = incidents.filter((inc) => { if (!searchTerm) return true; return inc.acdntNm.toLowerCase().includes(searchTerm.toLowerCase()); }); return (
{/* 헤더 */}

유출유 확산 예측 목록

총 {filteredIncidents.length}건

setSearchTerm(e.target.value)} className="w-64 px-4 py-2 text-sm bg-bg-2 border border-border rounded-md text-text-1 placeholder-text-3 focus:border-primary-cyan focus:outline-none" />
{/* 테이블 */}
{filteredIncidents.map((incident) => ( ))}
번호 사고명 사고시각 선박유형 유종 유출량 사고유형 상태 분석자
{incident.acdntSn}
{incident.acdntNm}
{incident.occrnDtm} {incident.vesselTp ?? '—'} {incident.oilTpCd ?? '—'} {incident.spilQty != null ? incident.spilQty.toFixed(2) : '—'} {incident.acdntTpCd} {incident.phaseCd} {incident.analystNm ?? '—'}
) }