diff --git a/src/App.tsx b/src/App.tsx index a962f0c..76e1368 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import Revalidator from "./Components/Revalidator/Revalidator"; import ActivationPage from "./Pages/ActivationPage/ActivationPage"; import ResetPasswordPage from "./Pages/ResetPasswordPage/ResetPasswordPage"; import EquipmentInstancesListPage from "./Pages/EquipmentInstancesListPage/EquipmentInstancesListPage"; +import EquipmentListPage from "./Pages/EquipmentListPage/EquipmentListPage"; const queryClient = new QueryClient(); const router = createHashRouter([ @@ -45,6 +46,16 @@ const router = createHashRouter([ ), errorElement: , }, + { + path: "/view/equipments", + element: ( + <> + + + + ), + errorElement: , + }, { path: "/activation/:uid/:token", element: ( diff --git a/src/Pages/EquipmentListPage/EquipmentListPage.tsx b/src/Pages/EquipmentListPage/EquipmentListPage.tsx new file mode 100644 index 0000000..83baf0b --- /dev/null +++ b/src/Pages/EquipmentListPage/EquipmentListPage.tsx @@ -0,0 +1,128 @@ +import { useQuery } from "@tanstack/react-query"; +import Header from "../../Components/Header/Header"; +import styles from "../../styles"; +import { EquipmentsAPI } from "../../Components/API/API"; +import { CircularProgress } from "@mui/material"; +import Table from "@mui/material/Table"; +import TableBody from "@mui/material/TableBody"; +import TableCell from "@mui/material/TableCell"; +import TableContainer from "@mui/material/TableContainer"; +import TableHead from "@mui/material/TableHead"; +import TableRow from "@mui/material/TableRow"; +import Paper from "@mui/material/Paper"; +import { colors } from "../../styles"; + +export default function EquipmentListPage() { + const equipments = useQuery({ + queryKey: ["equipments"], + queryFn: EquipmentsAPI, + }); + if (equipments.isLoading) { + return ( +
+
+
+ +

+ Loading +

+
+
+ ); + } + return ( +
+
+
+
+ + + + + ID + + Name + + + Description + + + Last Modified + + + + + {equipments.data ? ( + equipments.data.map((equipment) => ( + { + console.log("HEH"); + }} + > + + {equipment.id} + + + {equipment.name} + + + + {equipment.description} + + +
+
{equipment.last_updated}
+
+ {equipment.last_updated_by + ? "by " + equipment.last_updated_by + : ""} +
+
+
+
+ )) + ) : ( + <> + )} +
+
+
+
+
+
+ ); +}