jonasschmedtmann / complete-javascript-course

Starter files, final projects, and FAQ for my Complete JavaScript course
https://www.udemy.com/the-complete-javascript-course/?couponCode=C3GITHUB10
15.7k stars 16.82k forks source link

223-238 Mapty , toggle type of workout #140

Open webdiego opened 3 years ago

webdiego commented 3 years ago

Hello Jonas :)

I encountered an error in selecting the type of training; by default is setting on running and once is clicked "cycling" is changing rightly. (I've reached the lesson number 234)

The error arises when after selecting cycling, reloading the page show me still the type/input of cycling but with Cadence and if I click on running show me the ElevGain input.

Thanks for your effort for making this amazing course!

jonasschmedtmann commented 3 years ago

Hi Diego,

Thank you too for being my amazing student :)

Concerning your issue, please post this question in the official course Q&A on Udemy, this is the central place for all questions, and makes this information available to all students of the course :)

-- Jonas Schmedtmann jonas.iohttp://jonas.io / @jonasschmedtmanhttps://twitter.com/jonasschmedtman

On January 8, 2021 at 12:27 AM, Diego massarini (notifications@github.commailto:notifications@github.com) wrote: Hello Jonas :) I encountered an error in selecting the type of training; by default is setting on running and once is clicked "cycling" is changing rightly. (I've reached the lesson number 234) The error arises when after selecting cycling, reloading the page show me still the type of cycling but with cadence of running. Thanks for your effort for making this amazing course! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jonasschmedtmann/complete-javascript-course/issues/140, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEO2BAWG7WMFRV5QXMQENXTSYY7NHANCNFSM4VZVPOEA.

webdiego commented 3 years ago

Yes, I'll do it Thanks Jonas for replay me! Ciao :)

zastar23 commented 2 years ago

Hello Jonas, why is workout undefined here? It's driving me crazy, please enlighten me 😢

_

moveToPopup(e) {
    // BUGFIX: When we click on a workout before the map has loaded, we get an error. But there is an easy fix:
    if (!this.#map) return;

    const workoutEl = e.target.closest('.workout');

    if (!workoutEl) return;

    const workout = this.#workouts.find(
      work => work.id === workoutEl.dataset.id
    );

    console.log(this, workoutEl, workout);
    this.#map.setView(workout.latlng, this.#mapZoomLevel, {
      animate: true,
      pan: {
        duration: 1,
      },
    });

    // using the public interface
    // workout.click();
  }