All files / components UserProfileTable.jsx

100% Statements 41/41
100% Branches 4/4
100% Functions 2/2
100% Lines 41/41

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 571x 1x   1x 5x 5x 5x 5x 5x 5x   5x 5x 5x   5x 5x 5x   5x 5x 5x   5x 5x 5x   5x 5x 5x   5x 5x 5x   5x 5x 5x         5x   5x 5x   5x 4x 7x 7x 4x 4x   5x 5x  
import React from "react";
import { Table } from "react-bootstrap";
 
export default function UserProfileTable({ user }) {
  return (
    <Table striped bordered hover>
      <thead>
        <tr>
          <th>First Name</th>
          <td>{user.givenName}</td>
        </tr>
        <tr>
          <th>Last Name</th>
          <td>{user.familyName}</td>
        </tr>
        <tr>
          <th>Email</th>
          <td>{user.email}</td>
        </tr>
        <tr>
          <th>Joined Commons</th>
          <td>{commonsString(user.commons)}</td>
        </tr>
        <tr>
          <th>User ID</th>
          <td>{user.id}</td>
        </tr>
        <tr>
          <th>Admin</th>
          <td>{String(user.admin)}</td>
        </tr>
        <tr>
          <th>Hosted Domain</th>
          <td>{user.hostedDomain}</td>
        </tr>
        <tr>
          <th>Locale</th>
          <td>{user.locale}</td>
        </tr>
      </thead>
    </Table>
  );
}
 
function commonsString(commons) {
  var result = "";
 
  if (commons !== undefined) {
    for (var i = 0; i < commons.length; i++) {
      result += commons[i].name + ", ";
    }
    result = result.substring(0, result.length - 2);
  }
 
  return result;
}