All files / pages Moderate.js

100% Statements 6/6
100% Branches 4/4
100% Functions 1/1
100% Lines 6/6

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                1x 9x 9x               9x 6x         3x                                                                          
import React from "react";
import { useCurrentUser, hasRole } from "main/utils/currentUser";
import { Navigate } from "react-router";
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
import { Table, _Button } from "react-bootstrap";
import AliasTable from "../components/Alias/AliasTable";
import { useBackend } from "../utils/useBackend";
 
const Moderate = () => {
  const { data: currentUser } = useCurrentUser();
  const { data } = useBackend(
    // Stryker disable next-line all : don't test internal caching of React Query
    [`/api/admin/usersWithProposedAlias`],
    // Stryker disable next-line all : don't test internal caching of React Query
    { method: "GET", url: "/api/admin/usersWithProposedAlias" },
    [],
  );
 
  if (!currentUser.loggedIn || !hasRole(currentUser, "ROLE_ADMIN")) {
    return <Navigate to="/" />;
  }
 
  // TODO: Replace this placeholder with the actual Reviews Table component when available
 
  return (
    <BasicLayout>
      <div className="pt-2">
        <h1>Moderation Page</h1>
 
        <h4> Alias Table </h4>
        <AliasTable alias={data} />
        <br />
        <h4> Reviews Table </h4>
        {/* Placeholder: until ReviewsTable component is implemented */}
        {/* Stryker disable all */}
        <Table striped bordered hover>
          <thead>
            <tr>
              <th>Score</th>
              <th>Comments</th>
              <th>Date Served</th>
              <th>Item Name</th>
              <th>Edit</th>
              <th>Delete</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td colSpan="6" className="text-center">
                Reviews Table Placeholder
              </td>
            </tr>
          </tbody>
        </Table>
        {/* Stryker restore all */}
      </div>
    </BasicLayout>
  );
};
 
export default Moderate;