кнопка пополнить и адаптация для результатов
This commit is contained in:
parent
d9aaf8524a
commit
13d2dfeeb1
@ -15,7 +15,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
IconButton
|
IconButton,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
||||||
@ -58,8 +58,8 @@ function TariffPage() {
|
|||||||
setUser(user);
|
setUser(user);
|
||||||
setTariffs(tariffs);
|
setTariffs(tariffs);
|
||||||
setDiscounts(discounts.Discounts);
|
setDiscounts(discounts.Discounts);
|
||||||
let c = currencyFormatter.format(Number(user.wallet.cash) / 100)
|
let c = currencyFormatter.format(Number(user.wallet.cash) / 100);
|
||||||
setCash(c)
|
setCash(c);
|
||||||
};
|
};
|
||||||
get();
|
get();
|
||||||
}, []);
|
}, []);
|
||||||
@ -85,9 +85,8 @@ function TariffPage() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
url: "https://squiz.pena.digital/customer/cart/pay",
|
url: "https://squiz.pena.digital/customer/cart/pay",
|
||||||
});
|
});
|
||||||
setCash(currencyFormatter.format(Number(data.wallet.cash) / 100))
|
setCash(currencyFormatter.format(Number(data.wallet.cash) / 100));
|
||||||
enqueueSnackbar("Тариф успешно приобретён");
|
enqueueSnackbar("Тариф успешно приобретён");
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
enqueueSnackbar("Произошла ошибка. Попробуйте позже");
|
enqueueSnackbar("Произошла ошибка. Попробуйте позже");
|
||||||
}
|
}
|
||||||
@ -98,8 +97,9 @@ function TariffPage() {
|
|||||||
// history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay");
|
// history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay");
|
||||||
|
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${(price - Number(user.wallet.cash)) * 100
|
link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${
|
||||||
}`;
|
(price - Number(user.wallet.cash)) * 100
|
||||||
|
}`;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
// link.click();
|
// link.click();
|
||||||
}
|
}
|
||||||
@ -179,8 +179,9 @@ function TariffPage() {
|
|||||||
display: "grid",
|
display: "grid",
|
||||||
gap: "40px",
|
gap: "40px",
|
||||||
p: "20px",
|
p: "20px",
|
||||||
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${isTablet ? "436px" : "360px"
|
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${
|
||||||
}))`,
|
isTablet ? "436px" : "360px"
|
||||||
|
}))`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{createTariffElements(
|
{createTariffElements(
|
||||||
@ -231,7 +232,7 @@ export const Tariffs = withErrorBoundary(TariffPage, {
|
|||||||
Ошибка загрузки тарифов
|
Ошибка загрузки тарифов
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
onError: () => { },
|
onError: () => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const LoadingPage = () => (
|
const LoadingPage = () => (
|
||||||
@ -269,7 +270,7 @@ export const inCart = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem("saveCart", "[]")
|
localStorage.setItem("saveCart", "[]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const outCart = (cart: string[]) => {
|
const outCart = (cart: string[]) => {
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
import { Box, Typography, Button } from "@mui/material";
|
import {
|
||||||
|
Box,
|
||||||
|
Typography,
|
||||||
|
Button,
|
||||||
|
useMediaQuery,
|
||||||
|
useTheme,
|
||||||
|
} from "@mui/material";
|
||||||
import { getQuestionByContentId } from "@root/questions/actions";
|
import { getQuestionByContentId } from "@root/questions/actions";
|
||||||
|
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
@ -24,6 +30,8 @@ export const ResultForm = ({
|
|||||||
}: ResultFormProps) => {
|
}: ResultFormProps) => {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const mode = modes;
|
const mode = modes;
|
||||||
|
const theme = useTheme();
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
||||||
const { questions } = useQuestionsStore();
|
const { questions } = useQuestionsStore();
|
||||||
const resultQuestion = (questions.find(
|
const resultQuestion = (questions.find(
|
||||||
(question) =>
|
(question) =>
|
||||||
@ -58,15 +66,16 @@ export const ResultForm = ({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "start",
|
alignItems: "start",
|
||||||
width: "490px",
|
width: isMobile ? "100%" : "490px",
|
||||||
|
padding: isMobile ? "0 16px" : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
{!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
||||||
<YoutubeEmbedIframe
|
<YoutubeEmbedIframe
|
||||||
videoUrl={resultQuestion.content.video}
|
videoUrl={resultQuestion.content.video}
|
||||||
containerSX={{
|
containerSX={{
|
||||||
width: "490px",
|
width: isMobile ? "100%" : "490px",
|
||||||
height: "280px",
|
height: isMobile ? "100%" : "280px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -75,10 +84,10 @@ export const ResultForm = ({
|
|||||||
component="img"
|
component="img"
|
||||||
src={resultQuestion.content.back}
|
src={resultQuestion.content.back}
|
||||||
sx={{
|
sx={{
|
||||||
width: "490px",
|
width: isMobile ? "100%" : "490px",
|
||||||
height: "280px",
|
height: isMobile ? "100%" : "280px",
|
||||||
}}
|
}}
|
||||||
></Box>
|
/>
|
||||||
)}
|
)}
|
||||||
{resultQuestion.description !== "" &&
|
{resultQuestion.description !== "" &&
|
||||||
resultQuestion.description !== " " && (
|
resultQuestion.description !== " " && (
|
||||||
|
|||||||
@ -131,7 +131,6 @@ export const Header = ({ setMobileSidebar }: HeaderProps) => {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<ToTariffsButton />
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -139,6 +138,7 @@ export const Header = ({ setMobileSidebar }: HeaderProps) => {
|
|||||||
gap: "15px",
|
gap: "15px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<ToTariffsButton color={"#7e2aea"} />
|
||||||
<LogoutButton onClick={handleLogoutClick} />
|
<LogoutButton onClick={handleLogoutClick} />
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -58,7 +58,7 @@ export default function HeaderFull() {
|
|||||||
<Logotip width={124} />
|
<Logotip width={124} />
|
||||||
</Link>
|
</Link>
|
||||||
<Box sx={{ display: "flex", ml: "auto" }}>
|
<Box sx={{ display: "flex", ml: "auto" }}>
|
||||||
<ToTariffsButton />
|
<ToTariffsButton color={"#7e2aea"} />
|
||||||
<LogoutButton
|
<LogoutButton
|
||||||
onClick={handleLogoutClick}
|
onClick={handleLogoutClick}
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user