|
|
@@ -1,7 +1,62 @@
|
|
|
+import {Avatar} from "primereact/avatar";
|
|
|
+import {MapContainer, TileLayer} from 'react-leaflet'
|
|
|
+import 'leaflet/dist/leaflet.css'
|
|
|
+import React, {useEffect, useState} from "react";
|
|
|
+import {SPRING_SERVER} from "../config";
|
|
|
+import {Button} from "primereact/button";
|
|
|
+import PathComponent from "../components/PathComponent";
|
|
|
+
|
|
|
export default function () {
|
|
|
+
|
|
|
+ const [positions, setPositions] = useState([[51.746732, 19.450587], [51.744347, 19.451015]]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ const params = new URLSearchParams({
|
|
|
+ lon1: 19.45056,
|
|
|
+ lat1: 51.74673,
|
|
|
+ lon2: 19.46211,
|
|
|
+ lat2: 51.74275
|
|
|
+ });
|
|
|
+
|
|
|
+ const url = SPRING_SERVER + '/route/nodes?' + params;
|
|
|
+
|
|
|
+ fetch(url)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ setPositions(data)
|
|
|
+ })
|
|
|
+ .catch(error => console.error(error));
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ const onButtonClick = () => {
|
|
|
+ console.log(positions)
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
- <>
|
|
|
- dadad
|
|
|
+ < >
|
|
|
+ <div className="flex flex-row h-screen">
|
|
|
+ <div className="w-5 bg-orange-500 flex flex-column">
|
|
|
+
|
|
|
+ <div className="flex flex-row align-self-center mt-3">
|
|
|
+ <Avatar className="align-self-center" icon="pi pi-user" size="xlarge" shape="circle"
|
|
|
+ style={{fontSize: '2.5rem'}}/>
|
|
|
+ <div className="font-medium text-500 pl-2 align-self-center">USERNAME</div>
|
|
|
+ <Button onClick={onButtonClick}></Button>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="w-full bg-orange-500">
|
|
|
+
|
|
|
+ <MapContainer style={{height: '100vh', width: '100wh'}} center={[51.74673, 19.45056]} zoom={15}
|
|
|
+ scrollWheelZoom={false}>
|
|
|
+ <TileLayer
|
|
|
+ attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
|
+ url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
|
+ />
|
|
|
+ <PathComponent positions={positions}></PathComponent>
|
|
|
+ </MapContainer>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</>
|
|
|
)
|
|
|
}
|