import { Alert, Button, Dialog, DialogContent, DialogTitle, Stack, } from '@mui/material'; import { FolderOpen } from '@mui/icons-material'; import { AdminedTournament, GuideState, Mode, OfflineModeStatus, } from '../common/types'; import ManualNamesForm from './ManualNamesForm'; import StartggTournamentForm from './StartggTournamentForm'; import ChallongeTournamentForm from './ChallongeTournamentForm'; import ParryggTournamentForm from './ParryggTournamentForm'; import { OfflineModeConnectionDialogContent } from './OfflineModeConnection'; export default function GuidedDialog({ open, mode, gettingAdminedTournaments, adminedTournaments, getAdminedTournaments, gettingTournament, tournamentSet, copyDirSet, getStartggTournament, getChallongeTournament, getParryggTournament, offlineModeStatus, manualNames, setManualNames, setCopyDir, confirmedCopySettings, state, setState, backdropOpen, setBackdropOpen, }: { open: boolean; mode: Mode; gettingAdminedTournaments: boolean; adminedTournaments: AdminedTournament[]; getAdminedTournaments: () => Promise; gettingTournament: boolean; tournamentSet: boolean; copyDirSet: boolean; getStartggTournament: (maybeSlug: string, initial?: boolean) => Promise; getChallongeTournament: (maybeSlug: string) => Promise; getParryggTournament: (maybeSlug: string) => Promise; offlineModeStatus: OfflineModeStatus; manualNames: string[]; setManualNames: (manualNames: string[]) => Promise; setCopyDir: (copyDir: string) => void; confirmedCopySettings: boolean; state: GuideState; setState: (state: GuideState) => void; backdropOpen: boolean; setBackdropOpen: (backdropOpen: boolean) => void; }) { return ( <> { if (open || !confirmedCopySettings) { return theme.zIndex.modal + 1; } if (backdropOpen) { return theme.zIndex.drawer + 2; } return undefined; }, }} > {(!tournamentSet || !copyDirSet) && ( Walkthrough mode not ready )} {tournamentSet && copyDirSet && !confirmedCopySettings && ( Confirm copy settings )} {tournamentSet && copyDirSet && confirmedCopySettings && state === GuideState.NONE && ( Walkthrough mode ready, insert USB drive... )} {tournamentSet && copyDirSet && confirmedCopySettings && state !== GuideState.NONE && ( <> {state === GuideState.SET && 'Select set'} {state === GuideState.REPLAYS && ( <> Deselect handwarmers
(and select real games) )} {state === GuideState.PLAYERS && 'Assign players and report'}
{state === GuideState.REPLAYS && ( )} )}
{!tournamentSet && mode === Mode.STARTGG && ( {}} /> )} {!tournamentSet && mode === Mode.CHALLONGE && ( {}} /> )} {!tournamentSet && mode === Mode.PARRYGG && ( {}} /> )} {!tournamentSet && mode === Mode.OFFLINE_MODE && ( )} {!tournamentSet && mode === Mode.MANUAL && ( {}} manualNames={manualNames} setManualNames={setManualNames} /> )} {tournamentSet && !copyDirSet && ( <> Set copy folder )} ); }