fix:переключение логики ветвления после переделки main

This commit is contained in:
Tamara 2024-01-04 14:00:13 +03:00
parent 97b2d3ac97
commit d35b65fc05
4 changed files with 20 additions and 10 deletions

@ -103,14 +103,14 @@ dayjs.locale("ru");
const routeslink = [ const routeslink = [
{ {
path: "/edit", path: "/edit",
page: <EditPage />, page: EditPage,
header: true, header: true,
sidebar: true, sidebar: true,
footer: true, footer: true,
}, },
{ {
path: "/design", path: "/design",
page: <DesignPage />, page: DesignPage,
header: true, header: true,
sidebar: true, sidebar: true,
footer: true, footer: true,
@ -200,7 +200,7 @@ export default function App() {
path={e.path} path={e.path}
element={ element={
<Main <Main
page={e.page} Page={e.page}
header={e.header} header={e.header}
sidebar={e.sidebar} sidebar={e.sidebar}
footer={e.footer} footer={e.footer}

@ -9,9 +9,9 @@ export const BackButtonIcon = () => (
<path <path
d="M7.86747 18C8.26104 18 9.9253 18 13.4337 18C17.8193 18 19 14.703 19 13.2194C19 11.7358 17.8193 8.93333 13.4337 8.93333C10.1773 8.93333 6.59726 8.93333 5 8.93333M5 8.93333L7.86747 6M5 8.93333L7.86747 11.8182" d="M7.86747 18C8.26104 18 9.9253 18 13.4337 18C17.8193 18 19 14.703 19 13.2194C19 11.7358 17.8193 8.93333 13.4337 8.93333C10.1773 8.93333 6.59726 8.93333 5 8.93333M5 8.93333L7.86747 6M5 8.93333L7.86747 11.8182"
stroke="white" stroke="white"
stroke-width="1.5" strokeWidth="1.5"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
/> />
</svg> </svg>
); );

@ -27,7 +27,7 @@ interface Props {
sidebar: boolean; sidebar: boolean;
header?: boolean; header?: boolean;
footer?: boolean; footer?: boolean;
Page: JSX.Element; Page?: React.Component;
} }
export default function Main({ sidebar, header, footer, Page }: Props) { export default function Main({ sidebar, header, footer, Page }: Props) {
@ -132,7 +132,10 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
boxSizing: "border-box", boxSizing: "border-box",
}} }}
> >
<Page state={openBranchingPage} HC={openBranchingPageHC} /> <Page
openBranchingPage={openBranchingPage}
setOpenBranchingPage={openBranchingPageHC}
/>
</Box> </Box>
{footer && ( {footer && (

@ -42,7 +42,14 @@ import { ModalInfoWhyCantCreate } from "./ModalInfoWhyCantCreate";
import { ConfirmLeaveModal } from "./ConfirmLeaveModal"; import { ConfirmLeaveModal } from "./ConfirmLeaveModal";
import { checkQuestionHint } from "@utils/checkQuestionHint"; import { checkQuestionHint } from "@utils/checkQuestionHint";
export default function EditPage() { interface Props {
openBranchingPage: boolean;
setOpenBranchingPage: (a: boolean) => void;
}
export default function EditPage({
openBranchingPage,
setOpenBranchingPage,
}: Props) {
const quiz = useCurrentQuiz(); const quiz = useCurrentQuiz();
const { editQuizId } = useQuizStore(); const { editQuizId } = useQuizStore();
const { questions } = useQuestionsStore(); const { questions } = useQuestionsStore();
@ -55,7 +62,7 @@ export default function EditPage() {
const isMobile = useMediaQuery(theme.breakpoints.down(660)); const isMobile = useMediaQuery(theme.breakpoints.down(660));
const [nextStep, setNextStep] = useState<number>(0); const [nextStep, setNextStep] = useState<number>(0);
const quizConfig = quiz?.config; const quizConfig = quiz?.config;
const [openBranchingPage, setOpenBranchingPage] = useState<boolean>(false); // const [openBranchingPage, setOpenBranchingPage] = useState<boolean>(false);
useEffect(() => { useEffect(() => {
if (editQuizId === null) navigate("/list"); if (editQuizId === null) navigate("/list");