import { useState, useEffect } from 'react' import { api } from '../api' function KeyList({ keys, label, color }) { if (!keys || keys.length === 0) return null return (
{label} ({keys.length})
{keys.map((k, i) => (
{typeof k === 'object' && k !== null ? Object.entries(k).map(([field, val]) => `${field}: ${val}`).join(' · ') : k}
))}
) } function LogRow({ entry }) { const [expanded, setExpanded] = useState(false) const info = entry.info || {} const insertedKeys = info.inserted_keys || [] const excludedKeys = info.excluded_keys || [] const hasKeys = insertedKeys.length > 0 || excludedKeys.length > 0 return ( <> {entry.id} {entry.source_name} {new Date(entry.imported_at).toLocaleString()} {entry.records_imported} {entry.records_duplicate} {hasKeys && ( )} {expanded && ( )} ) } export default function Log() { const [log, setLog] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { api.getAllImportLog() .then(setLog) .catch(() => {}) .finally(() => setLoading(false)) }, []) return (

Import Log

{loading &&

Loading…

} {!loading && log.length === 0 && (

No imports yet.

)} {log.length > 0 && ( {log.map(entry => )}
ID Source Date Imported Duplicates
)}
) }