diff --git a/resources/ts/Views/Setup/SetupPage.tsx b/resources/ts/Views/Setup/SetupPage.tsx index 9e80696da..1aa69d54d 100644 --- a/resources/ts/Views/Setup/SetupPage.tsx +++ b/resources/ts/Views/Setup/SetupPage.tsx @@ -13,6 +13,7 @@ import { RequestError } from 'mithril-utilities'; import {match} from 'ts-pattern'; +import {Class} from 'type-fest'; import { SetupStep, @@ -27,6 +28,7 @@ export interface SetupPageAttributes extends PageAttributes<{ } export default class SetupPage extends Page { + initialStep = SetupSteps.Welcome; currentStep = Stream(SetupSteps.Welcome); steps: Record> = { [SetupSteps.Welcome]: new WelcomeStep(), @@ -46,18 +48,20 @@ export default class SetupPage extends Page { .with('admin_user', () => SetupSteps.AdminUser) .otherwise(() => SetupSteps.Welcome); this.currentStep(setupStep); + this.initialStep = setupStep; } } contents(vnode: Vnode) { + // noinspection LocalVariableNamingConventionJS - Capitalized name is needed for JSX. Cast to unknown to avoid TS error about JSX element type + const Step = this.steps[this.currentStep()] as unknown as Class; return <>

{__('Configurazione iniziale')}

- {m(this.steps[this.currentStep()], { - ...vnode.attrs.page.props, - onSaveInstall: this.onSaveInstall.bind(this), - onStepChange: (step: SetupSteps) => this.currentStep(step) - })} +
; } diff --git a/resources/ts/Views/Setup/Steps/SetupStep.tsx b/resources/ts/Views/Setup/Steps/SetupStep.tsx index ccd25be80..85375bfbe 100644 --- a/resources/ts/Views/Setup/Steps/SetupStep.tsx +++ b/resources/ts/Views/Setup/Steps/SetupStep.tsx @@ -24,6 +24,7 @@ export enum SetupSteps { export interface SetupStepAttributes extends Attributes { onStepChange: (step: SetupSteps) => void; + disablePreviousButton?: boolean; } export abstract class SetupStep extends Component { @@ -55,7 +56,7 @@ export abstract class SetupStep): boolean { - return Boolean(this.previousStep); + return Boolean(this.previousStep) && !vnode.attrs.disablePreviousButton; } onPreviousButtonClicked(vnode: Vnode): void {