import { useEffect, useState } from "react"; import { useLinkClickHandler, useParams } from "react-router-dom"; import { Box, Modal, Fade, Backdrop, Typography, Tabs, Tab, useTheme, useMediaQuery, } from "@mui/material"; import { UserTab } from "./UserTab"; import { PurchaseTab } from "./PurchaseTab"; import { TransactionsTab } from "./TransactionsTab"; import { VerificationTab } from "./VerificationTab"; import { authStore } from "@root/stores/auth"; import userIcon from "@root/assets/icons/user.svg"; import packageIcon from "@root/assets/icons/package.svg"; import transactionsIcon from "@root/assets/icons/transactions.svg"; import checkIcon from "@root/assets/icons/check.svg"; import forwardIcon from "@root/assets/icons/forward.svg"; import type { SyntheticEvent } from "react"; const TABS = [ { name: "Пользователь", icon: userIcon }, { name: "Покупка товаров и услуг", icon: packageIcon }, { name: "Транзакции", icon: transactionsIcon }, { name: "Верификация", icon: checkIcon }, ]; const baseUrl = process.env.NODE_ENV === "production" ? "" : "https://hub.pena.digital"; export type File = { name: "inn" | "rule" | "egrule" | "certificate"; url: string; }; export type Verification = { _id: string; accepted: boolean; status: "org" | "nko"; updated_at: string; comment: string; files: File[]; }; const ModalUser = () => { const [user, setUser] = useState(null); const [value, setValue] = useState(0); const [openNavigation, setOpenNavigation] = useState(false); const { userId } = useParams(); const { makeRequest } = authStore(); const theme = useTheme(); const tablet = useMediaQuery(theme.breakpoints.down(1070)); const mobile = useMediaQuery(theme.breakpoints.down(700)); useEffect(() => { makeRequest({ method: "get", url: baseUrl + `/verification/verification/${userId}`, }).then(setUser); }, []); return ( <> Пользователь сервиса {mobile && ( forward setOpenNavigation((isOpened) => !isOpened)} /> )} setValue(newValue) } aria-label="Vertical tabs example" sx={{ padding: mobile ? "16px" : "10px", width: "100%", }} TabIndicatorProps={{ style: { background: "transparent" } }} > {TABS.map(({ name, icon }) => ( } iconPosition="start" key={name} label={mobile ? (openNavigation ? name : "") : name} sx={{ justifyContent: "flex-start", textTransform: "inherit", minHeight: "auto", minWidth: "auto", fontSize: "15px", padding: mobile ? "9px" : "15px", marginBottom: mobile ? "15px" : "5px", color: theme.palette.common.black, whiteSpace: "nowrap", lineHeight: "18px", "&.MuiButtonBase-root.Mui-selected": { borderRadius: "12px", color: "#7E2AEA", background: "rgba(126, 42, 234, 0.07)", }, }} /> ))} {value === 0 && ( )} {value === 1 && } {value === 2 && } {value === 3 && } ); }; export default ModalUser;