Commit c453ddfc authored by Katarína Sieklová's avatar Katarína Sieklová
Browse files

fix: remove console log + add stepper

parent 40bda500
Loading
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -44,10 +44,6 @@ const InsulinTest = () => {
        setIsScoreBelow50((score / 5) * 100 < 50);
    }, [score]);

    useEffect(() => {
        console.log(currentStep);
    }, [currentStep]);

    const handleNextStep = () => {
        setCurrentStep(currentStep + 1);
        setSelectedAnswer(null);
+33 −23
Original line number Diff line number Diff line
import {useEffect, useRef, useState} from "react";
import {correct, nextButton, summaryHappy, summarySad, symptomsTestQuestions, yourScore} from "../texts";
import {
    correct,
    nextButton,
    stepperLabelsSymptoms,
    summaryHappy,
    summarySad,
    symptomsTestQuestions,
    symptomsText,
    treatmentText,
    yourScore
} from "../texts";
import {useRecoilValue} from "recoil";
import {languageAtom} from "../atoms/languageAtom";
import {Texts, useAnimate} from "../hooks/useAnimate";
@@ -9,7 +19,7 @@ import {AnimateCC} from "react-adobe-animate";
import Typewriter, {TypewriterClass} from "typewriter-effect";
import SymptomsDragNDropTest from "../components/SymptomsDragNDropTest";
import SymptomsCardTest from "../components/SymptomsCardTest";
// import {Stepper} from "react-stepa";
import {Stepper} from "react-stepa";


const SymptomsTest = () => {
@@ -17,8 +27,8 @@ const SymptomsTest = () => {
    const [currentStep, setCurrentStep] = useState(0);
    const nextButtonText = useTranslate(nextButton);
    const correctButtonText = useTranslate(correct);
    // const treatmentStepText = useTranslate(treatmentText);
    // const symptomsStepText = useTranslate(symptomsText);
    const treatmentStepText = useTranslate(treatmentText);
    const symptomsStepText = useTranslate(symptomsText);
    const scoreText = useTranslate(yourScore);
    const [selectedAnswer, setSelectedAnswer] = useState<number | null>(null);
    const [isAnswered, setIsAnswered] = useState(false);
@@ -53,16 +63,16 @@ const SymptomsTest = () => {
        }
    };

    // const generateSteps = () => {
    //     const updatedSteps = stepperLabelsSymptoms.map((question) => ({
    //         label: question[language as keyof Texts],
    //         description: "",
    //     }));
    //
    //     updatedSteps.splice(updatedSteps.length - 1, 0, {label: `${treatmentStepText}`, description: ""});
    //     updatedSteps.splice(updatedSteps.length - 1, 0, {label: `${symptomsStepText}`, description: ""});
    //     return updatedSteps;
    // };
    const generateSteps = () => {
        const updatedSteps = stepperLabelsSymptoms.map((question) => ({
            label: question[language as keyof Texts],
            description: "",
        }));

        updatedSteps.splice(updatedSteps.length - 1, 0, {label: `${treatmentStepText}`, description: ""});
        updatedSteps.splice(updatedSteps.length - 1, 0, {label: `${symptomsStepText}`, description: ""});
        return updatedSteps;
    };

    const isDraggableTestStep = currentStep === 5;
    const isSymptomTest = currentStep === 6;
@@ -70,15 +80,15 @@ const SymptomsTest = () => {

    return (
        <div className="overflow-auto mx-auto py-8">
            {/*<Stepper*/}
            {/*    customStyle={{*/}
            {/*        completed: '#3D348B',*/}
            {/*        pending: '#aaccff',*/}
            {/*        progress: '#5599ff',*/}
            {/*    }}*/}
            {/*    steps={generateSteps()}*/}
            {/*    activeStep={currentStep}*/}
            {/*/>*/}
            <Stepper
                customStyle={{
                    completed: '#3D348B',
                    pending: '#aaccff',
                    progress: '#5599ff',
                }}
                steps={generateSteps()}
                activeStep={currentStep}
            />
            <div className="text-center mt-4">
                {isSummaryStep ? (
                    <>