превью не учитывает результы

This commit is contained in:
Nastya 2023-12-28 23:08:41 +03:00
parent b76d8ee3e9
commit 3bbf8343c2
6 changed files with 44 additions and 16 deletions

@ -264,7 +264,12 @@ function CsComponent({
return (
<>
<Box
mb="20px">
sx={{
mb:"20px",
display:'flex',
justifyContent:"space-between"
}}
>
<Button
sx={{
height: "27px",

@ -221,6 +221,12 @@ export default function EditPage() {
</Link>
<FormControl fullWidth variant="standard">
<TextField
value={quiz.name}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.name = e.target.value;
})
}
fullWidth
id="project-name"
placeholder="Название проекта окно"
@ -459,7 +465,7 @@ export default function EditPage() {
fontSize: "14px",
lineHeight: "18px",
height: "34px",
background: quiz?.status === "start" ? "#7E2AEA" : "#FA5B0E",
background: buttonText === "Опубликовано" ? "#FA5B0E" : "#7E2AEA",
}}
onClick={handleClickStatusQuiz}
>

@ -7,6 +7,14 @@ import { useLayoutEffect } from "react";
export const ModalInfoWhyCantCreate = () => {
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
useLayoutEffect(() => {
console.log(whyCantCreatePublic)
if (Object.values(whyCantCreatePublic).length===0) {
console.log("нет проблем")
updateModalInfoWhyCantCreate(false)
}
}, [openModalInfoWhyCantCreate])
return (
<Modal open={openModalInfoWhyCantCreate} onClose={() => updateModalInfoWhyCantCreate(false)}>
<Box

@ -285,7 +285,7 @@ export default function StartPageSettings() {
Изображение
</Typography>
<DropZone
text={"5 MB максимум"}
value={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
imageUrl={quiz.config.startpage.background.desktop}
originalImageUrl={quiz.config.startpage.background.originalDesktop}
@ -320,7 +320,7 @@ export default function StartPageSettings() {
>
<CustomTextField
placeholder="URL видео"
text={quiz.config.startpage.background.video ?? ""}
value={quiz.config.startpage.background.video ?? ""}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.startpage.background.video = e.target.value;
@ -396,7 +396,7 @@ export default function StartPageSettings() {
Логотип
</Typography>
<DropZone
text={"5 MB максимум"}
value={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
imageUrl={quiz.config.startpage.logo}
originalImageUrl={quiz.config.startpage.originalLogo}
@ -460,7 +460,7 @@ export default function StartPageSettings() {
Логотип
</Typography>
<DropZone
text={"5 MB максимум"}
value={"5 MB максимум"}
sx={{ maxWidth: "300px" }}
imageUrl={quiz.config.startpage.logo}
originalImageUrl={quiz.config.startpage.originalLogo}
@ -509,7 +509,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="Имя заголовка об опроснике для подбора табуретки"
text={quiz.name}
value={quiz.name}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.name = e.target.value;
@ -529,7 +529,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="Внимательно заполняйте поля ответов"
text={quiz.config.startpage.description}
value={quiz.config.startpage.description}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.startpage.description = e.target.value;
@ -549,7 +549,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="Начать опрос"
text={quiz.config.startpage.button}
value={quiz.config.startpage.button}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.startpage.button = e.target.value;
@ -569,7 +569,8 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="8-800-000-00-00"
text={quiz.config.info.phonenumber}
type="number"
value={quiz.config.info.phonenumber}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.info.phonenumber = e.target.value;
@ -599,7 +600,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="Только лучшее"
text={quiz.config.info.orgname}
value={quiz.config.info.orgname}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.info.orgname = e.target.value;
@ -619,7 +620,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="https://mysite.com"
text={quiz.config.info.site}
value={quiz.config.info.site}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.info.site = e.target.value;
@ -639,7 +640,7 @@ export default function StartPageSettings() {
</Typography>
<CustomTextField
placeholder="Данные наших документов"
text={quiz.config.info.law}
value={quiz.config.info.law}
onChange={(e) =>
updateQuiz(quiz.id, (quiz) => {
quiz.config.info.law = e.target.value;

@ -21,6 +21,7 @@ interface CustomTextFieldProps {
maxLength?: number;
sx?: SxProps<Theme>;
InputProps?: Partial<InputProps>;
type?:string
}
export default function CustomTextField({
@ -35,6 +36,7 @@ export default function CustomTextField({
emptyError,
InputProps,
maxLength = 200,
type=""
}: CustomTextFieldProps) {
const theme = useTheme();
@ -47,7 +49,13 @@ export default function CustomTextField({
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const inputValue = event.target.value;
if (type === "number" ) {
setInputValue(inputValue .replace (/\D/g, ''));
} else {
setInputValue(inputValue);
}
if (onChange) {
onChange(event);

@ -38,7 +38,7 @@ export default function QuizPreviewLayout() {
const questions = useQuestionsStore((state) => state.questions);
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 currentProgress = Math.floor((currentQuizStep / maxCurrentQuizStep) * 100);
@ -135,7 +135,7 @@ export default function QuizPreviewLayout() {
}}
IconComponent={(props) => <ArrowDownIcon {...props} />}
>
{Object.values(questions).map(({ id, title }, index) => (
{Object.values(questions.filter(q=>q.type!=="result")).map(({ id, title }, index) => (
<MenuItem
key={id}
value={index}