Merge branch 'fix-date' into 'main'

Fix date

See merge request frontend/squzanswerer!24
This commit is contained in:
Nastya 2024-01-10 13:55:46 +00:00
commit 919bfcce96
7 changed files with 55 additions and 32 deletions

@ -6,6 +6,14 @@ body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/*скрывает все скролл-бары*/
body * {
-ms-overflow-style: none;
scrollbar-width: none;
}
body * ::-webkit-scrollbar {
display: none;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',

@ -135,6 +135,9 @@ export const ContactForm = ({
backgroundColor: theme.palette.background.default,
height: "100vh",
overflow: "auto",
"&::-webkit-scrollbar": { width: "0", display: "none", msOverflowStyle: "none" },
scrollbarWidth: "none",
msOverflowStyle: "none"
}}
>
<Box

@ -222,7 +222,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
if (nextQuestion && nextQuestion.type !== "result") {
setCurrentQuestion(nextQuestion);
} else {
showResult(nextQuestion);
showResult(items.find(q => q.content.rule.parentId === "line"));
}
return;

@ -67,7 +67,7 @@ export const ResultForm = ({
flexDirection: "column",
alignItems: "center",
justifyContent: "space-between",
height: isMobile ? undefined : "100vh",
height: "100vh",
width: "100vw",
pt: "28px",
overflow: "auto"

@ -18,7 +18,7 @@ const QID =
process.env.NODE_ENV === "production" ?
window.location.pathname.replace(/\//g, '')
:
"2363ad2c-0c19-4f51-80c0-ed2242daa0c4"
"9fafc6c9-6ccf-42b6-b400-0ee9f5f0fa16"
export const ViewPage = () => {

@ -9,7 +9,7 @@ import type { QuizQuestionDate } from "../../../model/questionTypes/date";
import CalendarIcon from "@icons/CalendarIcon";
import { enqueueSnackbar } from "notistack";
import { sendAnswer } from "@api/quizRelase";
import { useQuestionsStore } from "@root/quizData/store"
import { useQuestionsStore } from "@root/quizData/store";
type DateProps = {
currentQuestion: QuizQuestionDate;
@ -19,7 +19,7 @@ export const Date = ({ currentQuestion }: DateProps) => {
const theme = useTheme();
const mode = modes;
const { settings } = useQuestionsStore()
const { settings } = useQuestionsStore();
const { answers } = useQuizViewStore();
const answer = answers.find(
({ questionId }) => questionId === currentQuestion.id
@ -28,7 +28,9 @@ export const Date = ({ currentQuestion }: DateProps) => {
return (
<Box>
<Typography variant="h5" color={theme.palette.text.primary}>{currentQuestion.title}</Typography>
<Typography variant="h5" color={theme.palette.text.primary}>
{currentQuestion.title}
</Typography>
<Box
sx={{
display: "flex",
@ -40,13 +42,17 @@ export const Date = ({ currentQuestion }: DateProps) => {
<DatePicker
slots={{
//@ts-ignore
openPickerIcon: () => <CalendarIcon sx={{
"& path": {stroke: theme.palette.primary.main},
"& rect": {stroke: theme.palette.primary.main}
}} />,
openPickerIcon: () => (
<CalendarIcon
sx={{
"& path": { stroke: theme.palette.primary.main },
"& rect": { stroke: theme.palette.primary.main },
}}
/>
),
}}
value={dayjs(
answer
month && day && year
? new window.Date(`${month}.${day}.${year}`)
: new window.Date()
)}
@ -54,19 +60,22 @@ export const Date = ({ currentQuestion }: DateProps) => {
if (!date) {
return;
}
try {
await sendAnswer({
questionId: currentQuestion.id,
body: new window.Date(date.toDate()).toLocaleDateString("ru-RU", {
year: "numeric",
month: "2-digit",
day: "2-digit",
}),
body: new window.Date(date.toDate()).toLocaleDateString(
"ru-RU",
{
year: "numeric",
month: "2-digit",
day: "2-digit",
}
),
//@ts-ignore
qid: settings.qid
})
qid: settings.qid,
});
updateAnswer(
currentQuestion.id,
String(
@ -78,9 +87,8 @@ export const Date = ({ currentQuestion }: DateProps) => {
)
);
} catch (e) {
enqueueSnackbar("ответ не был засчитан")
enqueueSnackbar("ответ не был засчитан");
}
}}
slotProps={{
openPickerButton: {
@ -89,14 +97,15 @@ export const Date = ({ currentQuestion }: DateProps) => {
},
"data-cy": "open-datepicker",
},
layout: {
sx: {backgroundColor: theme.palette.background.default,}
}
layout: {
sx: { backgroundColor: theme.palette.background.default },
},
}}
sx={{
"& .MuiInputBase-root": {
backgroundColor: mode[settings.cfg.theme] ? "white" : theme.palette.background.default,
backgroundColor: mode[settings.cfg.theme]
? "white"
: theme.palette.background.default,
borderRadius: "10px",
maxWidth: "250px",
pr: "22px",
@ -109,11 +118,9 @@ export const Date = ({ currentQuestion }: DateProps) => {
borderColor: "#9A9AAF",
},
},
}}
/>
</Box>
</Box>
);
};
};

@ -112,10 +112,14 @@ export const Select = ({
inputProps={{
sx: {
color: colorMain,
display: "flex",
alignItems: "center",
display: "block",
px: "9px",
gap: "20px",
"& .MuiTypography-root": {
overflow: "hidden",
textOverflow: "ellipsis",
}
},
}}
IconComponent={(props) => <ArrowDown {...props} />}
@ -131,6 +135,7 @@ export const Select = ({
padding: "10px",
borderRadius: "5px",
color: colorPlaceholder,
whiteSpace: "normal"
}}
>
{item}