import { useEffect, useState } from 'react'; import type { GameSystemListItem } from '../../shared/ipc/contracts'; export type { GameSystemListItem }; type Props = { open: boolean; onClose: () => void; labels: { title: string; import: string; preview: string; remove: string; empty: string; close: string; }; listSystems: () => Promise; importSystem: () => Promise; deleteSystem: (id: string) => Promise; previewSystem: (id: string) => Promise; }; export function GameSystemsModal({ open, onClose, labels, listSystems, importSystem, deleteSystem, previewSystem, }: Props) { const [items, setItems] = useState([]); const [busy, setBusy] = useState(false); useEffect(() => { if (!open) return; void (async () => { setItems(await listSystems()); })(); }, [open, listSystems]); if (!open) return null; return (
{labels.title}
{items.length === 0 ? (
{labels.empty}
) : ( items.map((s) => (
{s.name}
{s.id} ยท r{s.revision}
)) )}
); }