Route Planner is a web application that allows users to calculate the distance and ETA (Estimated Time of Arrival) from a starting point to a destination with optional stops (waypoints) using Google Maps. The app also provides a shareable link for the calculated route.
- Calculate distance and ETA using Google Maps API.
- Add multiple waypoints (stops) to your route.
- Select travel mode: Driving, Bicycling, Transit, Walking.
- Generate a shareable URL for your route.
Before you begin, ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/Ravish108Coder/graviti-frontend-assignment cd route-planner
-
Install the dependencies:
npm install
-
Set up environment variables:
Create a
.env
file in the root directory of your project and add your Google Maps API key:NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-api-key
-
Run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
components
: Contains the main React components used in the application.public
: Contains static assets such as images and icons.styles
: Contains the CSS files for styling the application..env
: Environment variables for the project.next.config.js
: Configuration file for Next.js.package.json
: Lists the project dependencies and scripts.
-
Enter your starting point:
Use the autocomplete input to enter your starting point.
-
Enter your destination:
Use the autocomplete input to enter your destination.
-
Add waypoints (optional):
Click the "Add Stop" button to add waypoints (stops) to your route.
-
Select travel mode:
Choose from Driving, Bicycling, Transit, or Walking.
-
Calculate distance and ETA:
After entering all the details, the distance and ETA will be calculated and displayed.
-
Generate shareable URL:
Click the "Copy Link" button to copy the shareable URL to your clipboard. You can share this link with others to show them the calculated route.
Check out the live deployed version of the Route Planner here.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions, feel free to contact:
- Ravish Kumar - kravish1999@gmail.com
- https://github.com/Ravish108Coder
Thank you for using Route Planner!