side widget: disable flash on quiz opening
This commit is contained in:
parent
8c1b6d97ef
commit
9f5ec66533
@ -24,6 +24,12 @@ export default function QuizSideButton({ quizId, position, buttonBackgroundColor
|
|||||||
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
const [isQuizShown, setIsQuizShown] = useState<boolean>(false);
|
||||||
const isMobile = useMediaQuery("(max-width: 600px)");
|
const isMobile = useMediaQuery("(max-width: 600px)");
|
||||||
const isQuizCompleted = useQuizCompletionStatus(quizId);
|
const isQuizCompleted = useQuizCompletionStatus(quizId);
|
||||||
|
const [isFlashEnabled, setIsFlashEnabled] = useState<boolean>(true);
|
||||||
|
|
||||||
|
function openQuiz() {
|
||||||
|
setIsQuizShown(true);
|
||||||
|
setIsFlashEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<ThemeProvider theme={lightTheme}>
|
<ThemeProvider theme={lightTheme}>
|
||||||
@ -37,7 +43,7 @@ export default function QuizSideButton({ quizId, position, buttonBackgroundColor
|
|||||||
{
|
{
|
||||||
m: 0,
|
m: 0,
|
||||||
},
|
},
|
||||||
(!isMobile && !fullScreen) && {
|
!(isMobile || fullScreen) && {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
bottom: PADDING,
|
bottom: PADDING,
|
||||||
right: position === "right" ? PADDING : undefined,
|
right: position === "right" ? PADDING : undefined,
|
||||||
@ -59,7 +65,7 @@ export default function QuizSideButton({ quizId, position, buttonBackgroundColor
|
|||||||
<Button
|
<Button
|
||||||
className="pena-quiz-widget-button"
|
className="pena-quiz-widget-button"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={() => setIsQuizShown(true)}
|
onClick={openQuiz}
|
||||||
disableFocusRipple
|
disableFocusRipple
|
||||||
sx={[
|
sx={[
|
||||||
{
|
{
|
||||||
@ -82,7 +88,7 @@ export default function QuizSideButton({ quizId, position, buttonBackgroundColor
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{!isQuizCompleted && <RunningStripe />}
|
{!isQuizCompleted && isFlashEnabled && <RunningStripe />}
|
||||||
Пройти квиз
|
Пройти квиз
|
||||||
</Button>
|
</Button>
|
||||||
</ThemeProvider>,
|
</ThemeProvider>,
|
||||||
|
Loading…
Reference in New Issue
Block a user