копирование ссылки на квиз в буфер, кнопки теста и старт стоп и мелкие правки по дизайну
This commit is contained in:
parent
e7537d5206
commit
52940e60a5
@ -67,6 +67,13 @@ export default function InstallQuiz() {
|
|||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
|
||||||
|
const CopyLink = () => {
|
||||||
|
let text = document.getElementById("inputLink");
|
||||||
|
text.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ marginTop: "60px", display: "flex", gap: "40px" }}>
|
<Box sx={{ marginTop: "60px", display: "flex", gap: "40px" }}>
|
||||||
@ -199,7 +206,8 @@ export default function InstallQuiz() {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl fullWidth variant="standard" sx={{ p: 0 }}>
|
<FormControl fullWidth variant="standard" sx={{ p: 0 }}>
|
||||||
<TextField
|
<TextField
|
||||||
value=""
|
value={quiz.qid}
|
||||||
|
id={"inputLink"}
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="6235840cc71"
|
placeholder="6235840cc71"
|
||||||
sx={{
|
sx={{
|
||||||
@ -219,7 +227,13 @@ export default function InstallQuiz() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<CopyIcon color={theme.palette.brightPurple.main} bgcolor={"#EEE4FC"} marL={"10px"} />
|
<IconButton
|
||||||
|
onClick={CopyLink}
|
||||||
|
id={"copyLink"}
|
||||||
|
sx={{borderRadius: "6px"}}>
|
||||||
|
<CopyIcon color={theme.palette.brightPurple.main} bgcolor={"#EEE4FC"} />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export const BranchingQuestionsModal = ({
|
|||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
overflow: "hidden",
|
overflow: "auto",
|
||||||
top: "50%",
|
top: "50%",
|
||||||
left: "50%",
|
left: "50%",
|
||||||
transform: "translate(-50%, -50%)",
|
transform: "translate(-50%, -50%)",
|
||||||
@ -44,6 +44,7 @@ export const BranchingQuestionsModal = ({
|
|||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
boxShadow: 24,
|
boxShadow: 24,
|
||||||
padding: "30px 0",
|
padding: "30px 0",
|
||||||
|
height: "80vh"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ margin: "0 auto", maxWidth: "350px" }}>
|
<Box sx={{ margin: "0 auto", maxWidth: "350px" }}>
|
||||||
|
|||||||
@ -232,6 +232,7 @@ export default function ButtonsOptions({
|
|||||||
// myFunc(question);
|
// myFunc(question);
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
|
display: quiz.config.type === "form" ? "none" : "flex",
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
switchState === value
|
switchState === value
|
||||||
? theme.palette.brightPurple.main
|
? theme.palette.brightPurple.main
|
||||||
|
|||||||
@ -259,6 +259,7 @@ export default function ButtonsOptionsAndPict({
|
|||||||
updateDesireToOpenABranchingModal(question.content.id);
|
updateDesireToOpenABranchingModal(question.content.id);
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
|
display: quiz.config.type === "form" ? "none" : "flex",
|
||||||
height: "30px",
|
height: "30px",
|
||||||
maxWidth: "103px",
|
maxWidth: "103px",
|
||||||
minWidth: isIconMobile ? "30px" : "64px",
|
minWidth: isIconMobile ? "30px" : "64px",
|
||||||
|
|||||||
@ -70,7 +70,7 @@ export default function QuestionsPage() {
|
|||||||
sx={{
|
sx={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
left: isMobile ? "20px" : "250px",
|
left: isMobile ? "20px" : "250px",
|
||||||
bottom: isMobile ? "140px" : "20px",
|
bottom: "140px",
|
||||||
}}
|
}}
|
||||||
data-cy="create-question"
|
data-cy="create-question"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import {
|
|||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { decrementCurrentStep, resetEditConfig, setQuizes } from "@root/quizes/actions";
|
import {decrementCurrentStep, resetEditConfig, setQuizes, updateQuiz} from "@root/quizes/actions";
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
import { useQuizStore } from "@root/quizes/store";
|
import { useQuizStore } from "@root/quizes/store";
|
||||||
import CustomAvatar from "@ui_kit/Header/Avatar";
|
import CustomAvatar from "@ui_kit/Header/Avatar";
|
||||||
@ -27,7 +27,7 @@ import Stepper from "@ui_kit/Stepper";
|
|||||||
import SwitchStepPages from "@ui_kit/switchStepPages";
|
import SwitchStepPages from "@ui_kit/switchStepPages";
|
||||||
import { isAxiosError } from "axios";
|
import { isAxiosError } from "axios";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { SidebarMobile } from "./Sidebar/SidebarMobile";
|
import { SidebarMobile } from "./Sidebar/SidebarMobile";
|
||||||
@ -64,6 +64,7 @@ export default function EditPage() {
|
|||||||
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
||||||
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
||||||
const quizConfig = quiz?.config;
|
const quizConfig = quiz?.config;
|
||||||
|
const disableTest = quiz === undefined ? true : (quiz.config.type === null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editQuizId === null) navigate("/list");
|
if (editQuizId === null) navigate("/list");
|
||||||
@ -184,18 +185,6 @@ export default function EditPage() {
|
|||||||
gap: "15px",
|
gap: "15px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a href={`/view`} target="_blank" rel="noreferrer" style={{ textDecoration: "none" }}>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
sx={{
|
|
||||||
fontSize: "14px",
|
|
||||||
lineHeight: "18px",
|
|
||||||
height: "34px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Опубликовать
|
|
||||||
</Button>
|
|
||||||
</a>
|
|
||||||
<CustomAvatar
|
<CustomAvatar
|
||||||
sx={{
|
sx={{
|
||||||
ml: "11px",
|
ml: "11px",
|
||||||
@ -219,7 +208,7 @@ export default function EditPage() {
|
|||||||
sx={{
|
sx={{
|
||||||
background: theme.palette.background.default,
|
background: theme.palette.background.default,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
padding: isMobile ? "16px 16px 140px 16px" : "25px",
|
padding: isMobile ? "16px 16px 140px 16px" : "25px 25px 140px 25px",
|
||||||
height: "calc(100vh - 80px)",
|
height: "calc(100vh - 80px)",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
@ -238,21 +227,21 @@ export default function EditPage() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
{isTablet && (
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
padding: isMobile ? "20px 16px" : "20px 40px",
|
padding: isMobile ? "20px 16px" : "20px 40px 20px 250px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "flex-end",
|
justifyContent: "flex-start",
|
||||||
|
alignItems: "center",
|
||||||
gap: "15px",
|
gap: "15px",
|
||||||
background: "#FFF",
|
background: "#FFF",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{[1, 2].includes(currentStep) && !openBranchingPanel && (
|
{[1].includes(currentStep) && !openBranchingPanel && quizConfig.type !== "form" && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -312,6 +301,20 @@ export default function EditPage() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
{disableTest ? (
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
disabled
|
||||||
|
sx={{
|
||||||
|
fontSize: "14px",
|
||||||
|
lineHeight: "18px",
|
||||||
|
height: "34px",
|
||||||
|
minWidth: "130px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Тестовый просмотр
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
<a href={`/view`} target="_blank" rel="noreferrer" style={{ textDecoration: "none" }}>
|
<a href={`/view`} target="_blank" rel="noreferrer" style={{ textDecoration: "none" }}>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@ -322,11 +325,30 @@ export default function EditPage() {
|
|||||||
minWidth: "130px",
|
minWidth: "130px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Опубликовать
|
Тестовый просмотр
|
||||||
</Button>
|
</Button>
|
||||||
</a>
|
</a>
|
||||||
</Box>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
sx={{
|
||||||
|
fontSize: "14px",
|
||||||
|
lineHeight: "18px",
|
||||||
|
height: "34px",
|
||||||
|
border: `1px solid ${theme.palette.brightPurple.main}`,
|
||||||
|
backgroundColor: quiz?.status === "start" ? theme.palette.brightPurple.main : "transparent",
|
||||||
|
color: quiz?.status === "start" ? "#FFFFFF" : theme.palette.brightPurple.main,
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
updateQuiz(
|
||||||
|
quiz?.id, (state) => {
|
||||||
|
state.status = quiz?.status === "start" ? "stop" : "start"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
>{quiz?.status === "start" ? "Стоп" : "Старт"}</Button>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -92,16 +92,6 @@ export default function Header() {
|
|||||||
gap: "15px",
|
gap: "15px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
sx={{
|
|
||||||
fontSize: "14px",
|
|
||||||
lineHeight: "18px",
|
|
||||||
height: "34px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Опубликовать
|
|
||||||
</Button>
|
|
||||||
<CustomAvatar
|
<CustomAvatar
|
||||||
sx={{ ml: "11px", backgroundColor: theme.palette.orange.main, height: "36px", width: "36px" }}
|
sx={{ ml: "11px", backgroundColor: theme.palette.orange.main, height: "36px", width: "36px" }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -5,11 +5,12 @@ interface Props {
|
|||||||
icon: any;
|
icon: any;
|
||||||
text: string;
|
text: string;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
isCollapsed: boolean;
|
isCollapsed: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MenuItem({ icon, text, isActive = false, isCollapsed, onClick }: Props) {
|
export default function MenuItem({ icon, text, isActive = false, isCollapsed, onClick, disabled = false }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -22,6 +23,7 @@ export default function MenuItem({ icon, text, isActive = false, isCollapsed, on
|
|||||||
>
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
disabled={disabled}
|
||||||
sx={{
|
sx={{
|
||||||
py: "4px",
|
py: "4px",
|
||||||
gap: "14px",
|
gap: "14px",
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { setCurrentStep } from "@root/quizes/actions";
|
|||||||
import { useQuizStore } from "@root/quizes/store";
|
import { useQuizStore } from "@root/quizes/store";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import MenuItem from "./MenuItem";
|
import MenuItem from "./MenuItem";
|
||||||
|
import {useCurrentQuiz} from "@root/quizes/hooks";
|
||||||
|
|
||||||
|
|
||||||
const quizSettingsMenuItems = [
|
const quizSettingsMenuItems = [
|
||||||
@ -28,6 +29,8 @@ export default function Sidebar() {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [isMenuCollapsed, setIsMenuCollapsed] = useState(false);
|
const [isMenuCollapsed, setIsMenuCollapsed] = useState(false);
|
||||||
const currentStep = useQuizStore(state => state.currentStep);
|
const currentStep = useQuizStore(state => state.currentStep);
|
||||||
|
const quiz = useCurrentQuiz();
|
||||||
|
|
||||||
|
|
||||||
const handleMenuCollapseToggle = () => setIsMenuCollapsed((prev) => !prev);
|
const handleMenuCollapseToggle = () => setIsMenuCollapsed((prev) => !prev);
|
||||||
|
|
||||||
@ -94,6 +97,7 @@ export default function Sidebar() {
|
|||||||
text={menuItem.sidebarText}
|
text={menuItem.sidebarText}
|
||||||
isCollapsed={isMenuCollapsed}
|
isCollapsed={isMenuCollapsed}
|
||||||
isActive={currentStep === index}
|
isActive={currentStep === index}
|
||||||
|
disabled={index===0 ? false : quiz===undefined ? true : (quiz?.config.type === null)}
|
||||||
icon={
|
icon={
|
||||||
<Icon
|
<Icon
|
||||||
color={
|
color={
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user