change onboarding state var for better tracking

pull/208/head
Tim Pechersky 2021-08-30 18:19:46 +02:00
rodzic 2dabc434a3
commit db809568f2
1 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -181,10 +181,19 @@ const UIProvider = ({ children }) => {
); );
const [onboardingStep, setOnboardingStep] = useState(() => { const [onboardingStep, setOnboardingStep] = useState(() => {
const step = onboardingSteps.findIndex( //First find onboarding step that was viewed once (resume where left)
(event) => onboardingState[event.step] === 0 // If none - find step that was never viewed
// if none - set onboarding to zero
let step = onboardingSteps.findIndex(
(event) => onboardingState[event.step] === 1
); );
if (step === -1 && isOnboardingComplete) return onboardingSteps.length - 1; step =
step === -1
? onboardingSteps.findIndex(
(event) => onboardingState[event.step] === 0
)
: step;
if (step === -1 && isOnboardingComplete) return 0;
else if (step === -1 && !isOnboardingComplete) return 0; else if (step === -1 && !isOnboardingComplete) return 0;
else return step; else return step;
}); });