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)
.then(response => response.json())
.then(data => {
setNames(data['names']);
setUsers(data['users']);
})
.catch(error => {
// TODO: error tooltip
setNames(data.names);
setUsers(data.users);
});
}, [roomId]);

View File

@ -7,11 +7,15 @@ import TableBody from '@mui/material/TableBody';
/* Displays a list of rooms */
export default function Rooms({ rooms, callbackRoomSelected }) {
if (rooms.length == 0) {
return;
}
return <TableContainer variant="outlined">
<Table aria-label="demo table">
<TableHead>
<TableRow>
<TableCell>Salle</TableCell>
<TableCell>Bâtiment</TableCell>
</TableRow>
</TableHead>
<TableBody>
@ -19,9 +23,10 @@ export default function Rooms({ rooms, callbackRoomSelected }) {
return <>
<TableRow
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>
</>
})}