import PageContainer from "./PageContainer";
import ConstructionMapController from "maps/mapObjectControllers/ConstructionMapController";
import { useLocation } from "react-router";

export default function ConstructionSiteMap() {
  const location = useLocation();

  return (
      <PageContainer>
        {location.state !== undefined &&
        location.state !== null &&
        location.state.long !== undefined &&
        location.state.lat !== undefined ? (
          <ConstructionMapController
            startingView={{
              longitude: location.state.long,
              latitude: location.state.lat,
              zoom: 18,
              transitionDuration: 0
            }}
          />
        ) : (
          <ConstructionMapController />
        )}
      </PageContainer>
  );
}