превью не учитывает результы
This commit is contained in:
parent
b76d8ee3e9
commit
3bbf8343c2
@ -264,7 +264,12 @@ function CsComponent({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
mb="20px">
|
sx={{
|
||||||
|
mb:"20px",
|
||||||
|
display:'flex',
|
||||||
|
justifyContent:"space-between"
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
height: "27px",
|
height: "27px",
|
||||||
|
|||||||
@ -221,6 +221,12 @@ export default function EditPage() {
|
|||||||
</Link>
|
</Link>
|
||||||
<FormControl fullWidth variant="standard">
|
<FormControl fullWidth variant="standard">
|
||||||
<TextField
|
<TextField
|
||||||
|
value={quiz.name}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
|
quiz.name = e.target.value;
|
||||||
|
})
|
||||||
|
}
|
||||||
fullWidth
|
fullWidth
|
||||||
id="project-name"
|
id="project-name"
|
||||||
placeholder="Название проекта окно"
|
placeholder="Название проекта окно"
|
||||||
@ -459,7 +465,7 @@ export default function EditPage() {
|
|||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
lineHeight: "18px",
|
lineHeight: "18px",
|
||||||
height: "34px",
|
height: "34px",
|
||||||
background: quiz?.status === "start" ? "#7E2AEA" : "#FA5B0E",
|
background: buttonText === "Опубликовано" ? "#FA5B0E" : "#7E2AEA",
|
||||||
}}
|
}}
|
||||||
onClick={handleClickStatusQuiz}
|
onClick={handleClickStatusQuiz}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -7,6 +7,14 @@ import { useLayoutEffect } from "react";
|
|||||||
export const ModalInfoWhyCantCreate = () => {
|
export const ModalInfoWhyCantCreate = () => {
|
||||||
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
|
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
console.log(whyCantCreatePublic)
|
||||||
|
if (Object.values(whyCantCreatePublic).length===0) {
|
||||||
|
console.log("нет проблем")
|
||||||
|
updateModalInfoWhyCantCreate(false)
|
||||||
|
}
|
||||||
|
}, [openModalInfoWhyCantCreate])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal open={openModalInfoWhyCantCreate} onClose={() => updateModalInfoWhyCantCreate(false)}>
|
<Modal open={openModalInfoWhyCantCreate} onClose={() => updateModalInfoWhyCantCreate(false)}>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
@ -285,7 +285,7 @@ export default function StartPageSettings() {
|
|||||||
Изображение
|
Изображение
|
||||||
</Typography>
|
</Typography>
|
||||||
<DropZone
|
<DropZone
|
||||||
text={"5 MB максимум"}
|
value={"5 MB максимум"}
|
||||||
sx={{ maxWidth: "300px" }}
|
sx={{ maxWidth: "300px" }}
|
||||||
imageUrl={quiz.config.startpage.background.desktop}
|
imageUrl={quiz.config.startpage.background.desktop}
|
||||||
originalImageUrl={quiz.config.startpage.background.originalDesktop}
|
originalImageUrl={quiz.config.startpage.background.originalDesktop}
|
||||||
@ -320,7 +320,7 @@ export default function StartPageSettings() {
|
|||||||
>
|
>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="URL видео"
|
placeholder="URL видео"
|
||||||
text={quiz.config.startpage.background.video ?? ""}
|
value={quiz.config.startpage.background.video ?? ""}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.startpage.background.video = e.target.value;
|
quiz.config.startpage.background.video = e.target.value;
|
||||||
@ -396,7 +396,7 @@ export default function StartPageSettings() {
|
|||||||
Логотип
|
Логотип
|
||||||
</Typography>
|
</Typography>
|
||||||
<DropZone
|
<DropZone
|
||||||
text={"5 MB максимум"}
|
value={"5 MB максимум"}
|
||||||
sx={{ maxWidth: "300px" }}
|
sx={{ maxWidth: "300px" }}
|
||||||
imageUrl={quiz.config.startpage.logo}
|
imageUrl={quiz.config.startpage.logo}
|
||||||
originalImageUrl={quiz.config.startpage.originalLogo}
|
originalImageUrl={quiz.config.startpage.originalLogo}
|
||||||
@ -460,7 +460,7 @@ export default function StartPageSettings() {
|
|||||||
Логотип
|
Логотип
|
||||||
</Typography>
|
</Typography>
|
||||||
<DropZone
|
<DropZone
|
||||||
text={"5 MB максимум"}
|
value={"5 MB максимум"}
|
||||||
sx={{ maxWidth: "300px" }}
|
sx={{ maxWidth: "300px" }}
|
||||||
imageUrl={quiz.config.startpage.logo}
|
imageUrl={quiz.config.startpage.logo}
|
||||||
originalImageUrl={quiz.config.startpage.originalLogo}
|
originalImageUrl={quiz.config.startpage.originalLogo}
|
||||||
@ -509,7 +509,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Имя заголовка об опроснике для подбора табуретки"
|
placeholder="Имя заголовка об опроснике для подбора табуретки"
|
||||||
text={quiz.name}
|
value={quiz.name}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.name = e.target.value;
|
quiz.name = e.target.value;
|
||||||
@ -529,7 +529,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Внимательно заполняйте поля ответов"
|
placeholder="Внимательно заполняйте поля ответов"
|
||||||
text={quiz.config.startpage.description}
|
value={quiz.config.startpage.description}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.startpage.description = e.target.value;
|
quiz.config.startpage.description = e.target.value;
|
||||||
@ -549,7 +549,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Начать опрос"
|
placeholder="Начать опрос"
|
||||||
text={quiz.config.startpage.button}
|
value={quiz.config.startpage.button}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.startpage.button = e.target.value;
|
quiz.config.startpage.button = e.target.value;
|
||||||
@ -569,7 +569,8 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="8-800-000-00-00"
|
placeholder="8-800-000-00-00"
|
||||||
text={quiz.config.info.phonenumber}
|
type="number"
|
||||||
|
value={quiz.config.info.phonenumber}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.info.phonenumber = e.target.value;
|
quiz.config.info.phonenumber = e.target.value;
|
||||||
@ -599,7 +600,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Только лучшее"
|
placeholder="Только лучшее"
|
||||||
text={quiz.config.info.orgname}
|
value={quiz.config.info.orgname}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.info.orgname = e.target.value;
|
quiz.config.info.orgname = e.target.value;
|
||||||
@ -619,7 +620,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="https://mysite.com"
|
placeholder="https://mysite.com"
|
||||||
text={quiz.config.info.site}
|
value={quiz.config.info.site}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.info.site = e.target.value;
|
quiz.config.info.site = e.target.value;
|
||||||
@ -639,7 +640,7 @@ export default function StartPageSettings() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CustomTextField
|
<CustomTextField
|
||||||
placeholder="Данные наших документов"
|
placeholder="Данные наших документов"
|
||||||
text={quiz.config.info.law}
|
value={quiz.config.info.law}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateQuiz(quiz.id, (quiz) => {
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
quiz.config.info.law = e.target.value;
|
quiz.config.info.law = e.target.value;
|
||||||
|
|||||||
@ -21,6 +21,7 @@ interface CustomTextFieldProps {
|
|||||||
maxLength?: number;
|
maxLength?: number;
|
||||||
sx?: SxProps<Theme>;
|
sx?: SxProps<Theme>;
|
||||||
InputProps?: Partial<InputProps>;
|
InputProps?: Partial<InputProps>;
|
||||||
|
type?:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function CustomTextField({
|
export default function CustomTextField({
|
||||||
@ -35,6 +36,7 @@ export default function CustomTextField({
|
|||||||
emptyError,
|
emptyError,
|
||||||
InputProps,
|
InputProps,
|
||||||
maxLength = 200,
|
maxLength = 200,
|
||||||
|
type=""
|
||||||
}: CustomTextFieldProps) {
|
}: CustomTextFieldProps) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
@ -47,7 +49,13 @@ export default function CustomTextField({
|
|||||||
|
|
||||||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const inputValue = event.target.value;
|
const inputValue = event.target.value;
|
||||||
setInputValue(inputValue);
|
|
||||||
|
if (type === "number" ) {
|
||||||
|
setInputValue(inputValue .replace (/\D/g, ''));
|
||||||
|
} else {
|
||||||
|
setInputValue(inputValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(event);
|
onChange(event);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export default function QuizPreviewLayout() {
|
|||||||
const questions = useQuestionsStore((state) => state.questions);
|
const questions = useQuestionsStore((state) => state.questions);
|
||||||
const currentQuizStep = useQuizPreviewStore((state) => state.currentQuestionIndex);
|
const currentQuizStep = useQuizPreviewStore((state) => state.currentQuestionIndex);
|
||||||
|
|
||||||
const nonDeletedQuizQuestions = questions.filter((question) => !question.deleted);
|
const nonDeletedQuizQuestions = questions.filter((question) => !question.deleted && question.type !== "result" );
|
||||||
const maxCurrentQuizStep = nonDeletedQuizQuestions.length > 0 ? nonDeletedQuizQuestions.length - 1 : 0;
|
const maxCurrentQuizStep = nonDeletedQuizQuestions.length > 0 ? nonDeletedQuizQuestions.length - 1 : 0;
|
||||||
const currentProgress = Math.floor((currentQuizStep / maxCurrentQuizStep) * 100);
|
const currentProgress = Math.floor((currentQuizStep / maxCurrentQuizStep) * 100);
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ export default function QuizPreviewLayout() {
|
|||||||
}}
|
}}
|
||||||
IconComponent={(props) => <ArrowDownIcon {...props} />}
|
IconComponent={(props) => <ArrowDownIcon {...props} />}
|
||||||
>
|
>
|
||||||
{Object.values(questions).map(({ id, title }, index) => (
|
{Object.values(questions.filter(q=>q.type!=="result")).map(({ id, title }, index) => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={id}
|
key={id}
|
||||||
value={index}
|
value={index}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user