chingu-voyages / v8-geckos-team-07

Habit-Tracker | Voyage-8 | https://chingu.io/
https://habit-tracker-gecko.herokuapp.com/
4 stars 4 forks source link

NewHabit Version 2.0 #71

Closed pjconnolly12 closed 5 years ago

pjconnolly12 commented 5 years ago

Updated the New Habit form to show as a modal.

Validation added to the form

New Habit form also automatically grabs the email of the signed in user to attach to the POST request

I had to add a button to bring up the modal for the new habit form, obviously we will revise this later once we fine tune the dashboard

paulywill commented 5 years ago

I'm getting a few compile errors locally when navigating directly to: /newhabit

image

TypeError: Cannot read property '0' of undefined
NewHabit.componentDidMount
src/components/newhabit/NewHabit.js:22
  19 | 
  20 | componentDidMount() {
  21 |     const user = this.props.data
> 22 |     this.setState({ name: user[0].email })
     | ^  23 |     console.log(user[0].email)
  24 | }
  25 | 
View compiled

On fresh fork and npm install... I have not created any data with my userid yet.

Logic for new user and nothing in user[0] ?

pjconnolly12 commented 5 years ago

I can definitely add a button that closes the modal if they don't want to fill it out. I will have to look into question 2, for question 3, the OK button closes the full modal so they can then see their dashboard, were you looking for something different? I can look into also adding a timer for it

paulywill commented 5 years ago

I just noticed that when I click "okay" it closes the modal and the it disappears.... but if click on thew new button it brings up the modal again with the confirmation button. I don't know what the behaviour "should be".

Should the confirmation button close but reset everything so if they decide to click on the button it start a fresh new modal?

We could still merge this if you want an setup up those items in another task-item/issue.

paulywill commented 5 years ago

@pjconnolly12 Just merge a PR that @SaraSweetie submitted that deleted newhabit.css and renamed NewHabit.js

Can you take a look at #73 and update this PR to resolve merge conflict?

SaraSweetie commented 5 years ago

@pjconnolly12 if you just place any new CSS you wrote for this into index.css that will take care of that part. newhabit.css no longer exists.

I just deleted the newhabit folder. NewHabit.js still exists. So you just need to update the path to that component.

pjconnolly12 commented 5 years ago

I am going to make these updates now so they match the PR Sara put in.

I will also fix the logic so the confirm modal doesn't appear when you re-open the new habit. I know exactly why it's happening so will be easy.