UNPKG

rune

Version:

CLI to upload your games to Rune

27 lines (26 loc) 1.21 kB
import React, { useState, useEffect } from "react"; import { Choose } from "../../components/Choose.js"; import { Step } from "../../components/Step.js"; import { useGame } from "../../gql/useGame.js"; export function ConfirmationStep({ label, gameId, gameDir, onComplete, }) { const { game } = useGame(gameId); const [confirmed, setConfirmed] = useState(); useEffect(() => { if (typeof confirmed === "boolean") onComplete(confirmed, gameDir); }, [confirmed, onComplete, gameDir]); return (React.createElement(Step, { status: !game && gameId !== null ? "waiting" : confirmed === undefined ? "userInput" : confirmed ? "success" : "error", label: game || gameId === null ? label(game?.title ?? "", gameDir) + (typeof confirmed === "boolean" ? confirmed ? " (Yes)" : " (No)" : "") : "...", view: confirmed === undefined && (React.createElement(Choose, { options: ["No", "Yes"], onSubmit: (response) => setConfirmed(response === "Yes") })) })); }