Skip to content

Tagore9930/mapty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ Mapty β€” Map Your Workouts

JavaScript Status License

A workout tracking application built while learning modern JavaScript concepts, Object-Oriented Programming, and application architecture.

Users can log running and cycling workouts directly on an interactive map using geolocation. The app stores workouts in local storage and displays them both on the map and in a workout list.


πŸš€ Live Demo

Visit the live app here: tagore-mapty.vercel.app


πŸ“Έ Screenshots

preview

Application Architecture

Workflow: Workflow

Architecture part-1: Architecture-part-1

Architecture final: Architecture-final


✨ Features

  • πŸ“ Get current location using Geolocation API
  • πŸ—ΊοΈ Interactive map using Leaflet.js
  • πŸƒ Add Running workouts
  • 🚴 Add Cycling workouts
  • πŸ“Œ Display workout markers on the map
  • πŸ“‹ Render workout list in sidebar
  • πŸ’Ύ Save workouts in Local Storage
  • πŸ”„ Restore workouts after page reload
  • 🎯 Move map to workout location on click
  • 🧠 Built using Object-Oriented Programming (OOP)

🧠 What I Learned

This project helped me understand:

  • Modern JavaScript ES6+ features
  • Object-Oriented Programming (Classes, Inheritance, Encapsulation)
  • Application planning and architecture
  • Working with third-party libraries
  • Geolocation API
  • Local Storage API
  • Event handling and DOM manipulation
  • Private class fields (#)
  • Asynchronous JavaScript concepts
  • Structuring real-world frontend applications

πŸ—οΈ Project Architecture

The application is built using class-based architecture.

Core Classes

Workout

Base class containing shared workout properties.

Running

Extends Workout

Additional properties:

  • cadence
  • pace

Cycling

Extends Workout

Additional properties:

  • elevationGain
  • speed

App

Main controller class responsible for:

  • Map rendering
  • Event handling
  • Creating workouts
  • Rendering UI
  • Local storage management

πŸ”„ Application Flow

  1. User allows location access
  2. Map loads using current location
  3. User clicks on the map
  4. Workout form appears
  5. User submits workout details
  6. Workout is:
    • Rendered on map
    • Added to sidebar list
    • Saved to local storage
  7. Clicking a workout moves map to its location

πŸ› οΈ Technologies Used

  • HTML5
  • CSS3
  • JavaScript (ES6+)
  • Leaflet.js
  • OpenStreetMap
  • Geolocation API
  • Local Storage API

πŸ“‚ Folder Structure

mapty/
β”‚   .prettierrc
β”‚   index.html
β”‚   README.md
β”‚   script.js
β”‚   style.css
β”‚
└───images
    β”‚   icon.png
    β”‚   logo.png
    β”‚
    β”œβ”€β”€β”€Project Plan
    β”‚       Mapty-architecture-final.png
    β”‚       Mapty-architecture-part-1.png
    β”‚       Mapty-flowchart.png
    β”‚       next-features.png
    β”‚
    └───project preview
            image.png

βš™οΈ Installation & Setup

1. Clone the repository

git clone https://github.com/Tagore9930/mapty.git

2. Navigate into the project

cd mapty

3. Open the project

Simply open index.html in your browser.


πŸ§ͺ How to Use

  1. Allow location access
  2. Click anywhere on the map
  3. Fill in workout details
  4. Submit the form by pressing Enter in any input field.
  5. Thw workout will appear:
    • On the map
    • In the sidebar list
  6. Click a workout in the list to move to its location

πŸ“Œ Future Improvements

future-plan

  • ✏️ Edit workouts
  • πŸ—‘οΈ Delete workouts
  • 🧹 Delete all workouts
  • πŸ“Š Sort workouts
  • 🌍 Show all workouts on map
  • ☁️ Weather integration
  • πŸ“ˆ Workout statistics
  • πŸ›£οΈ Draw routes and paths
  • πŸ”Ž Geocoding locations

πŸ’‘ Key JavaScript Concepts Used

Classes & Inheritance

class Running extends Workout {}
class Cycling extends Workout {}

Encapsulation with Private Fields

#map;
#workouts = [];

Local Storage

localStorage.setItem('maptyWorkouts', JSON.stringify(this.#workouts));

Geolocation API

navigator.geolocation.getCurrentPosition();

πŸ™Œ Acknowledgements

This project was built while learning from:

  • Jonas Schmedtmann
  • Leaflet.js
  • OpenStreetMap

πŸ“œ License

This project is for learning purposes and portfolio showcase.


πŸ‘¨β€πŸ’» Author

Tagore Banda


⭐ If you like this project, consider giving it a star on GitHub!

About

A workout tracking application built with modern JavaScript, OOP, Leaflet.js, and Geolocation API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors