github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/public/src/components/ReviewResult.tsx (about)

     1  import React from "react"
     2  import { Review } from "../../proto/qf/types_pb"
     3  import { hasBenchmarks } from "../Helpers"
     4  import Benchmark from "./manual-grading/Benchmark"
     5  import Criteria from "./manual-grading/Criterion"
     6  import MarkReadyButton from "./manual-grading/MarkReadyButton"
     7  import SummaryFeedback from "./manual-grading/SummaryFeedback"
     8  
     9  
    10  const ReviewResult = ({ review }: { review?: Review }): JSX.Element | null => {
    11  
    12      if (!review) {
    13          return null
    14      }
    15  
    16      const result = hasBenchmarks(review) ? review.gradingBenchmarks.map(benchmark => {
    17          return (
    18              <Benchmark key={benchmark.ID.toString()} bm={benchmark}>
    19                  {benchmark.criteria.map(criteria => <Criteria key={criteria.ID.toString()} criteria={criteria} />)}
    20              </Benchmark>
    21          )
    22      }) : null
    23  
    24      return (
    25          <table className="table">
    26              <thead className="thead-dark">
    27                  <tr className="table-primary">
    28                      <th>Score:</th>
    29                      <th>{review.score}</th>
    30                      <th />
    31                  </tr>
    32                  <tr>
    33                      <th scope="col">Criteria</th>
    34                      <th scope="col">Status</th>
    35                      <th scope="col">Comment</th>
    36                  </tr>
    37              </thead>
    38              <tbody>
    39                  {result}
    40              </tbody>
    41              <tfoot>
    42                  <SummaryFeedback review={review} />
    43                  {!review.ready
    44                      ?
    45                      <tr>
    46                          <MarkReadyButton review={review} />
    47                      </tr>
    48                      : null
    49                  }
    50              </tfoot>
    51          </table>
    52      )
    53  }
    54  
    55  export default ReviewResult