Changeset 79a0317 for imaps-frontend/src/pages/MapView
- Timestamp:
- 01/21/25 03:08:24 (3 days ago)
- Branches:
- main
- Parents:
- 0c6b92a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/pages/MapView/MapView.jsx
r0c6b92a r79a0317 14 14 import ShapeRegistry from "../../scripts/util/ShapeRegistry.js"; 15 15 import {useAppContext} from "../../components/AppContext/AppContext.jsx"; 16 import Report from "../../components/Report/Report.jsx"; 17 import {Button} from "../IMaps/components/Button.jsx"; 16 18 17 19 const MapView = ({isPrivate}) => { 18 20 const {mapName} = useParams(); 19 21 const {username} = useAppContext(); 22 const {isAuthenticated} = useAppContext(); 20 23 21 24 const [mapLoaded, setMapLoaded] = useState(false); … … 28 31 const [searchParams, setSearchParams] = useSearchParams(); 29 32 const [mainEntrance, setMainEntrance] = useState({}); 33 const [canDisplayNavDownload,setCanDisplayNavDownload] = useState(false); 34 const [from,setFrom] = useState(""); 35 const [to,setTo] = useState(""); 30 36 31 37 const defaultNavObj = { … … 115 121 setFloors(respFloors); 116 122 123 console.log("FLOOR DATA: " + tlFloor?.mapData) 124 117 125 appInstance.loadMapN(tlFloor?.mapData) 118 126 setApp(appInstance); … … 163 171 const toEncoded = encodeURIComponent(toSearch).trimEnd() 164 172 173 setFrom(fromSearch); 174 setTo(toSearch); 175 165 176 httpService.get(`${config.view_maps.navigate}?from=${fromEncoded}&to=${toEncoded}`).then(path => { 166 177 app.drawRouteNEW(path); 178 179 167 180 }).catch(reason => { 168 181 console.log("err", reason) … … 185 198 } 186 199 200 useEffect(() => { 201 const handleNavigateEnd = (event) => { 202 console.log("DETAIL END",event.detail) 203 setCanDisplayNavDownload(true); 204 } 205 206 window.addEventListener("navend",handleNavigateEnd) 207 return () => { 208 window.removeEventListener("navend",handleNavigateEnd) 209 } 210 }, [app]); 211 187 212 188 213 useEffect(() => { … … 216 241 app.loadMapN(chFloor.mapData) 217 242 app.floorNum = floorNum; 218 219 243 220 244 console.log(`Floor changed to: ${floorNum}`); … … 257 281 handleFloorChange={handleFloorChange} 258 282 /> 283 {canDisplayNavDownload && 284 (<div className={styles.downloadRouteButton}> 285 <button onClick={() => { 286 app.getRouteImages({ 287 mapName: mapName, 288 from: from, 289 to: to 290 }) 291 setCanDisplayNavDownload(false) 292 }}> Download Route</button> 293 </div>) } 259 294 <FilterBar map={app} roomTypes={roomTypes}/> 260 295 </div> 261 296 )} 297 298 {isAuthenticated && <Report mapName = {mapName}></Report>} 262 299 <div className={styles.profileContainer}> 263 300 <Profile position="relative"/> … … 265 302 </div> 266 303 </div> 304 <div id="temp"></div> 267 305 268 306 <div className={styles.floorSelectorContainer}> … … 283 321 </div> 284 322 323 285 324 </div> 286 325 );
Note:
See TracChangeset
for help on using the changeset viewer.