ancasimon / travel-diary

This project is an online journal that allows users to keep track of destinations on their bucket list and then capture diary entries when they actually get to visit these sites. It was further practice with using data from multiple collections in a Firebase database.
https://traveldiary-78295.web.app/#
1 stars 0 forks source link

User can submit a destination card and turn it into a diary entry #9

Closed ancasimon closed 4 years ago

ancasimon commented 4 years ago

User Story

As a user on the Travel Diary site, I can create new diary entries by typing in my notes in a destination card and clicking Submit.

Exercise instructions:

  1. The user should be able to type in the text box for a specific location, click the submit button on that card, and their entry should appear in a "diary" below the cards.
  2. The diary entry should contain the name of the location from the card the user was typing in (and hit the submit button in).
  3. It should also contain only the text that was in the text box from that card.
  4. The text box for that card should be cleared upon submission.
  5. The diary entries should build up as the user continues to type in cards and submit their entries. Newest entries should appear at the bottom.

AC

WHEN I look at a destination card, type in text in the input box, and click Submit, THEN a new diary entry gets created, which uses some of the card information and the data I submitted to display the following data: location name, timestamp of when I clicked Submit, and the notes I entered in the input box, AND the input text box on the card I typed in gets cleared, AND the diary entry gets added to the bottom of the diary section.

Note: The original destination card stays there - doesn't get deleted.

Dev Notes

ancasimon commented 4 years ago

Using moment.js to get timestamp: https://momentjs.com/

Run this for it to work: npm install moment --save

ancasimon commented 4 years ago

An article that helped me figure out how to transform the dates into timestamps and compare them and sort them correctly! https://www.codementor.io/@robertwozniak/javascript-story-sorting-records-by-dates-pf8oev5iy