All files / client/components/Admin/User UserTableRow.tsx

0% Statements 0/5
0% Branches 0/2
0% Functions 0/1
0% Lines 0/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77                                                                                                                                                         
import React, { FC } from 'react'
import moment from 'moment'
import { Badge } from 'reactstrap'
import UserPicture from 'components/User/UserPicture'
import UserStatusBadge from 'components/User/UserStatusBadge'
import UserEditDropdown from './UserEditDropdown'
 
interface Props {
  me: any
  user: any
  changeStatus: (user: any, string: string) => void
  handleClickEdit: (user: any) => void
  handleClickResetPassword: (user: any) => void
  handleClickApprove: (user: any) => void
  handleClickSuspend: (user: any) => void
  handleClickRestore: (user: any) => void
  handleClickRemove: (user: any) => void
  handleClickRemoveCompletely: (user: any) => void
  handleClickRevokeAdmin: (user: any) => void
  handleClickGrantAdmin: (user: any) => void
}
 
const UserTableRow: FC<Props> = ({ me, user, ...props }) => {
  const { admin, username, name, email, createdAt } = user
  const {
    handleClickEdit,
    handleClickResetPassword,
    handleClickApprove,
    handleClickSuspend,
    handleClickRestore,
    handleClickRemove,
    handleClickRemoveCompletely,
    handleClickRevokeAdmin,
    handleClickGrantAdmin,
  } = props
  const handlers = {
    handleClickEdit,
    handleClickResetPassword,
    handleClickApprove,
    handleClickSuspend,
    handleClickRestore,
    handleClickRemove,
    handleClickRemoveCompletely,
    handleClickRevokeAdmin,
    handleClickGrantAdmin,
  }
 
  return (
    <tr>
      <td>
        <UserPicture user={user} />
      </td>
      <td>
        <strong>{username}</strong>
      </td>
      <td>{name}</td>
      <td>{email}</td>
      <td>{moment(createdAt).format('YYYY-MM-DD')}</td>
      <td>
        <div className="d-inline-flex flex-column">
          <UserStatusBadge user={user} />
          {admin && (
            <Badge className="mt-2" color="primary">
              Admin
            </Badge>
          )}
        </div>
      </td>
      <td>
        <UserEditDropdown me={me} user={user} {...handlers} />
      </td>
    </tr>
  )
}
 
export default UserTableRow