From ab06a29a92e47d0fbd06a2fbbaff7ef85bb39306 Mon Sep 17 00:00:00 2001 From: professorabhay Date: Mon, 27 Nov 2023 09:04:43 +0530 Subject: [PATCH] Added comments for better understanding. --- .env | 2 +- index.html | 2 ++ src/App.jsx | 7 +++++++ src/components/Homepage.jsx | 13 +++++++++++++ src/components/LandingPage.jsx | 5 +++++ src/components/Loader.jsx | 4 ++++ src/index.jsx | 4 +++- 7 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 35ff20a..ad876ef 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ VITE_AUTH0_REDIRECT_URL="http://localhost:5173" VITE_API_NINJAS_X_API_KEY="API_NINJAS_X_API_KEY" - +// Enter Your Private Information of API Ninjas. diff --git a/index.html b/index.html index 8d58ba3..2ca4967 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,9 @@ +
+ diff --git a/src/App.jsx b/src/App.jsx index 046ce98..1224899 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2,14 +2,21 @@ import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; import LandingPage from "./components/LandingPage"; import Homepage from "./components/Homepage"; +// The main App component + function App() { return ( + // Use the BrowserRouter to enable React Router functionality + {/* Define the routes for different paths */} + {/* Route for the landing page */} } /> + {/* Route for the homepage */} } /> ); } +// Export the App component as the default export export default App; diff --git a/src/components/Homepage.jsx b/src/components/Homepage.jsx index 8b4d53c..17b4695 100644 --- a/src/components/Homepage.jsx +++ b/src/components/Homepage.jsx @@ -1,8 +1,13 @@ import html2pdf from "html2pdf.js"; import { useNavigate } from "react-router"; +// Homepage component for displaying scraped data + function Homepage() { + // React Router hook for navigation const navigateTo = useNavigate(); + + // Retrieve scraped data from session storage const fetchedData = sessionStorage.getItem("data"); // we can get the data passed from navigateTo()'s state param like this @@ -24,20 +29,27 @@ function Homepage() { worker.from(fetchedData, "string").to("pdf").set(opt).save(); }; + // Render the Homepage component return (
+ {/* Display the scraped data */} Scrapped Data:

{" "} {fetchedData}

+ + {/* Buttons for Download and ReScrape actions */}
+ {/* Download button */} + + {/* ReScrape button */}