убрала удвоение шапки и сайдбара(нужна доработка)
This commit is contained in:
parent
ea4c238813
commit
f1abade62b
41
src/App.tsx
41
src/App.tsx
@ -101,20 +101,41 @@ export function useUserAccountFetcher({
|
||||
dayjs.locale("ru");
|
||||
|
||||
const routeslink = [
|
||||
{ path: "/list", page: <MyQuizzesFull />, header: false, sidebar: false },
|
||||
{
|
||||
path: "/questions/:quizId",
|
||||
page: <QuestionsPage />,
|
||||
path: "/list",
|
||||
page: <MyQuizzesFull />,
|
||||
header: false,
|
||||
sidebar: false,
|
||||
footer: false,
|
||||
},
|
||||
{
|
||||
path: "/tariffs",
|
||||
page: <Tariffs />,
|
||||
header: true,
|
||||
sidebar: false,
|
||||
footer: false,
|
||||
},
|
||||
{
|
||||
path: "/edit",
|
||||
page: <EditPage />,
|
||||
header: true,
|
||||
sidebar: true,
|
||||
footer: true,
|
||||
},
|
||||
{
|
||||
path: "/view",
|
||||
page: <ViewPage />,
|
||||
header: false,
|
||||
sidebar: false,
|
||||
footer: false,
|
||||
},
|
||||
{
|
||||
path: "/design",
|
||||
page: <DesignPage />,
|
||||
header: true,
|
||||
sidebar: true,
|
||||
footer: true,
|
||||
},
|
||||
{ path: "/contacts", page: <ContactFormPage />, header: true, sidebar: true },
|
||||
{ path: "/result", page: <Result />, header: true, sidebar: true },
|
||||
{ path: "/settings", page: <ResultSettings />, header: true, sidebar: true },
|
||||
{ path: "/tariffs", page: <Tariffs />, header: true, sidebar: false },
|
||||
{ path: "/edit", page: <EditPage />, header: true, sidebar: true },
|
||||
{ path: "/view", page: <ViewPage />, header: false, sidebar: false },
|
||||
{ path: "/design", page: <DesignPage />, header: true, sidebar: true },
|
||||
] as const;
|
||||
|
||||
export default function App() {
|
||||
|
@ -82,13 +82,13 @@ export const DesignPage = () => {
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<Header setMobileSidebar={setMobileSidebar} />
|
||||
{/*<Header setMobileSidebar={setMobileSidebar} />*/}
|
||||
<Box sx={{ display: "flex", flexDirection: isMobile ? "column" : "row" }}>
|
||||
{isMobile ? (
|
||||
<SidebarMobile open={mobileSidebar} changePage={changePage} />
|
||||
) : (
|
||||
<Sidebar changePage={changePage} />
|
||||
)}
|
||||
{/*{isMobile ? (*/}
|
||||
{/* <SidebarMobile open={mobileSidebar} changePage={changePage} />*/}
|
||||
{/*) : (*/}
|
||||
{/* <Sidebar changePage={changePage} />*/}
|
||||
{/*)}*/}
|
||||
<DesignFilling />
|
||||
{createPortal(<QuizPreview />, document.body)}
|
||||
</Box>
|
||||
|
@ -4,13 +4,13 @@ import { useEffect, useState } from "react";
|
||||
import type { GetTariffsResponse } from "@model/tariff";
|
||||
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Modal,
|
||||
Paper,
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme,
|
||||
Box,
|
||||
Button,
|
||||
Modal,
|
||||
Paper,
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
||||
@ -18,184 +18,191 @@ import { withErrorBoundary } from "react-error-boundary";
|
||||
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
||||
|
||||
function TariffPage() {
|
||||
const theme = useTheme();
|
||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const theme = useTheme();
|
||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [tariffs, setTariffs] = useState();
|
||||
const [user, setUser] = useState();
|
||||
const [discounts, setDiscounts] = useState();
|
||||
const [cartTariffMap, setCartTariffMap] = useState();
|
||||
const [openModal, setOpenModal] = useState({});
|
||||
const [tariffs, setTariffs] = useState();
|
||||
const [user, setUser] = useState();
|
||||
const [discounts, setDiscounts] = useState();
|
||||
const [cartTariffMap, setCartTariffMap] = useState();
|
||||
const [openModal, setOpenModal] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
const get = async () => {
|
||||
const user = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/customer/account",
|
||||
});
|
||||
const tariffs = await makeRequest<never, GetTariffsResponse>({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/strator/tariff?page=1&limit=100",
|
||||
});
|
||||
const discounts = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/price/discounts",
|
||||
});
|
||||
setUser(user);
|
||||
setTariffs(tariffs);
|
||||
setDiscounts(discounts.Discounts);
|
||||
};
|
||||
get();
|
||||
}, []);
|
||||
|
||||
if (!user || !tariffs || !discounts) return <LoadingPage />;
|
||||
|
||||
console.log("user ", user);
|
||||
console.log("tariffs ", tariffs);
|
||||
console.log("discounts ", discounts);
|
||||
|
||||
const openModalHC = (tariffInfo: any) => setOpenModal(tariffInfo);
|
||||
const tryBuy = async ({ id, price }: { id: string, price: number }) => {
|
||||
openModalHC({})
|
||||
//Если в корзине что-то было - выкладываем содержимое и запоминаем чо там лежало
|
||||
if (user.cart.length > 0) {
|
||||
outCart(user.cart)
|
||||
}
|
||||
//Если нам хватает денежек - покупаем тариф
|
||||
if (price <= user.wallet.cash) {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "POST",
|
||||
url: "https://suiz.pena.digital/customer/cart/pay"
|
||||
})
|
||||
} catch (e) {
|
||||
enqueueSnackbar("Произошла ошибка. Попробуйте позже")
|
||||
}
|
||||
//Развращаем товары в корзину
|
||||
inCart()
|
||||
} else {
|
||||
//Деняк не хватило
|
||||
navigate("https://hub.pena.digital/wallet?action=squizpay")
|
||||
}
|
||||
useEffect(() => {
|
||||
const get = async () => {
|
||||
const user = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/customer/account",
|
||||
});
|
||||
const tariffs = await makeRequest<never, GetTariffsResponse>({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/strator/tariff?page=1&limit=100",
|
||||
});
|
||||
const discounts = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/price/discounts",
|
||||
});
|
||||
setUser(user);
|
||||
setTariffs(tariffs);
|
||||
setDiscounts(discounts.Discounts);
|
||||
};
|
||||
get();
|
||||
}, []);
|
||||
|
||||
const purchasesAmount = user?.wallet.purchasesAmount ?? 0;
|
||||
const isUserNko = user?.status === "nko";
|
||||
const filteredTariffs = tariffs.tariffs.filter((tariff) => {
|
||||
return (
|
||||
tariff.privileges[0].serviceKey === "squiz" &&
|
||||
!tariff.isDeleted &&
|
||||
!tariff.isCustom
|
||||
);
|
||||
});
|
||||
if (!user || !tariffs || !discounts) return <LoadingPage />;
|
||||
|
||||
console.log("user ", user);
|
||||
console.log("tariffs ", tariffs);
|
||||
console.log("discounts ", discounts);
|
||||
|
||||
const openModalHC = (tariffInfo: any) => setOpenModal(tariffInfo);
|
||||
const tryBuy = async ({ id, price }: { id: string; price: number }) => {
|
||||
openModalHC({});
|
||||
//Если в корзине что-то было - выкладываем содержимое и запоминаем чо там лежало
|
||||
if (user.cart.length > 0) {
|
||||
outCart(user.cart);
|
||||
}
|
||||
//Если нам хватает денежек - покупаем тариф
|
||||
if (price <= user.wallet.cash) {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "POST",
|
||||
url: "https://suiz.pena.digital/customer/cart/pay",
|
||||
});
|
||||
} catch (e) {
|
||||
enqueueSnackbar("Произошла ошибка. Попробуйте позже");
|
||||
}
|
||||
//Развращаем товары в корзину
|
||||
inCart();
|
||||
} else {
|
||||
//Деняк не хватило
|
||||
navigate("https://hub.pena.digital/wallet?action=squizpay");
|
||||
}
|
||||
};
|
||||
|
||||
const purchasesAmount = user?.wallet.purchasesAmount ?? 0;
|
||||
const isUserNko = user?.status === "nko";
|
||||
const filteredTariffs = tariffs.tariffs.filter((tariff) => {
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
sx={{
|
||||
justifyContent: "left",
|
||||
mt: "40px",
|
||||
mb: "30px",
|
||||
display: "grid",
|
||||
gap: "40px",
|
||||
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${isTablet ? "436px" : "360px"
|
||||
}))`,
|
||||
}}
|
||||
>
|
||||
{createTariffElements(
|
||||
filteredTariffs,
|
||||
true,
|
||||
user,
|
||||
discounts,
|
||||
openModalHC,
|
||||
)}
|
||||
</Box>
|
||||
<Modal
|
||||
open={Object.values(openModal).length > 0}
|
||||
onClose={() => setOpenModal({})}
|
||||
>
|
||||
<Paper
|
||||
sx={{
|
||||
position: "absolute" as "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
boxShadow: 24,
|
||||
p: 4,
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
flexDirection: "column"
|
||||
}}>
|
||||
<Typography id="modal-modal-title" variant="h6" component="h2" mb="20px">
|
||||
Вы подтверждаете платёж в сумму {openModal.price} ₽
|
||||
</Typography>
|
||||
<Button variant="contained" onClick={() => tryBuy(openModal)}>купить</Button>
|
||||
</Paper>
|
||||
</Modal>
|
||||
</>
|
||||
tariff.privileges[0].serviceKey === "squiz" &&
|
||||
!tariff.isDeleted &&
|
||||
!tariff.isCustom
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
sx={{
|
||||
justifyContent: "left",
|
||||
mt: "40px",
|
||||
mb: "30px",
|
||||
display: "grid",
|
||||
gap: "40px",
|
||||
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${
|
||||
isTablet ? "436px" : "360px"
|
||||
}))`,
|
||||
}}
|
||||
>
|
||||
{createTariffElements(
|
||||
filteredTariffs,
|
||||
true,
|
||||
user,
|
||||
discounts,
|
||||
openModalHC,
|
||||
)}
|
||||
</Box>
|
||||
<Modal
|
||||
open={Object.values(openModal).length > 0}
|
||||
onClose={() => setOpenModal({})}
|
||||
>
|
||||
<Paper
|
||||
sx={{
|
||||
position: "absolute" as "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
boxShadow: 24,
|
||||
p: 4,
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
flexDirection: "column",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
id="modal-modal-title"
|
||||
variant="h6"
|
||||
component="h2"
|
||||
mb="20px"
|
||||
>
|
||||
Вы подтверждаете платёж в сумму {openModal.price} ₽
|
||||
</Typography>
|
||||
<Button variant="contained" onClick={() => tryBuy(openModal)}>
|
||||
купить
|
||||
</Button>
|
||||
</Paper>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default withErrorBoundary(TariffPage, {
|
||||
fallback: (
|
||||
<Typography mt="8px" textAlign="center">
|
||||
Ошибка загрузки тарифов
|
||||
</Typography>
|
||||
),
|
||||
onError: () => { },
|
||||
fallback: (
|
||||
<Typography mt="8px" textAlign="center">
|
||||
Ошибка загрузки тарифов
|
||||
</Typography>
|
||||
),
|
||||
onError: () => {},
|
||||
});
|
||||
|
||||
const LoadingPage = () => (
|
||||
<Box
|
||||
sx={{
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ textAlign: "center" }}>
|
||||
{"Подождите, пожалуйста, идёт загрузка :)"}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ textAlign: "center" }}>
|
||||
{"Подождите, пожалуйста, идёт загрузка :)"}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
const inCart = () => {
|
||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]")
|
||||
saveCart.forEach(async (id: string) => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "PATCH",
|
||||
url: `https://hub.pena.digital/customer/cart?id=${id}`
|
||||
})
|
||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
||||
saveCart.forEach(async (id: string) => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "PATCH",
|
||||
url: `https://hub.pena.digital/customer/cart?id=${id}`,
|
||||
});
|
||||
|
||||
let index = saveCart.indexOf('green');
|
||||
if (index !== -1) {
|
||||
saveCart.splice(index, 1);
|
||||
}
|
||||
localStorage.setItem("saveCart", JSON.stringify(saveCart))
|
||||
} catch (e) {
|
||||
console.log("Я не смог добавить тариф в корзину :( " + id)
|
||||
}
|
||||
})
|
||||
}
|
||||
let index = saveCart.indexOf("green");
|
||||
if (index !== -1) {
|
||||
saveCart.splice(index, 1);
|
||||
}
|
||||
localStorage.setItem("saveCart", JSON.stringify(saveCart));
|
||||
} catch (e) {
|
||||
console.log("Я не смог добавить тариф в корзину :( " + id);
|
||||
}
|
||||
});
|
||||
};
|
||||
const outCart = (cart: string[]) => {
|
||||
//Сделаем муторно и подольше, зато при прерывании сессии данные потеряются минимально
|
||||
cart.forEach(async (id: string) => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "DELETE",
|
||||
url: `https://suiz.pena.digital/customer/cart?id=${id}`
|
||||
})
|
||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]")
|
||||
saveCart = saveCart.push(id)
|
||||
localStorage.setItem("saveCart", JSON.stringify(saveCart))
|
||||
} catch (e) {
|
||||
console.log("Я не смог удалить из корзины тариф :(")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//Сделаем муторно и подольше, зато при прерывании сессии данные потеряются минимально
|
||||
cart.forEach(async (id: string) => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "DELETE",
|
||||
url: `https://suiz.pena.digital/customer/cart?id=${id}`,
|
||||
});
|
||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
||||
saveCart = saveCart.push(id);
|
||||
localStorage.setItem("saveCart", JSON.stringify(saveCart));
|
||||
} catch (e) {
|
||||
console.log("Я не смог удалить из корзины тариф :(");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -46,7 +46,8 @@ export const createTariffElements = (
|
||||
}
|
||||
buttonProps={{
|
||||
text: "Выбрать",
|
||||
onClick: () => onclick({id: tariff._id, price: priceBeforeDiscounts / 100}),
|
||||
onClick: () =>
|
||||
onclick({ id: tariff._id, price: priceBeforeDiscounts / 100 }),
|
||||
}}
|
||||
headerText={tariff.name}
|
||||
text={tariff.privileges.map((p) => `${p.name} - ${p.amount}`)}
|
||||
|
@ -1,39 +1,202 @@
|
||||
import Header from "@ui_kit/Header/Header";
|
||||
import { Header } from "../../src/pages/startPage/Header";
|
||||
import Sidebar from "@ui_kit/Sidebar";
|
||||
import Box from "@mui/material/Box";
|
||||
import { useTheme, useMediaQuery } from "@mui/material";
|
||||
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
||||
import { useState } from "react";
|
||||
import { SidebarMobile } from "./startPage/Sidebar/SidebarMobile";
|
||||
import { setShowConfirmLeaveModal } from "@root/uiTools/actions";
|
||||
import { setCurrentStep } from "@root/quizes/actions";
|
||||
import { useQuizStore } from "@root/quizes/store";
|
||||
import { SmallSwitchQuestionListGraph } from "@ui_kit/Toolbars/SmallSwitchQuestionListGraph";
|
||||
import { PanelSwitchQuestionListGraph } from "@ui_kit/Toolbars/PanelSwitchQuestionListGraph";
|
||||
import { ButtonTestPublication } from "@ui_kit/Toolbars/ButtonTestPublication";
|
||||
import { ButtonRecallQuiz } from "@ui_kit/Toolbars/ButtonRecallQuiz";
|
||||
import { Link } from "react-router-dom";
|
||||
import { LinkSimple } from "@icons/LinkSimple";
|
||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||
import { deleteTimeoutedQuestions } from "@utils/deleteTimeoutedQuestions";
|
||||
import { useQuestionsStore } from "@root/questions/store";
|
||||
|
||||
interface Props {
|
||||
sidebar: boolean;
|
||||
header?: boolean;
|
||||
footer?: boolean;
|
||||
page: JSX.Element;
|
||||
}
|
||||
|
||||
export default function Main({ sidebar, header, page }: Props) {
|
||||
export default function Main({ sidebar, header, footer, page }: Props) {
|
||||
const theme = useTheme();
|
||||
const quiz = useCurrentQuiz();
|
||||
const quizConfig = quiz?.config;
|
||||
const { questions } = useQuestionsStore();
|
||||
const currentStep = useQuizStore((state) => state.currentStep);
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||
const isMobileSm = useMediaQuery(theme.breakpoints.down(370));
|
||||
const isBranchingLogic = useMediaQuery(theme.breakpoints.down(1100));
|
||||
const isLinkButton = useMediaQuery(theme.breakpoints.down(708));
|
||||
const [mobileSidebar, setMobileSidebar] = useState<boolean>(false);
|
||||
const [nextStep, setNextStep] = useState<number>(0);
|
||||
const [openBranchingPage, setOpenBranchingPage] = useState<boolean>(false);
|
||||
|
||||
const openBranchingPageHC = () => {
|
||||
if (!openBranchingPage) {
|
||||
deleteTimeoutedQuestions(questions, quiz);
|
||||
}
|
||||
setOpenBranchingPage((old) => !old);
|
||||
};
|
||||
const isConditionMet =
|
||||
[1].includes(currentStep) && quizConfig.type !== "form";
|
||||
|
||||
const changePage = (index: number) => {
|
||||
if (currentStep === 2) {
|
||||
setNextStep(index);
|
||||
setShowConfirmLeaveModal(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setCurrentStep(index);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{header ? <Header /> : <HeaderFull />}
|
||||
{header ? <Header setMobileSidebar={setMobileSidebar} /> : <HeaderFull />}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: isMobile ? "column" : "row",
|
||||
}}
|
||||
>
|
||||
{sidebar ? <Sidebar /> : <></>}
|
||||
{sidebar ? (
|
||||
<>
|
||||
{isMobile ? (
|
||||
<SidebarMobile open={mobileSidebar} changePage={changePage} />
|
||||
) : (
|
||||
<Sidebar changePage={changePage} />
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Box
|
||||
sx={{
|
||||
background: theme.palette.background.default,
|
||||
width: "100%",
|
||||
padding: isMobile ? "15px" : "25px",
|
||||
height: "calc(100vh - 80px)",
|
||||
overflow: "auto",
|
||||
boxSizing: "border-box",
|
||||
padding: isMobile ? "15px" : "25px",
|
||||
}}
|
||||
>
|
||||
{page}
|
||||
<Box
|
||||
sx={{
|
||||
background: theme.palette.background.default,
|
||||
width: "100%",
|
||||
// padding: isMobile ? "15px" : "25px",
|
||||
// height: "calc(100vh - 80px)",
|
||||
overflow: "auto",
|
||||
boxSizing: "border-box",
|
||||
}}
|
||||
>
|
||||
{page}
|
||||
</Box>
|
||||
{footer ? (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
padding: isMobile ? "20px 16px" : "20px 20px",
|
||||
display: "flex",
|
||||
justifyContent: isMobile
|
||||
? isMobileSm
|
||||
? "center"
|
||||
: "flex-end"
|
||||
: "flex-start",
|
||||
flexDirection: isMobile ? "row-reverse" : "-moz-initial",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
background: "#FFF",
|
||||
borderTop: "#f2f3f7 2px solid",
|
||||
}}
|
||||
>
|
||||
{isConditionMet &&
|
||||
(isBranchingLogic ? (
|
||||
<SmallSwitchQuestionListGraph
|
||||
openBranchingPage={openBranchingPage}
|
||||
setOpenBranchingPage={openBranchingPageHC}
|
||||
/>
|
||||
) : (
|
||||
<PanelSwitchQuestionListGraph
|
||||
openBranchingPage={openBranchingPage}
|
||||
setOpenBranchingPage={openBranchingPageHC}
|
||||
hideText
|
||||
/>
|
||||
))}
|
||||
{/* Кнопка тестового просмотра */}
|
||||
<ButtonTestPublication />
|
||||
{/* Кнопка отозвать */}
|
||||
<ButtonRecallQuiz />
|
||||
{/* Ссылка */}
|
||||
{quiz?.status === "start" &&
|
||||
(!isLinkButton ? (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
whiteSpace: "nowrap",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
display: isMobile ? "none" : "block",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
https://hbpn.link/{quiz.qid}
|
||||
</Box>
|
||||
) : (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
cursor: "pointer",
|
||||
minWidth: "34px",
|
||||
height: "34px",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
display: isMobile ? "none" : "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "Center",
|
||||
background: "#EEE4FC",
|
||||
borderRadius: "8px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
<LinkSimple />
|
||||
</Box>
|
||||
))}
|
||||
{/* Маленькая кнопка ссылки */}
|
||||
{isMobile && quiz?.status === "start" && (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
cursor: "pointer",
|
||||
width: "34px",
|
||||
height: "34px",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "Center",
|
||||
background: "#EEE4FC",
|
||||
borderRadius: "8px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
<LinkSimple />
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
|
@ -157,7 +157,7 @@ export default function EditPage() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header setMobileSidebar={setMobileSidebar} />
|
||||
{/*<Header setMobileSidebar={setMobileSidebar} />*/}
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
@ -165,11 +165,11 @@ export default function EditPage() {
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
{isMobile ? (
|
||||
<SidebarMobile open={mobileSidebar} changePage={changePage} />
|
||||
) : (
|
||||
<Sidebar changePage={changePage} />
|
||||
)}
|
||||
{/*{isMobile ? (*/}
|
||||
{/* <SidebarMobile open={mobileSidebar} changePage={changePage} />*/}
|
||||
{/*) : (*/}
|
||||
{/* <Sidebar changePage={changePage} />*/}
|
||||
{/*)}*/}
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
@ -208,102 +208,102 @@ export default function EditPage() {
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
padding: isMobile ? "20px 16px" : "20px 20px",
|
||||
display: "flex",
|
||||
justifyContent: isMobile
|
||||
? isMobileSm
|
||||
? "center"
|
||||
: "flex-end"
|
||||
: "flex-start",
|
||||
flexDirection: isMobile ? "row-reverse" : "-moz-initial",
|
||||
alignItems: "center",
|
||||
gap: "15px",
|
||||
background: "#FFF",
|
||||
borderTop: "#f2f3f7 2px solid",
|
||||
}}
|
||||
>
|
||||
{isConditionMet &&
|
||||
(isBranchingLogic ? (
|
||||
<SmallSwitchQuestionListGraph
|
||||
openBranchingPage={openBranchingPage}
|
||||
setOpenBranchingPage={openBranchingPageHC}
|
||||
/>
|
||||
) : (
|
||||
<PanelSwitchQuestionListGraph
|
||||
openBranchingPage={openBranchingPage}
|
||||
setOpenBranchingPage={openBranchingPageHC}
|
||||
hideText
|
||||
/>
|
||||
))}
|
||||
{/* Кнопка тестового просмотра */}
|
||||
<ButtonTestPublication />
|
||||
{/* Кнопка отозвать */}
|
||||
<ButtonRecallQuiz />
|
||||
{/* Ссылка */}
|
||||
{quiz?.status === "start" &&
|
||||
(!isLinkButton ? (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
whiteSpace: "nowrap",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
display: isMobile ? "none" : "block",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
https://hbpn.link/{quiz.qid}
|
||||
</Box>
|
||||
) : (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
cursor: "pointer",
|
||||
minWidth: "34px",
|
||||
height: "34px",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
display: isMobile ? "none" : "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "Center",
|
||||
background: "#EEE4FC",
|
||||
borderRadius: "8px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
<LinkSimple />
|
||||
</Box>
|
||||
))}
|
||||
{/* Маленькая кнопка ссылки */}
|
||||
{isMobile && quiz?.status === "start" && (
|
||||
<Box
|
||||
component={Link}
|
||||
sx={{
|
||||
cursor: "pointer",
|
||||
width: "34px",
|
||||
height: "34px",
|
||||
color: "#7E2AEA",
|
||||
fontSize: "14px",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "Center",
|
||||
background: "#EEE4FC",
|
||||
borderRadius: "8px",
|
||||
}}
|
||||
target="_blank"
|
||||
to={"https://hbpn.link/" + quiz.qid}
|
||||
>
|
||||
<LinkSimple />
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
{/*<Box*/}
|
||||
{/* sx={{*/}
|
||||
{/* width: "100%",*/}
|
||||
{/* padding: isMobile ? "20px 16px" : "20px 20px",*/}
|
||||
{/* display: "flex",*/}
|
||||
{/* justifyContent: isMobile*/}
|
||||
{/* ? isMobileSm*/}
|
||||
{/* ? "center"*/}
|
||||
{/* : "flex-end"*/}
|
||||
{/* : "flex-start",*/}
|
||||
{/* flexDirection: isMobile ? "row-reverse" : "-moz-initial",*/}
|
||||
{/* alignItems: "center",*/}
|
||||
{/* gap: "15px",*/}
|
||||
{/* background: "#FFF",*/}
|
||||
{/* borderTop: "#f2f3f7 2px solid",*/}
|
||||
{/* }}*/}
|
||||
{/*>*/}
|
||||
{/* {isConditionMet &&*/}
|
||||
{/* (isBranchingLogic ? (*/}
|
||||
{/* <SmallSwitchQuestionListGraph*/}
|
||||
{/* openBranchingPage={openBranchingPage}*/}
|
||||
{/* setOpenBranchingPage={openBranchingPageHC}*/}
|
||||
{/* />*/}
|
||||
{/* ) : (*/}
|
||||
{/* <PanelSwitchQuestionListGraph*/}
|
||||
{/* openBranchingPage={openBranchingPage}*/}
|
||||
{/* setOpenBranchingPage={openBranchingPageHC}*/}
|
||||
{/* hideText*/}
|
||||
{/* />*/}
|
||||
{/* ))}*/}
|
||||
{/* /!* Кнопка тестового просмотра *!/*/}
|
||||
{/* <ButtonTestPublication />*/}
|
||||
{/* /!* Кнопка отозвать *!/*/}
|
||||
{/* <ButtonRecallQuiz />*/}
|
||||
{/* /!* Ссылка *!/*/}
|
||||
{/* {quiz?.status === "start" &&*/}
|
||||
{/* (!isLinkButton ? (*/}
|
||||
{/* <Box*/}
|
||||
{/* component={Link}*/}
|
||||
{/* sx={{*/}
|
||||
{/* whiteSpace: "nowrap",*/}
|
||||
{/* textOverflow: "ellipsis",*/}
|
||||
{/* overflow: "hidden",*/}
|
||||
{/* display: isMobile ? "none" : "block",*/}
|
||||
{/* color: "#7E2AEA",*/}
|
||||
{/* fontSize: "14px",*/}
|
||||
{/* }}*/}
|
||||
{/* target="_blank"*/}
|
||||
{/* to={"https://hbpn.link/" + quiz.qid}*/}
|
||||
{/* >*/}
|
||||
{/* https://hbpn.link/{quiz.qid}*/}
|
||||
{/* </Box>*/}
|
||||
{/* ) : (*/}
|
||||
{/* <Box*/}
|
||||
{/* component={Link}*/}
|
||||
{/* sx={{*/}
|
||||
{/* cursor: "pointer",*/}
|
||||
{/* minWidth: "34px",*/}
|
||||
{/* height: "34px",*/}
|
||||
{/* color: "#7E2AEA",*/}
|
||||
{/* fontSize: "14px",*/}
|
||||
{/* display: isMobile ? "none" : "flex",*/}
|
||||
{/* justifyContent: "center",*/}
|
||||
{/* alignItems: "Center",*/}
|
||||
{/* background: "#EEE4FC",*/}
|
||||
{/* borderRadius: "8px",*/}
|
||||
{/* }}*/}
|
||||
{/* target="_blank"*/}
|
||||
{/* to={"https://hbpn.link/" + quiz.qid}*/}
|
||||
{/* >*/}
|
||||
{/* <LinkSimple />*/}
|
||||
{/* </Box>*/}
|
||||
{/* ))}*/}
|
||||
{/* /!* Маленькая кнопка ссылки *!/*/}
|
||||
{/* {isMobile && quiz?.status === "start" && (*/}
|
||||
{/* <Box*/}
|
||||
{/* component={Link}*/}
|
||||
{/* sx={{*/}
|
||||
{/* cursor: "pointer",*/}
|
||||
{/* width: "34px",*/}
|
||||
{/* height: "34px",*/}
|
||||
{/* color: "#7E2AEA",*/}
|
||||
{/* fontSize: "14px",*/}
|
||||
{/* display: "flex",*/}
|
||||
{/* justifyContent: "center",*/}
|
||||
{/* alignItems: "Center",*/}
|
||||
{/* background: "#EEE4FC",*/}
|
||||
{/* borderRadius: "8px",*/}
|
||||
{/* }}*/}
|
||||
{/* target="_blank"*/}
|
||||
{/* to={"https://hbpn.link/" + quiz.qid}*/}
|
||||
{/* >*/}
|
||||
{/* <LinkSimple />*/}
|
||||
{/* </Box>*/}
|
||||
{/* )}*/}
|
||||
{/*</Box>*/}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
|
@ -80,12 +80,12 @@ export const Header = ({ setMobileSidebar }: HeaderProps) => {
|
||||
</Link>
|
||||
<FormControl fullWidth variant="standard">
|
||||
<TextField
|
||||
value={quiz.name}
|
||||
onChange={(e) =>
|
||||
updateQuiz(quiz.id, (quiz) => {
|
||||
quiz.name = e.target.value;
|
||||
})
|
||||
}
|
||||
// value={quiz.name}
|
||||
// onChange={(e) =>
|
||||
// updateQuiz(quiz.id, (quiz) => {
|
||||
// quiz.name = e.target.value;
|
||||
// })
|
||||
// }
|
||||
fullWidth
|
||||
id="project-name"
|
||||
placeholder="Название проекта окно"
|
||||
|
Loading…
Reference in New Issue
Block a user