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 | 8x 8x 8x 1x | import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
import { useBackend } from "main/utils/useBackend";
import DiningCommonsTable from "main/components/DiningCommons/DiningCommonsTable";
import Form from "react-bootstrap/Form";
import { useState } from "react";
export default function HomePage() {
const { data } = useBackend(
// Stryker disable next-line all : don't test internal caching of React Query
[`/api/dining/all`],
{ method: "GET", url: "/api/dining/all" },
[],
);
const date = new Date().toISOString().split("T")[0];
const [selectedDate, setSelectedDate] = useState(date);
return (
<BasicLayout>
<h1>Dining Commons</h1>
<Form.Group className="mb-3">
<Form.Label htmlFor="selectedDate">Date Selector:</Form.Label>
<Form.Control
data-testid="HomePage-selectedDate"
id="selectedDate"
type="date"
value={selectedDate}
onChange={(e) => setSelectedDate(e.target.value)}
/>
</Form.Group>
<DiningCommonsTable commons={data} date={selectedDate} />
</BasicLayout>
);
}
|