2024-01-20 10:27:21 +00:00
|
|
|
|
import { ArrowDownIcon } from "@icons/questionsPage/ArrowDownIcon";
|
2024-06-19 20:22:37 +00:00
|
|
|
|
import { Box, IconButton, Link, Typography, useMediaQuery, useTheme } from "@mui/material";
|
2024-03-26 11:08:40 +00:00
|
|
|
|
import { FC, MouseEvent, useState } from "react";
|
2024-01-20 10:27:21 +00:00
|
|
|
|
import { ContactIcon } from "./icons/ContactIcon";
|
|
|
|
|
import { MessageIcon } from "./icons/MessageIcon";
|
|
|
|
|
import { PhoneIcon } from "./icons/PhoneIcon";
|
|
|
|
|
import { DeleteIcon } from "@icons/questionsPage/deleteIcon";
|
|
|
|
|
|
2024-02-10 01:41:13 +00:00
|
|
|
|
import { deleteResult, obsolescenceResult } from "@root/results/actions";
|
2024-03-26 11:08:40 +00:00
|
|
|
|
import { IAnswerResult, resultApi } from "@api/result";
|
2024-02-10 01:41:13 +00:00
|
|
|
|
import { useQuizStore } from "@root/quizes/store";
|
|
|
|
|
import { useQuestionsStore } from "@root/questions/store";
|
2024-02-16 00:11:28 +00:00
|
|
|
|
import AddressIcon from "@icons/ContactFormIcon/AddressIcon";
|
2024-02-09 19:05:40 +00:00
|
|
|
|
|
2024-02-26 14:22:40 +00:00
|
|
|
|
import { DeleteModal } from "./DeleteModal";
|
2024-02-20 11:54:08 +00:00
|
|
|
|
|
2024-06-19 20:22:37 +00:00
|
|
|
|
import type { AnyTypedQuizQuestion } from "@frontend/squzanswerer";
|
2024-07-05 16:30:02 +00:00
|
|
|
|
import { useCurrentQuiz } from "@/stores/quizes/hooks";
|
2024-05-15 11:44:10 +00:00
|
|
|
|
|
2024-03-26 11:08:40 +00:00
|
|
|
|
interface CardAnswerProps {
|
2024-02-06 02:00:38 +00:00
|
|
|
|
isNew: boolean;
|
2024-03-26 11:08:40 +00:00
|
|
|
|
idResult: number;
|
2024-02-06 02:00:38 +00:00
|
|
|
|
dayResult: string;
|
|
|
|
|
timeResult: string;
|
|
|
|
|
name?: string;
|
|
|
|
|
phone?: string;
|
|
|
|
|
email?: string;
|
2024-02-16 00:11:28 +00:00
|
|
|
|
address?: string;
|
2024-02-20 11:54:08 +00:00
|
|
|
|
openPrePaymentModal: () => void;
|
2024-02-06 02:00:38 +00:00
|
|
|
|
}
|
2024-01-20 10:27:21 +00:00
|
|
|
|
|
2024-03-26 11:08:40 +00:00
|
|
|
|
export const CardAnswer: FC<CardAnswerProps> = ({
|
2024-02-06 02:00:38 +00:00
|
|
|
|
name,
|
|
|
|
|
phone,
|
|
|
|
|
email,
|
2024-02-16 00:11:28 +00:00
|
|
|
|
address,
|
2024-02-06 02:00:38 +00:00
|
|
|
|
isNew = true,
|
|
|
|
|
idResult,
|
|
|
|
|
timeResult,
|
|
|
|
|
dayResult,
|
2024-02-20 11:54:08 +00:00
|
|
|
|
openPrePaymentModal,
|
2024-03-26 11:08:40 +00:00
|
|
|
|
}) => {
|
2024-01-20 10:27:21 +00:00
|
|
|
|
const [isOpen, setIsOpen] = useState<boolean>(false);
|
2024-02-06 02:00:38 +00:00
|
|
|
|
const [openDelete, setOpenDelete] = useState<boolean>(false);
|
2024-01-20 10:27:21 +00:00
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
2024-03-26 11:08:40 +00:00
|
|
|
|
const [resultsAnswer, setResultsAnswer] = useState<IAnswerResult[]>([]);
|
2024-06-19 20:22:37 +00:00
|
|
|
|
const [questionsResultState, setQuestionsResultState] = useState<AnyTypedQuizQuestion[]>([]);
|
2024-02-10 01:41:13 +00:00
|
|
|
|
const { editQuizId } = useQuizStore();
|
|
|
|
|
const { questions } = useQuestionsStore();
|
2024-07-05 16:30:02 +00:00
|
|
|
|
const quiz = useCurrentQuiz();
|
2024-03-14 21:49:14 +00:00
|
|
|
|
const openResults = async () => {
|
|
|
|
|
setIsOpen(!isOpen);
|
|
|
|
|
if (!isOpen) {
|
2024-05-15 11:44:10 +00:00
|
|
|
|
const [resAnswer, answerError] = await resultApi.getAnswerList(idResult);
|
|
|
|
|
|
|
|
|
|
if (answerError || !resAnswer) {
|
2024-05-15 13:51:41 +00:00
|
|
|
|
if (answerError?.includes("Payment Required")) {
|
|
|
|
|
openPrePaymentModal();
|
|
|
|
|
}
|
2024-03-14 21:49:14 +00:00
|
|
|
|
|
2024-05-15 11:44:10 +00:00
|
|
|
|
return;
|
2024-03-14 21:49:14 +00:00
|
|
|
|
}
|
2024-05-15 11:44:10 +00:00
|
|
|
|
|
|
|
|
|
const resAnswerOnly = resAnswer.filter((res) => res.Result !== true);
|
|
|
|
|
const resQuiz = resAnswer.filter((res) => res.Result === true);
|
|
|
|
|
setResultsAnswer(resAnswerOnly);
|
|
|
|
|
const idResults = resQuiz[0].question_id;
|
2024-06-19 20:22:37 +00:00
|
|
|
|
const questionsResult = questions.filter((q) => q.type && q.backendId === idResults) as AnyTypedQuizQuestion[];
|
2024-05-15 11:44:10 +00:00
|
|
|
|
|
|
|
|
|
setQuestionsResultState(questionsResult);
|
2024-03-14 21:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-25 15:56:01 +00:00
|
|
|
|
const onClickDelete = (e: MouseEvent) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
setOpenDelete(true);
|
|
|
|
|
};
|
|
|
|
|
|
2024-02-09 19:05:40 +00:00
|
|
|
|
return (
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
<Box
|
2024-03-25 15:56:01 +00:00
|
|
|
|
onClick={() => {
|
2024-03-26 11:08:40 +00:00
|
|
|
|
if (editQuizId !== null) {
|
|
|
|
|
obsolescenceResult(idResult, editQuizId);
|
|
|
|
|
openResults();
|
|
|
|
|
}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
}}
|
2024-01-20 10:27:21 +00:00
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
maxWidth: isTablet ? "450px" : "auto",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
width: "100%",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
boxShadow:
|
|
|
|
|
"0px 2.767px 8.551px 0px rgba(210, 208, 225, 0.07), 0px 6.65px 20.549px 0px rgba(210, 208, 225, 0.10), 0px 12.522px 38.692px 0px rgba(210, 208, 225, 0.12), 0px 22.336px 69.019px 0px rgba(210, 208, 225, 0.14), 0px 41.778px 129.093px 0px rgba(210, 208, 225, 0.17), 0px 100px 309px 0px rgba(210, 208, 225, 0.24)",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-01-21 22:09:26 +00:00
|
|
|
|
width: "100%",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
flexDirection: isTablet ? "column" : "-moz-initial",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-21 22:09:26 +00:00
|
|
|
|
<Box
|
2024-01-20 10:27:21 +00:00
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
flexDirection: isTablet ? "column" : "-moz-initial",
|
|
|
|
|
cursor: "pointer",
|
|
|
|
|
p: "20px",
|
2024-06-19 20:22:37 +00:00
|
|
|
|
borderRadius: isTablet ? "12px 12px 0 0" : isOpen ? "12px 0 0 0" : "12px 0 0 12px",
|
2024-01-21 22:09:26 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "flex-start",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
background: "#FFF",
|
|
|
|
|
width: "100%",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
width: isTablet ? "100%" : "auto",
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "flex-start",
|
|
|
|
|
flexDirection: isTablet ? "row-reverse" : "-moz-initial",
|
|
|
|
|
justifyContent: isTablet ? "space-between" : "-moz-initial",
|
|
|
|
|
pb: isTablet ? "20px" : "0",
|
|
|
|
|
mb: isTablet ? "20px" : "0",
|
2024-06-19 20:22:37 +00:00
|
|
|
|
borderBottom: isTablet ? "1px solid rgba(154, 154, 175, 0.50)" : "0",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", gap: "6px" }}>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
width: "30px",
|
|
|
|
|
height: "30px",
|
|
|
|
|
borderRadius: "50%",
|
|
|
|
|
background: "#EEE4FC",
|
|
|
|
|
color: "#7E2AEA",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{idResult}
|
|
|
|
|
</Box>
|
|
|
|
|
<IconButton onClick={openResults}>
|
|
|
|
|
<ArrowDownIcon
|
|
|
|
|
style={{
|
|
|
|
|
transform: isOpen ? "rotate(180deg)" : "rotate(360deg)",
|
|
|
|
|
}}
|
|
|
|
|
fontSize="10px"
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
<Typography
|
2024-01-21 22:09:26 +00:00
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
ml: isTablet ? "0" : "50px",
|
|
|
|
|
mr: isTablet ? "0" : "188px",
|
|
|
|
|
fontSize: "18px",
|
2024-01-21 22:09:26 +00:00
|
|
|
|
color: "#7E2AEA",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
maxWidth: "143px",
|
|
|
|
|
width: "100%",
|
2024-01-21 22:09:26 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
{dayResult} в {timeResult}
|
|
|
|
|
</Typography>
|
2024-01-21 22:09:26 +00:00
|
|
|
|
</Box>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<Box sx={{ display: "flex", flexDirection: "column", gap: "10px" }}>
|
|
|
|
|
{name && (
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", gap: "13px" }}>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<ContactIcon />
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#4D4D4D" }}>{name}</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
{email && (
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", gap: "13px" }}>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<MessageIcon />
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#4D4D4D" }}>{email}</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
{phone && (
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", gap: "13px" }}>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<PhoneIcon />
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#4D4D4D" }}>{phone}</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
{address && (
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", gap: "13px" }}>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<AddressIcon color={"#9A9AAF"} />
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#4D4D4D" }}>{address}</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2024-01-21 22:09:26 +00:00
|
|
|
|
|
2024-03-25 15:56:01 +00:00
|
|
|
|
{!isTablet && isNew && (
|
2024-01-21 22:09:26 +00:00
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
ml: "auto",
|
2024-01-21 22:09:26 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
background: "#FB5607",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
width: "77px",
|
|
|
|
|
height: "36px",
|
|
|
|
|
color: "white",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
2024-01-21 22:09:26 +00:00
|
|
|
|
>
|
|
|
|
|
Новая
|
|
|
|
|
</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
p: isTablet ? "20px" : "0",
|
|
|
|
|
cursor: "pointer",
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: isTablet ? "space-between" : "center",
|
|
|
|
|
width: isTablet ? "100%" : "100px",
|
|
|
|
|
background: "#F2F3F7",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
{isTablet && isNew ? (
|
|
|
|
|
<>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
background: "#FB5607",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
width: "77px",
|
|
|
|
|
height: "36px",
|
|
|
|
|
color: "white",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Новая
|
|
|
|
|
</Typography>
|
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
|
|
|
<IconButton onClick={onClickDelete}>
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<DeleteIcon
|
|
|
|
|
color="#4D4D4D"
|
|
|
|
|
fontSize="34px"
|
|
|
|
|
/>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</IconButton>
|
|
|
|
|
</Box>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<IconButton onClick={onClickDelete}>
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<DeleteIcon
|
|
|
|
|
color="#4D4D4D"
|
|
|
|
|
fontSize="34px"
|
|
|
|
|
/>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</IconButton>
|
|
|
|
|
)}
|
2024-01-20 10:27:21 +00:00
|
|
|
|
</Box>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
|
2024-03-25 15:56:01 +00:00
|
|
|
|
{isOpen && (
|
2024-01-20 10:27:21 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
maxWidth: isTablet ? "450px" : "auto",
|
|
|
|
|
width: "100%",
|
|
|
|
|
boxShadow:
|
|
|
|
|
"0px 2.767px 8.551px 0px rgba(210, 208, 225, 0.07), 0px 6.65px 20.549px 0px rgba(210, 208, 225, 0.10), 0px 12.522px 38.692px 0px rgba(210, 208, 225, 0.12), 0px 22.336px 69.019px 0px rgba(210, 208, 225, 0.14), 0px 41.778px 129.093px 0px rgba(210, 208, 225, 0.17), 0px 100px 309px 0px rgba(210, 208, 225, 0.24)",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
p: "20px",
|
|
|
|
|
borderTop: "1px solid #F1F2F6",
|
|
|
|
|
background: "#FFF",
|
|
|
|
|
borderRadius: "0 0 12px 12px",
|
2024-01-20 10:27:21 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#9A9AAF" }}>Ответы</Typography>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
</Box>
|
|
|
|
|
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: isTablet ? "0" : "149px",
|
|
|
|
|
p: "20px",
|
|
|
|
|
flexDirection: isTablet ? "column" : "-moz-initial",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-02-10 23:45:14 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "15px",
|
2024-03-25 15:56:01 +00:00
|
|
|
|
mt: "20px",
|
2024-02-10 23:45:14 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
{resultsAnswer.map((answer, id) => {
|
|
|
|
|
let titleQuestion;
|
|
|
|
|
let typeOuestion;
|
|
|
|
|
let typeQuestionFile;
|
2024-07-05 19:22:27 +00:00
|
|
|
|
let qid
|
2024-03-25 15:56:01 +00:00
|
|
|
|
let quest = questions; //массив с вопросами
|
|
|
|
|
let i;
|
|
|
|
|
let idAnswer = answer.question_id; //айди вопроса у ответа
|
|
|
|
|
for (i in quest) {
|
|
|
|
|
if (quest[i].backendId === idAnswer) {
|
|
|
|
|
titleQuestion = quest[i].title;
|
|
|
|
|
typeOuestion = quest[i].type;
|
|
|
|
|
typeQuestionFile = quest[i].content.type;
|
2024-07-05 19:22:27 +00:00
|
|
|
|
qid = quest[i].backendId
|
2024-03-25 15:56:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<Box
|
2024-03-26 11:08:40 +00:00
|
|
|
|
key={answer.id}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
gap: "13px",
|
|
|
|
|
}}
|
2024-07-05 16:30:02 +00:00
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
>
|
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#9A9AAF" }}>
|
|
|
|
|
{id + 1}. {titleQuestion}.
|
|
|
|
|
</Typography>
|
|
|
|
|
{typeOuestion === "file" && (
|
|
|
|
|
<Link
|
|
|
|
|
download
|
2024-07-05 19:22:27 +00:00
|
|
|
|
href={timewebContentFile(quiz?.qid, answer.content, qid)}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
style={{
|
|
|
|
|
color: "#7E2AEA",
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "10px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-07-05 19:22:27 +00:00
|
|
|
|
{typeQuestionFile === "video" && answer.content && (
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<video
|
2024-07-05 19:22:27 +00:00
|
|
|
|
src={timewebContentFile(quiz?.qid, answer.content, qid)}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
width={40}
|
|
|
|
|
height={40}
|
|
|
|
|
></video>
|
|
|
|
|
)}
|
2024-07-05 19:22:27 +00:00
|
|
|
|
{typeQuestionFile === "picture" && answer.content && (
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<img
|
2024-07-05 19:22:27 +00:00
|
|
|
|
src={timewebContentFile(quiz?.qid, answer.content, qid)}
|
2024-06-19 20:22:37 +00:00
|
|
|
|
width={40}
|
|
|
|
|
height={40}
|
|
|
|
|
/>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
)}
|
|
|
|
|
клик для скачивания
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
2024-07-05 19:22:27 +00:00
|
|
|
|
{(typeOuestion === "images" || typeOuestion === "varimg") && answer.content && (
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<>
|
|
|
|
|
<img
|
|
|
|
|
width={40}
|
|
|
|
|
height={40}
|
2024-07-05 19:22:27 +00:00
|
|
|
|
src={timewebContent(quiz?.qid, answer.content, qid)}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
/>
|
|
|
|
|
|
2024-07-05 16:30:02 +00:00
|
|
|
|
{/* <Typography sx={{ fontSize: "18px" }}>{answer.content.split("<")[0]}</Typography> */}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</>
|
|
|
|
|
)}
|
2024-06-19 20:22:37 +00:00
|
|
|
|
{!(typeOuestion === "file" || typeOuestion === "images" || typeOuestion === "varimg") && (
|
|
|
|
|
<Typography sx={{ fontSize: "18px" }}>{answer.content}</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
p: "20px",
|
|
|
|
|
borderTop: "1px solid #F1F2F6",
|
|
|
|
|
background: "#FFF",
|
|
|
|
|
borderRadius: "0 0 12px 12px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", color: "#9A9AAF" }}>Результаты</Typography>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
{questionsResultState.map((res) => {
|
|
|
|
|
return (
|
|
|
|
|
<Box
|
2024-03-26 11:08:40 +00:00
|
|
|
|
key={res.id}
|
2024-02-11 19:21:12 +00:00
|
|
|
|
sx={{
|
2024-03-25 15:56:01 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "15px",
|
|
|
|
|
p: "20px",
|
2024-02-11 19:21:12 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-03-25 15:56:01 +00:00
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "18px",
|
|
|
|
|
fontWeight: "500",
|
|
|
|
|
wordBreak: "break-word",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{res.description}
|
|
|
|
|
</Typography>
|
2024-06-19 20:22:37 +00:00
|
|
|
|
<Typography sx={{ fontSize: "18px", wordBreak: "break-word" }}>{res.title}</Typography>
|
|
|
|
|
{res.content.useImage && res.content.back && res.content.back !== " " && (
|
|
|
|
|
<img
|
|
|
|
|
src={res.content.back}
|
|
|
|
|
style={{ width: "40px", height: "40px" }}
|
|
|
|
|
alt={""}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{!res.content.useImage && res.content.back && res.content.back !== " " && (
|
|
|
|
|
<video
|
|
|
|
|
src={res.content.back}
|
|
|
|
|
style={{ width: "40px", height: "40px" }}
|
|
|
|
|
></video>
|
|
|
|
|
)}
|
2024-03-25 15:56:01 +00:00
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
<DeleteModal
|
|
|
|
|
openDelete={openDelete}
|
|
|
|
|
handleClose={() => setOpenDelete(false)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
deleteResult(Number(idResult));
|
|
|
|
|
setOpenDelete(false);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
2024-01-20 10:27:21 +00:00
|
|
|
|
);
|
|
|
|
|
};
|
2024-07-05 16:30:02 +00:00
|
|
|
|
|
2024-07-05 19:22:27 +00:00
|
|
|
|
function timewebContentFile(editQuizId: string, content: string, qid: string) {
|
2024-07-05 16:30:02 +00:00
|
|
|
|
if (content.includes("<img")) {
|
|
|
|
|
//Старая версия: контент лежит в теге
|
|
|
|
|
//<img style="width:100%; max-width:250px; max-height:250px" src="https://s3.timeweb.cloud/3c580be9-30c7959dc17b/squizimages/03520c507b35e8/cq39gn7o73evdd30"/>
|
|
|
|
|
return content.split("<")[1].split('src="')[1].split('"/>')[0]
|
|
|
|
|
}
|
|
|
|
|
//Новая версия: контент просто записан с указанием расширения файла
|
2024-07-05 19:22:27 +00:00
|
|
|
|
return `https://s3.timeweb.cloud/3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b/squizanswer/${editQuizId}/${qid}/${content}`
|
|
|
|
|
}
|
|
|
|
|
function timewebContent(editQuizId: string, content: string, qid: string) {
|
|
|
|
|
if (content.includes("<img")) {
|
|
|
|
|
//Старая версия: контент лежит в теге
|
|
|
|
|
//<img style="width:100%; max-width:250px; max-height:250px" src="https://s3.timeweb.cloud/3c580be9-30c7959dc17b/squizimages/03520c507b35e8/cq39gn7o73evdd30"/>
|
|
|
|
|
return content.split("<")[1].split('src="')[1].split('"/>')[0]
|
|
|
|
|
}
|
2024-07-19 22:28:50 +00:00
|
|
|
|
if (content.includes(`"Image"`)) {
|
|
|
|
|
const data = JSON.parse(content)
|
|
|
|
|
return data.Image
|
|
|
|
|
}
|
|
|
|
|
//Новая версия: контент просто записан с указанием расширения файла(устарело)
|
2024-07-05 19:22:27 +00:00
|
|
|
|
return `https://s3.timeweb.cloud/3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b/squizimages/${editQuizId}/${content}`
|
2024-07-05 16:30:02 +00:00
|
|
|
|
}
|