mirror of
https://gitlab.aliens-lyon.fr/encartes/web-interface.git
synced 2026-03-17 22:51:04 +01:00
Show informations about the selected room
This commit is contained in:
parent
421bc20abd
commit
3c3eeeba8a
35
src/App.js
35
src/App.js
@ -86,6 +86,39 @@ function RoomResearch({ callbackRoomSelected }) {
|
||||
</>
|
||||
}
|
||||
|
||||
function RoomInformation({ roomId }) {
|
||||
const [names, setNames] = React.useState([]);
|
||||
const [users, setUsers] = React.useState([]);
|
||||
|
||||
React.useEffect(() => {
|
||||
fetch("https://encartes.aliens-lyon.fr/api/map/show_place_info/" + roomId)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
setNames(data['names']);
|
||||
setUsers(data['users']);
|
||||
})
|
||||
.catch(error => {
|
||||
// TODO: error tooltip
|
||||
});
|
||||
}, [roomId]);
|
||||
|
||||
return <div style={{ padding: '24px' }}>
|
||||
<Typography component="h2" variant="h5" gutterBottom>
|
||||
Salle sélectionnée
|
||||
</Typography>
|
||||
<ul>
|
||||
<li>{
|
||||
names.length == 0 ? <em>Aucun nom défini</em> : names.join(', ')
|
||||
}</li>
|
||||
<li>{
|
||||
users.length == 0
|
||||
? <em>Aucun utilisateur défini</em>
|
||||
: 'Utilisée par ' + users.join(', ')
|
||||
}</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
function TopBar() {
|
||||
const [openAboutModal, setOpenAboutModal] = React.useState(false);
|
||||
|
||||
@ -144,6 +177,8 @@ export default function App() {
|
||||
setCurrentFloor(floor);
|
||||
setSelectedRoom(room);
|
||||
}} />
|
||||
<Divider />
|
||||
<RoomInformation roomId={selectedRoom} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user