Update menu

This commit is contained in:
Adrien Vannson 2023-02-28 17:49:15 +01:00
parent b06eec2c37
commit 104da0242b
No known key found for this signature in database
GPG Key ID: FE2E66FD978C1A55
2 changed files with 9 additions and 7 deletions

View File

@ -93,11 +93,8 @@ function RoomInformation({ roomId }) {
fetch("https://encartes.aliens-lyon.fr/api/map/get_place_info/" + roomId) fetch("https://encartes.aliens-lyon.fr/api/map/get_place_info/" + roomId)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
setNames(data['names']); setNames(data.names);
setUsers(data['users']); setUsers(data.users);
})
.catch(error => {
// TODO: error tooltip
}); });
}, [roomId]); }, [roomId]);

View File

@ -7,11 +7,15 @@ import TableBody from '@mui/material/TableBody';
/* Displays a list of rooms */ /* Displays a list of rooms */
export default function Rooms({ rooms, callbackRoomSelected }) { export default function Rooms({ rooms, callbackRoomSelected }) {
if (rooms.length == 0) {
return;
}
return <TableContainer variant="outlined"> return <TableContainer variant="outlined">
<Table aria-label="demo table"> <Table aria-label="demo table">
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell>Salle</TableCell> <TableCell>Salle</TableCell>
<TableCell>Bâtiment</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
@ -19,9 +23,10 @@ export default function Rooms({ rooms, callbackRoomSelected }) {
return <> return <>
<TableRow <TableRow
hover={true} hover={true}
onClick={() => callbackRoomSelected(room['idFloors'][0], room['idRoom'])} onClick={() => callbackRoomSelected(room.floors[0].id, room.idPlace)}
> >
<TableCell>{room['idRoom']}</TableCell> <TableCell>{room.namePlace[0]}</TableCell>
<TableCell>{room.nameBuilding}</TableCell>
</TableRow> </TableRow>
</> </>
})} })}