кнопки логики ветвления исчезают и пропадают там где нужно
This commit is contained in:
parent
04a195ab0e
commit
b8eaa5208c
@ -13,11 +13,13 @@ import { deleteTimeoutedQuestions } from "@utils/deleteTimeoutedQuestions";
|
|||||||
interface Props {
|
interface Props {
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
|
widthMain: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QuestionSwitchWindowTool = ({
|
export const QuestionSwitchWindowTool = ({
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
|
widthMain,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { questions } = useQuestionsStore.getState();
|
const { questions } = useQuestionsStore.getState();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -54,6 +56,7 @@ export const QuestionSwitchWindowTool = ({
|
|||||||
<SwitchBranchingPanel
|
<SwitchBranchingPanel
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={openBranchingPageHC}
|
setOpenBranchingPage={openBranchingPageHC}
|
||||||
|
widthMain={widthMain}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -32,11 +32,13 @@ import { useNavigate } from "react-router-dom";
|
|||||||
interface Props {
|
interface Props {
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
|
widthMain: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function QuestionsPage({
|
export default function QuestionsPage({
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
|
widthMain,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { openedModalSettingsId } = useUiTools();
|
const { openedModalSettingsId } = useUiTools();
|
||||||
@ -86,6 +88,7 @@ export default function QuestionsPage({
|
|||||||
<QuestionSwitchWindowTool
|
<QuestionSwitchWindowTool
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
widthMain={widthMain}
|
||||||
/>
|
/>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@ -12,19 +12,20 @@ import { PanelSwitchQuestionListGraph } from "@ui_kit/Toolbars/PanelSwitchQuesti
|
|||||||
interface Props {
|
interface Props {
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: () => void;
|
setOpenBranchingPage: () => void;
|
||||||
|
widthMain: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SwitchBranchingPanel = ({
|
export const SwitchBranchingPanel = ({
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
|
widthMain,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1446));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1446));
|
||||||
|
|
||||||
return openBranchingPage ? (
|
return openBranchingPage ? (
|
||||||
<Box sx={{ userSelect: "none", maxWidth: "350px", width: "100%" }}>
|
<Box sx={{ userSelect: "none", maxWidth: "350px", width: "100%" }}>
|
||||||
{isTablet || (
|
{widthMain > 1216 && (
|
||||||
<PanelSwitchQuestionListGraph
|
<PanelSwitchQuestionListGraph
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import Sidebar from "@ui_kit/Sidebar/Sidebar";
|
|||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { useTheme, useMediaQuery, IconButton } from "@mui/material";
|
import { useTheme, useMediaQuery, IconButton } from "@mui/material";
|
||||||
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { SidebarMobile } from "../ui_kit/Sidebar/SidebarMobile";
|
import { SidebarMobile } from "../ui_kit/Sidebar/SidebarMobile";
|
||||||
import { setShowConfirmLeaveModal } from "@root/uiTools/actions";
|
import { setShowConfirmLeaveModal } from "@root/uiTools/actions";
|
||||||
import { setCurrentStep, setQuizes } from "@root/quizes/actions";
|
import { setCurrentStep, setQuizes } from "@root/quizes/actions";
|
||||||
@ -65,7 +65,8 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
|
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
||||||
const isMobileSm = useMediaQuery(theme.breakpoints.down(370));
|
const isMobileSm = useMediaQuery(theme.breakpoints.down(370));
|
||||||
const isBranchingLogic = useMediaQuery(theme.breakpoints.down(1100));
|
const isBranchingLogicSmall = useMediaQuery(theme.breakpoints.down(1100));
|
||||||
|
const isBranchingLogicBig = useMediaQuery(theme.breakpoints.down(1446));
|
||||||
const isLinkButton = useMediaQuery(theme.breakpoints.down(708));
|
const isLinkButton = useMediaQuery(theme.breakpoints.down(708));
|
||||||
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
||||||
const [nextStep, setNextStep] = useState<number>(0);
|
const [nextStep, setNextStep] = useState<number>(0);
|
||||||
@ -94,6 +95,21 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
setCurrentStep(index);
|
setCurrentStep(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [widthMain, setWidthMain] = useState(null);
|
||||||
|
const mainBlock = useRef(0);
|
||||||
|
|
||||||
|
const observer = useRef(
|
||||||
|
new ResizeObserver((entries) => {
|
||||||
|
const { width } = entries[0].contentRect;
|
||||||
|
setWidthMain(width);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
observer.current.observe(mainBlock.current);
|
||||||
|
}, [mainBlock, observer]);
|
||||||
|
console.log(widthMain);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header setMobileSidebar={setMobileSidebar} />
|
<Header setMobileSidebar={setMobileSidebar} />
|
||||||
@ -125,6 +141,7 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
|
ref={mainBlock}
|
||||||
sx={{
|
sx={{
|
||||||
background: theme.palette.background.default,
|
background: theme.palette.background.default,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@ -135,6 +152,7 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
<Page
|
<Page
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={openBranchingPageHC}
|
setOpenBranchingPage={openBranchingPageHC}
|
||||||
|
widthMain={widthMain}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@ -157,17 +175,19 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isConditionMet &&
|
{isConditionMet &&
|
||||||
(isBranchingLogic ? (
|
(isBranchingLogicSmall ? (
|
||||||
<SmallSwitchQuestionListGraph
|
<SmallSwitchQuestionListGraph
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={openBranchingPageHC}
|
setOpenBranchingPage={openBranchingPageHC}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : widthMain < 1216 || !openBranchingPage ? (
|
||||||
<PanelSwitchQuestionListGraph
|
<PanelSwitchQuestionListGraph
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={openBranchingPageHC}
|
setOpenBranchingPage={openBranchingPageHC}
|
||||||
hideText
|
hideText
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
))}
|
))}
|
||||||
{/* Кнопка тестового просмотра */}
|
{/* Кнопка тестового просмотра */}
|
||||||
<ButtonTestPublication />
|
<ButtonTestPublication />
|
||||||
|
|||||||
@ -45,10 +45,12 @@ import { checkQuestionHint } from "@utils/checkQuestionHint";
|
|||||||
interface Props {
|
interface Props {
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
|
widthMain: number;
|
||||||
}
|
}
|
||||||
export default function EditPage({
|
export default function EditPage({
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
|
widthMain,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const { editQuizId } = useQuizStore();
|
const { editQuizId } = useQuizStore();
|
||||||
@ -148,6 +150,7 @@ export default function EditPage({
|
|||||||
quizStartPageType={quizConfig.startpageType}
|
quizStartPageType={quizConfig.startpageType}
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
widthMain={widthMain}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ interface Props {
|
|||||||
quizResults: QuizResultsType;
|
quizResults: QuizResultsType;
|
||||||
openBranchingPage: boolean;
|
openBranchingPage: boolean;
|
||||||
setOpenBranchingPage: (a: boolean) => void;
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
|
widthMain: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SwitchStepPages({
|
export default function SwitchStepPages({
|
||||||
@ -30,6 +31,7 @@ export default function SwitchStepPages({
|
|||||||
quizResults,
|
quizResults,
|
||||||
openBranchingPage,
|
openBranchingPage,
|
||||||
setOpenBranchingPage,
|
setOpenBranchingPage,
|
||||||
|
widthMain,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
switch (activeStep) {
|
switch (activeStep) {
|
||||||
case 0: {
|
case 0: {
|
||||||
@ -44,6 +46,7 @@ export default function SwitchStepPages({
|
|||||||
<QuestionsPage
|
<QuestionsPage
|
||||||
openBranchingPage={openBranchingPage}
|
openBranchingPage={openBranchingPage}
|
||||||
setOpenBranchingPage={setOpenBranchingPage}
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
widthMain={widthMain}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user