diff --git a/src/App.js b/src/App.js index 6dbc15a..f8e2ec3 100644 --- a/src/App.js +++ b/src/App.js @@ -37,9 +37,6 @@ function App() { if (artistName) console.log("Artist Name: ", artistName); }, [artistName]); - - - return (
diff --git a/src/Odyssey/Odyssey.js b/src/Odyssey/Odyssey.js index 4ad3ea5..0bc8b97 100644 --- a/src/Odyssey/Odyssey.js +++ b/src/Odyssey/Odyssey.js @@ -94,22 +94,6 @@ const Odyssey = ({ } //make a request to taverondemand.azurewebsites.net/api/SaveTrips }; - const handleDownloadImage = async function () { - const element = document.getElementById("sharepage"); - html2canvas(element, { - logging: true, - proxy: `${process.env.REACT_APP_BACKEND}/GetImage`, - backgroundColor: "#282c34", - - ignoreElements: (node) => { - return node.nodeName === "IFRAME"; - }, - scrollY: window.scrollY * -1, - }).then((canvas) => { - let finalPosterName = posterName || "poster"; - canvas2image.saveAsPNG(canvas, finalPosterName, canvas.width, canvas.height); - }); - }; return ( @@ -138,16 +122,6 @@ const Odyssey = ({ variant="contained"> Share As Link - - ); diff --git a/src/Voyage/Voyage.js b/src/Voyage/Voyage.js index 00fe1ed..c4fc30d 100644 --- a/src/Voyage/Voyage.js +++ b/src/Voyage/Voyage.js @@ -1,10 +1,12 @@ -import { Stack, Typography } from "@mui/material"; +import { Stack, Typography, Box, Button } from "@mui/material"; import Map from "../Odyssey/map"; import SharePageList from "../Odyssey/SharePageList" import { useState, useEffect } from "react"; import { useParams } from 'react-router-dom'; import { useLoadScript } from "@react-google-maps/api" -import CircularProgress from '@mui/material/CircularProgress'; import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; +import html2canvas from "html2canvas"; +import canvas2image from "@reglendo/canvas2image"; function toLowerCaseKeys(obj) { if (Array.isArray(obj)) { return obj.map(toLowerCaseKeys); } else if (obj !== null && obj.constructor === Object) { return Object.keys(obj).reduce((acc, key) => { const lowerCaseKey = key.charAt(0).toLowerCase() + key.slice(1); acc[lowerCaseKey] = toLowerCaseKeys(obj[key]); return acc; }, {}); } return obj; } @@ -26,6 +28,22 @@ const Voyage = ({ googleMapsApiKey: process.env.REACT_APP_GCP_KEY, // Add your API key }); + const handleDownloadImage = async function () { + const element = document.getElementById("sharepage"); + html2canvas(element, { + logging: true, + proxy: `${process.env.REACT_APP_BACKEND}/GetImage`, + backgroundColor: "#282c34", + + ignoreElements: (node) => { + return node.nodeName === "IFRAME"; + }, + scrollY: window.scrollY * -1, + }).then((canvas) => { + let finalPosterName = posterName || "poster"; + canvas2image.saveAsPNG(canvas, finalPosterName, canvas.width, canvas.height); + }); + }; //get that row data from database //if unable to retrieve data redirect user to the main page, let them know first though @@ -50,7 +68,7 @@ const Voyage = ({ setPosterName(data.TripName); setConcerts(transformedConcerts); setUserLocation(result); - setStyle(data.mapStyleId); + setStyle(data.MapStyleId); setLoading(false); }); }, []); @@ -75,16 +93,37 @@ const Voyage = ({ const concerts2 = concerts.slice(middleIndex); return ( - - {isLoaded ? : null} - {posterName} - - - + + + {isLoaded ? : null} + {posterName} + + + + + + + - ); + + ); }; export default Voyage; \ No newline at end of file