The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { useMessages } from "gt-react"; |
| 2 | |
| 3 | import { WizardSteps } from "../ui/wizard"; |
| 4 | import { |
| 5 | ADD_PROVIDER_WIZARD_STEPS, |
| 6 | resolveWizardNavigation, |
| 7 | type WizardNavigation, |
| 8 | } from "./AddProviderInstanceDialog.logic"; |
| 9 | |
| 10 | interface AddProviderInstanceWizardStepsProps { |
| 11 | readonly currentStep: number; |
| 12 | readonly summaries: readonly (string | null)[]; |
| 13 | readonly instanceIdError: string | null; |
| 14 | readonly steps?: readonly string[]; |
| 15 | readonly identityStep?: number; |
| 16 | readonly prerequisite?: { |
| 17 | readonly step: number; |
| 18 | readonly error: string | null; |
| 19 | }; |
| 20 | readonly onNavigation: (navigation: WizardNavigation) => void; |
| 21 | readonly disabled?: boolean; |
| 22 | } |
| 23 | |
| 24 | export function AddProviderInstanceWizardSteps({ |
| 25 | currentStep, |
| 26 | summaries, |
| 27 | instanceIdError, |
| 28 | steps = ADD_PROVIDER_WIZARD_STEPS, |
| 29 | identityStep, |
| 30 | prerequisite, |
| 31 | onNavigation, |
| 32 | disabled = false, |
| 33 | }: AddProviderInstanceWizardStepsProps) { |
| 34 | const m = useMessages(); |
| 35 | return ( |
| 36 | <WizardSteps |
| 37 | steps={steps.map((step) => m(step))} |
| 38 | currentStep={currentStep} |
| 39 | summaries={summaries} |
| 40 | isStepDisabled={() => disabled} |
| 41 | onStepChange={(requestedStep) => |
| 42 | onNavigation( |
| 43 | resolveWizardNavigation(currentStep, requestedStep, steps.length, { |
| 44 | instanceIdError, |
| 45 | ...(identityStep === undefined ? {} : { identityStep }), |
| 46 | ...(prerequisite === undefined ? {} : { prerequisite }), |
| 47 | }), |
| 48 | ) |
| 49 | } |
| 50 | /> |
| 51 | ); |
| 52 | } |