Merge branch 'fixes' into 'main'

инпут ползунка не принимает буквы

See merge request frontend/squiz!112
This commit is contained in:
Nastya 2024-01-05 17:15:01 +00:00
commit 2300194038
4 changed files with 5 additions and 10 deletions

@ -221,7 +221,7 @@ export const Footer = ({
const questionIndex = questions.findIndex(({ id }) => id === question.id); const questionIndex = questions.findIndex(({ id }) => id === question.id);
const previousQuestion = questions[questionIndex - 1]; const previousQuestion = questions[questionIndex - 1];
followPreviousStep
if (previousQuestion) { if (previousQuestion) {
setCurrentQuestion(previousQuestion); setCurrentQuestion(previousQuestion);
} }

@ -1,19 +1,14 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Box, Button, ThemeProvider, useTheme } from "@mui/material"; import { Box, ThemeProvider, useTheme } from "@mui/material";
import { StartPageViewPublication } from "./StartPageViewPublication"; import { StartPageViewPublication } from "./StartPageViewPublication";
import { Question } from "./Question"; import { Question } from "./Question";
import { useQuestions } from "@root/questions/hooks";
import { useCurrentQuiz } from "@root/quizes/hooks"; import { useCurrentQuiz } from "@root/quizes/hooks";
import useSWR from "swr";
import { quizApi } from "@api/quiz"; import { quizApi } from "@api/quiz";
import { setQuizes, updateQuiz } from "@root/quizes/actions"; import { setQuizes, updateQuiz } from "@root/quizes/actions";
import { isAxiosError } from "axios";
import { devlog } from "@frontend/kitui";
import { useQuizStore } from "@root/quizes/store"; import { useQuizStore } from "@root/quizes/store";
import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared"; import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared";
import { enqueueSnackbar } from "notistack";
import { useQuestionsStore } from "@root/questions/store"; import { useQuestionsStore } from "@root/questions/store";
import { setQuestions } from "@root/questions/actions"; import { setQuestions } from "@root/questions/actions";
import { questionApi } from "@api/question"; import { questionApi } from "@api/question";

@ -122,7 +122,7 @@ export const Number = ({ currentQuestion }: NumberProps) => {
onChange={({ target }) => { onChange={({ target }) => {
updateAnswer( updateAnswer(
currentQuestion.content.id, currentQuestion.content.id,
window.Number(target.value) > max window.Number(target.value.replace (/\D/, '')) > max
? String(max) ? String(max)
: window.Number(target.value) < min : window.Number(target.value) < min
? String(min) ? String(min)
@ -155,7 +155,7 @@ export const Number = ({ currentQuestion }: NumberProps) => {
placeholder="0" placeholder="0"
value={minRange} value={minRange}
onChange={({ target }) => { onChange={({ target }) => {
setMinRange(target.value); setMinRange(target.value.replace (/\D/, ''));
if (window.Number(target.value) >= window.Number(maxRange)) { if (window.Number(target.value) >= window.Number(maxRange)) {
updateMinRangeDebounced(`${maxRange}${maxRange}`, true); updateMinRangeDebounced(`${maxRange}${maxRange}`, true);
@ -181,7 +181,7 @@ export const Number = ({ currentQuestion }: NumberProps) => {
placeholder="0" placeholder="0"
value={maxRange} value={maxRange}
onChange={({ target }) => { onChange={({ target }) => {
setMaxRange(target.value); setMaxRange(target.value.replace (/\D/, ''));
if (window.Number(target.value) <= window.Number(minRange)) { if (window.Number(target.value) <= window.Number(minRange)) {
updateMaxRangeDebounced(`${minRange}${minRange}`, true); updateMaxRangeDebounced(`${minRange}${minRange}`, true);