квизы в панели юзера(возможно требует доработок)

This commit is contained in:
Tamara 2024-03-28 23:31:28 +03:00
parent 9e7d44e6fc
commit 7daa2f7e99
4 changed files with 55 additions and 2 deletions

@ -113,6 +113,7 @@ export function usePromocodes(
...swrResponse,
createPromocode,
deletePromocode,
promocodeStatistics,
promocodesCount: promocodesCountRef.current,
};
}

@ -19,7 +19,8 @@ import type { PromocodeStatistics } from "@root/model/promocodes";
type StatisticsModalProps = {
id: string;
setId: (id: string) => void;
promocodeStatistics: PromocodeStatistics[] | null | undefined;
// promocodeStatistics: PromocodeStatistics[] | null | undefined;
promocodeStatistics: any;
};
const COLUMNS: GridColDef<PromocodeStatistics, string>[] = [

@ -0,0 +1,48 @@
import {Box, Button, TextField, Typography} from "@mui/material";
import {ChangeEvent, useState} from "react";
import {makeRequest} from "@frontend/kitui";
type QuizTabProps = {
userId: string;
};
export default function QuizTab({ userId }: QuizTabProps) {
const [quizId, setQuizId] = useState<string>("")
console.log(quizId)
return(
<Box sx={{ padding: "25px" }}>
<Typography
sx={{
marginBottom: "10px",
fontWeight: "bold",
}}
>
Передача Квиза
</Typography>
<Box sx={{display: "flex", gap: "15px"}}>
<TextField
placeholder={"Ссылка на квиз"}
onChange={(event: ChangeEvent<HTMLTextAreaElement>)=>{
setQuizId(event.target.value.split("link/")[1])
}}
/>
<Button
variant="text"
sx={{ background: "#9A9AAF" }}
onClick={async() => {
await makeRequest({
method: "post",
//useToken: true,
url: process.env.REACT_APP_DOMAIN + "/squiz/quiz/move",
body: {Qid: quizId, AccountID: userId}
});
}}
>
Ок
</Button>
</Box>
</Box>
)
}

@ -21,10 +21,11 @@ import { ReactComponent as PackageIcon } from "@root/assets/icons/package.svg";
import { ReactComponent as TransactionsIcon } from "@root/assets/icons/transactions.svg";
import { ReactComponent as CheckIcon } from "@root/assets/icons/check.svg";
import { ReactComponent as CloseIcon } from "@root/assets/icons/close.svg";
import QuizIcon from '@mui/icons-material/Quiz';
import forwardIcon from "@root/assets/icons/forward.svg";
import type { SyntheticEvent } from "react";
import QuizTab from "@pages/dashboard/ModalUser/QuizTab";
const TABS = [
{ name: "Пользователь", icon: UserIcon, activeStyles: { fill: "#7E2AEA" } },
@ -39,6 +40,7 @@ const TABS = [
activeStyles: { stroke: "#7E2AEA" },
},
{ name: "Верификация", icon: CheckIcon, activeStyles: { stroke: "#7E2AEA" } },
{ name: "Квизы", icon: QuizIcon, activeStyles: { stroke: "#7E2AEA" } },
];
type ModalUserProps = {
@ -194,6 +196,7 @@ const ModalUser = ({ open, onClose, userId }: ModalUserProps) => {
{value === 1 && <PurchaseTab userId={userId} />}
{value === 2 && <TransactionsTab />}
{value === 3 && <VerificationTab userId={userId} />}
{value === 4 && <QuizTab userId={userId} />}
</Box>
</Box>
</Box>