fix: outdated config schema (#1769)

This commit is contained in:
Manuel
2023-12-30 21:54:48 +01:00
committed by GitHub
parent b9a5b5ed09
commit 108803ae2a
3 changed files with 50 additions and 11 deletions

View File

@@ -4,12 +4,31 @@ import { useState } from 'react';
import { StepCreateAccount } from './step-create-account';
import { StepOnboardingFinished } from './step-onboarding-finished';
import { StepUpdatePathMappings } from './step-update-path-mappings';
import { api } from '~/utils/api';
export const OnboardingSteps = ({ isUpdate }: { isUpdate: boolean }) => {
const maximumSteps = isUpdate ? 3 : 2;
const [currentStep, setCurrentStep] = useState(0);
const nextStep = () => setCurrentStep((current) => (current < 3 ? current + 1 : current));
const nextStep = () => setCurrentStep((current) => {
const newValue = (current < maximumSteps ? current + 1 : current);
if (currentStep + 1 >= maximumSteps) {
onFinishOnboarding();
}
return newValue;
});
const prevStep = () => setCurrentStep((current) => (current > 0 ? current - 1 : current));
const { mutate: mutateConfigSchemaVersion } = api.config.updateConfigurationSchemaToLatest.useMutation();
const onFinishOnboarding = () => {
mutateConfigSchemaVersion();
};
return (
<Stack p="lg">
<Stepper