From c5d263c1af49c9ae1b68fa0849a660b3e114b2f6 Mon Sep 17 00:00:00 2001 From: Mountler Date: Mon, 30 Oct 2023 15:48:28 +0100 Subject: [PATCH] fixed linter errors --- .../UIComponents/AdaptivityElementAnswerSelection.tsx | 2 +- .../BreakTimeNotification/BreakTimeNotification.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Components/Core/Presentation/Adaptivity/AdaptivityElement/UIComponents/AdaptivityElementAnswerSelection.tsx b/src/Components/Core/Presentation/Adaptivity/AdaptivityElement/UIComponents/AdaptivityElementAnswerSelection.tsx index 6c4695288..039598022 100644 --- a/src/Components/Core/Presentation/Adaptivity/AdaptivityElement/UIComponents/AdaptivityElementAnswerSelection.tsx +++ b/src/Components/Core/Presentation/Adaptivity/AdaptivityElement/UIComponents/AdaptivityElementAnswerSelection.tsx @@ -47,7 +47,7 @@ export default function AdaptivityElementAnswerSelection({ setAnswerColors(newColors); }, - [question.isMultipleChoice, question.questionAnswers] + [question] ); return ( diff --git a/src/Components/Core/Presentation/Adaptivity/BreakTimeNotification/BreakTimeNotification.tsx b/src/Components/Core/Presentation/Adaptivity/BreakTimeNotification/BreakTimeNotification.tsx index 1cc8d7cd6..c38e4f714 100644 --- a/src/Components/Core/Presentation/Adaptivity/BreakTimeNotification/BreakTimeNotification.tsx +++ b/src/Components/Core/Presentation/Adaptivity/BreakTimeNotification/BreakTimeNotification.tsx @@ -10,7 +10,7 @@ import tailwindMerge from "../../Utils/TailwindMerge"; import StyledButton from "~ReactComponents/ReactRelated/ReactBaseComponents/StyledButton"; import TextWithLineBreaks from "~ReactComponents/ReactRelated/ReactBaseComponents/TextWithLineBreaks"; import pauseIcon from "../../../../../Assets/icons/42-pause-icon/47-pause-icon-nobg.svg"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; export default function BreakTimeNotification({ className }: AdLerUIComponent) { const [viewModel, controller] = useBuilder< @@ -22,13 +22,12 @@ export default function BreakTimeNotification({ className }: AdLerUIComponent) { const [showMinimizedModal] = useObservable(viewModel?.showMinimizedModal); const [breakType] = useObservable(viewModel?.breakType); useObservable(viewModel?.slideIndex); - - let randomIndex = 0; + const [randomIndex, setRandomIndex] = useState(0); useEffect(() => { - randomIndex = Math.floor(Math.random()); + setRandomIndex(Math.floor(Math.random())); controller.setSliderIndex(1); - }, [viewModel?.showModal]); + }, [viewModel?.showModal, controller]); if (!viewModel || !controller || !showModal || !breakType) return null;