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