UserStatisticsTable.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { useTranslation } from 'next-i18next';
  3. type UserStatistics = {
  4. total: number;
  5. active: { total: number };
  6. inactive: { total: number };
  7. };
  8. type Props = {
  9. userStatistics?: UserStatistics | null;
  10. };
  11. const UserStatisticsTable: React.FC<Props> = ({ userStatistics }) => {
  12. const { t } = useTranslation('admin');
  13. if (userStatistics == null) return null;
  14. return (
  15. <table className="table table-bordered w-100">
  16. <tbody>
  17. <tr>
  18. <th className="col-sm-4 align-top">{t('user_management.user_statistics.total')}</th>
  19. <td className="align-top">{ userStatistics.total }</td>
  20. </tr>
  21. <tr>
  22. <th className="col-sm-4 align-top">{t('user_management.user_statistics.active')}</th>
  23. <td className="align-top">{ userStatistics.active.total }</td>
  24. </tr>
  25. <tr>
  26. <th className="col-sm-4 align-top">{t('user_management.user_statistics.inactive')}</th>
  27. <td className="align-top">{ userStatistics.inactive.total }</td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. );
  32. };
  33. export default UserStatisticsTable;