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 | 49x 49x 200x 200x 200x 49x | 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: "Meals Offered Today",
accessor: "mealsOfferedToday",
Cell: ({ value, row }) => {
return (
<div>
{!value || value.length === 0
? "No meals offered today"
: value.map((meal) => (
<Link
to={`/diningcommons/${date}/${row.original.code}/${meal.code}`}
className="p-2"
data-testid={`DiningCommonsTable-cell-row-${row.index}-col-meal-${meal.code}`}
>
{meal.name}
</Link>
))}
</div>
);
},
},
{
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} />;
}
|