2024-04-23 14:45:49 +00:00
|
|
|
import { Box, Typography, useTheme } from "@mui/material";
|
|
|
|
import type { QuizQuestionPage } from "@model/questionTypes/page";
|
2024-06-17 14:12:53 +00:00
|
|
|
import QuizVideo from "@/ui_kit/VideoIframe/VideoIframe";
|
2024-04-23 14:45:49 +00:00
|
|
|
|
|
|
|
type PageProps = {
|
|
|
|
currentQuestion: QuizQuestionPage;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Page = ({ currentQuestion }: PageProps) => {
|
|
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box>
|
|
|
|
<Typography
|
|
|
|
variant="h5"
|
|
|
|
sx={{
|
|
|
|
paddingBottom: "25px",
|
|
|
|
color: theme.palette.text.primary,
|
|
|
|
wordBreak: "break-word",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{currentQuestion.title}
|
|
|
|
</Typography>
|
2024-12-21 18:44:57 +00:00
|
|
|
<Typography
|
|
|
|
color={theme.palette.text.primary}
|
|
|
|
sx={{ wordBreak: "break-word" }}
|
|
|
|
>
|
2024-04-23 14:45:49 +00:00
|
|
|
{currentQuestion.content.text}
|
|
|
|
</Typography>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column",
|
|
|
|
width: "100%",
|
|
|
|
marginTop: "20px",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{currentQuestion.content.useImage ? (
|
2024-06-19 19:46:10 +00:00
|
|
|
currentQuestion.content.back && (
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
borderRadius: "12px",
|
|
|
|
border: "1px solid #9A9AAF",
|
|
|
|
overflow: "hidden",
|
2024-04-23 14:45:49 +00:00
|
|
|
}}
|
2024-12-21 18:44:57 +00:00
|
|
|
onClick={(event) => event.preventDefault()}
|
2024-06-19 19:46:10 +00:00
|
|
|
>
|
|
|
|
<img
|
|
|
|
key={currentQuestion.id}
|
|
|
|
src={currentQuestion.content.back}
|
|
|
|
alt=""
|
|
|
|
style={{
|
|
|
|
display: "block",
|
|
|
|
width: "100%",
|
|
|
|
height: "100%",
|
|
|
|
objectFit: "contain",
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
)
|
2024-04-23 14:45:49 +00:00
|
|
|
) : (
|
2024-06-17 14:12:53 +00:00
|
|
|
<QuizVideo
|
2024-04-23 14:45:49 +00:00
|
|
|
containerSX={{
|
|
|
|
width: "100%",
|
|
|
|
height: "calc(100% - 270px)",
|
|
|
|
maxHeight: "80%",
|
|
|
|
objectFit: "contain",
|
2024-06-17 14:21:26 +00:00
|
|
|
aspectRatio: "16 / 9",
|
2024-04-23 14:45:49 +00:00
|
|
|
}}
|
|
|
|
videoUrl={currentQuestion.content.video}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|