import { Card, CardContent, CardHeader, CardTitle, Table, TableBody, TableCell, TableRow } from "@marzneshin/components"; import { FC } from 'react'; import { UserType, UsersStatus, UsersStatusBadge } from '@marzneshin/features/users'; import { CircularProgress } from "@nextui-org/progress"; import { useTranslation } from "react-i18next"; import { format, isDate, isValid } from "date-fns"; interface UserInfoTableProps { entity: UserType; } const TableRowWithCell: FC<{ label: string; value: string | number | JSX.Element }> = ({ label, value }) => ( {label} {value} ); const DateTableRow: FC<{ label: string; date: Date | string }> = ({ label, date }) => { let formattedDate = ''; if (date && isValid(date)) { formattedDate = format(date, "PPP"); } return ( ); }; const CircularProgressBarRow: FC<{ label: string; value: number; limit: number }> = ({ label, value, limit }) => ( {label} ); export const UserInfoTable: FC = ({ entity }) => { const { t } = useTranslation(); const expireDate = entity.expire ? (isDate(entity.expire) ? entity.expire : new Date(entity.expire)) : null; return ( {t('user_info')} } /> {(expireDate && entity.on_hold_expire_duration === 0) ? ( ) : ( <> {entity.on_hold_timeout && } )} {entity.data_limit && }
); };