import { useState, useEffect } from "react"; import { Box, Typography, useTheme, useMediaQuery } from "@mui/material"; import { getUserInfo } from "@root/api/user"; import { getAccountInfo } from "@root/api/account"; import type { UserType } from "@root/api/roles"; import type { Account } from "@root/api/account"; type UserTabProps = { userId: string; }; export const UserTab = ({ userId }: UserTabProps) => { const [user, setUser] = useState(null); const [account, setAccount] = useState(null); const theme = useTheme(); const mobile = useMediaQuery(theme.breakpoints.down(700)); useEffect(() => { if (userId) { getUserInfo(userId).then(([userInfo]) => setUser(userInfo)); getAccountInfo(userId).then(([accountsInfo]) => setAccount(accountsInfo)); } }, []); return ( ID {user?._id} Дата регистрации {new Date(user?.createdAt || "").toLocaleDateString()} Email {user?.email} Телефон {user?.phoneNumber} Тип: {account?.status === "no" && "Физ. лицо"} {account?.status === "org" && "Юр. лицо"} {account?.status === "nko" && "НКО"} ФИО: {`${account?.name.secondname || ""} ${ account?.name.firstname || "" } ${account?.name.middlename || ""}`} Внутренний кошелек {`${account?.wallet.money || 0} ${ account?.wallet.currency || "RUB" }.`} ); };