All files / components/DiningCommons DiningCommonsTable.js

100% Statements 8/8
100% Branches 6/6
100% Functions 5/5
100% Lines 8/8

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          10x 10x         29x                       29x         29x         29x       10x   10x    
import React from "react";
import OurTable from "main/components/OurTable";
import { Link } from "react-router";
 
export default function DiningCommonsTable({ commons, date }) {
  const testid = "DiningCommonsTable";
  const columns = [
    {
      Header: "Code",
      accessor: "code", // accessor is the "key" in the data
      Cell: ({ value }) => (
        <Link to={`/diningcommons/${date}/${value}`}>{value}</Link>
      ),
    },
    {
      Header: "Name",
      accessor: "name",
    },
    {
      Header: "Has Dining Cam",
      accessor: "hasDiningCam",
      // Credits to Jayden for the code here!
      // Renders a checkmark box.
      Cell: ({ value }) => (value ? "✅" : "❌"),
    },
    {
      Header: "Has Sack Meal",
      accessor: "hasSackMeal",
      Cell: ({ value }) => (value ? "✅" : "❌"),
    },
    {
      Header: "Has Takeout Meal",
      accessor: "hasTakeoutMeal",
      Cell: ({ value }) => (value ? "✅" : "❌"),
    },
  ];
 
  const displayedColumns = columns;
 
  return <OurTable data={commons} columns={displayedColumns} testid={testid} />;
}