diff --git a/webapp/src/pages/addLandmark/AddLandmark.tsx b/webapp/src/pages/addLandmark/AddLandmark.tsx index a43a626..c264867 100644 --- a/webapp/src/pages/addLandmark/AddLandmark.tsx +++ b/webapp/src/pages/addLandmark/AddLandmark.tsx @@ -22,6 +22,12 @@ export default function AddLandmark() { const [isButtonEnabled, setIsButtonEnabled] = useState(false); const {session} = useSession(); + let picture : string = ""; + + const setPicture = (e : string) => { + picture = e; + } + const setCoordinates = async (latitude : number, longitude : number) => { setIsButtonEnabled(false); (map.current as L.Map).panTo([latitude, longitude]); @@ -48,12 +54,12 @@ export default function AddLandmark() { let longitude : number = coords[1]; let description : string | undefined = (document.getElementById("description") as HTMLInputElement).value; - if (description.trim() === "") { - return; - } + let pictures : string[] = []; - let picture : string | undefined = (document.getElementById("images") as HTMLInputElement).value; - pictures.concat(picture); + if(picture !== "") { + pictures.push(picture); + } + let landmark : Landmark = { name : name, @@ -120,7 +126,24 @@ export default function AddLandmark() { Add an image - + { + const result = event.target?.result as string; + setPicture(result); + }; + reader.readAsDataURL(file); + }}/> {isButtonEnabled diff --git a/webapp/src/pages/home/Home.tsx b/webapp/src/pages/home/Home.tsx index 3a1dbdd..f5aa3b1 100644 --- a/webapp/src/pages/home/Home.tsx +++ b/webapp/src/pages/home/Home.tsx @@ -34,6 +34,7 @@ function Home(): JSX.Element { let element = {landmark.name} - {landmark.category} + No images ; array.push(element);