import React from 'react'; import MenuItem from '@mui/material/MenuItem'; import Select from '@mui/material/Select'; import Typography from '@mui/material/Typography'; import API_URL from './config.js'; export default function ChangeFloor({ currentFloor, callbackFloorChanged }) { const [sites, setSites] = React.useState([]); const handleFloorChanged = (event) => { callbackFloorChanged(event.target.value); }; React.useEffect(() => { fetch(API_URL + "get_all_floors/") .then(response => response.json()) .then(data => { setSites(data); // Display a floor callbackFloorChanged(data[0].buildings[0].floors[0].id) }); }, [callbackFloorChanged]); if (currentFloor === undefined) return; var items = []; sites.forEach(site => { site.buildings.forEach(building => { building.floors.forEach(floor => { items.push( {site.name} / {building.name} / {floor.name} ) }) }) }); return <>
Changer d'étage
}