dhvogel / trischedule

0 stars 0 forks source link

Implement onboarding flow #5

Open dhvogel opened 4 years ago

dhvogel commented 4 years ago

Here is a rough idea of how it could work.

Use react-google-login to tie user to google account https://www.npmjs.com/package/react-google-login

Use google email handle as username, for instance if my email is foo@gmail.com, my username is foo.

Check if there is a workout with athlete_id == username. If not, pop up a modal saying "would you like us to create a workout plan for you?"

If yes, write a copy of the 12-week plan to firestore with the athlete_id equal to the username

dhvogel commented 4 years ago

Instead of checking if there is a workout with athlete_id == username, we could have save a user object and check for its existence. It could look like:

{
    oauth_provider: "GOOGLE",
    user_id: "xxxxxx",
    athlete_id: "yyyyy",
    given_name: "zzz",
    family_name: "aaa"
}
dhvogel commented 4 years ago

And popping up a modal to ask if you want a workout plan seems unnecessary to begin with. It should just automatically create a 12-week workout plan for the olympic sprint (http://www.220triathlon.com/training/training-plans/free-olympic-distance-triathlon-training-plans/8346.html).

Perhaps this way more people will create workouts and then walk away. That's ok. Storing excess data is a problem I want to have. I can clear out workouts whenever I want. But I think that creating a workout immediately will increase the chance that someone actually uses it, and that's not something I can have whenever I want.

dhvogel commented 4 years ago

Perhaps to create the initial workout schedule, a template schedule can be read from the database, and then dates for each of the workouts are assigned at the time of creation.

If a workout has the following data structure:

{
    date: STRING                     // the day of the scheduled workout
    type: STRING                     // RUN, BIKE, or SWIM
    completed: bool
    strava_activity_id: string   // not MVP
    comments: string              // comments about the workout
    id: string                            // uuid
    athlete_id: string       // athlete to which this workout belongs
}

The 12-week olympic template could be composed of:

{
    days_from_start_date: int                     // days from the start of the workout schedule that this workout should occur. So 1 would occur 1 day after, 2 2 days after, etc.
        type: STRING
        comments: string
}