Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User can view their entries #2

Closed
21 tasks done
kaitlin-lovrich opened this issue Sep 18, 2023 · 0 comments
Closed
21 tasks done

User can view their entries #2

kaitlin-lovrich opened this issue Sep 18, 2023 · 0 comments

Comments

@kaitlin-lovrich
Copy link
Owner

kaitlin-lovrich commented Sep 18, 2023

💰 Motivation

Once a user records some journal entries, they'll want to see them.

📐 Plan

Display the user's journal entries in reverse chronological order so they can see the newest ones first.

🖼️ Wireframes

user can view their entries mobile
user can view their entries desktop

✅ Task List

  • Add an empty unordered list to the div[data-view="entries"] element in the HTML.
  • Create some dummy journal entries to the unordered list in the HTML and style them to match the example entries in the figma. Each entry’s content should be in a single li element within the ul element.
  • Check that the example entries you just created in the unordered list are responsive for both mobile and desktop screens.
  • Define a function named renderEntry with a single parameter named entry. This parameter represents a single object for a single entry from the data.entries array. The function should generate and return a DOM tree for a single entry that matches the entries you created in the unordered list.
  • Create an event listener on the document which listens for the DOMContentLoaded event. In the callback function for that event, loop through the data.entries array and generate a DOM tree for each entry in the array, and append that DOM tree to the unordered list.
  • Remove the example HTML entries from index.html once the user's entries are successfully being appended to the DOM on page load and replace them with a message indicating that no entries have been recorded which matches the figma.
  • Create a function named toggleNoEntries which toggles the no entries text to show or hide when the function is called.
  • Create a new function named viewSwap with a single parameter representing the name of the view to show (the value will be either ”entries” or ”entry-form”). This function should show the view whose name was provided as an argument, as well as assign the string argument to the data.view property so that the currently shown view is tracked in the data model for the application.
  • Add an anchor to the navbar to show the ”entries” view. You will need to create an event handler function that utilizes the viewSwap function to show the proper view.
  • Add an anchor to the entries view to show the entry-form. It should be styled like a button with the text NEW, and must match the figma.
  • Update the submit callback for the form to do the following:
    • Render a DOM tree for the newly submitted entry object using the renderEntry function.
    • Prepends the new DOM tree to the unordered list.
    • Use the viewSwap to show the ”entries” view.
    • conditionally uses the toggleNoEntries function as needed to remove the no entries text.
  • Update the DOMContentLoaded callback function to do the following:
    • uses the viewSwap function to show the view which was displayed prior to page refresh.
    • conditionally uses the toggleEntries function as needed to show or remove the no entries text.
  • Clean up all unnecessary styling.
  • Test the app some more in a private browsing tab.
  • Fix all errors.
kaitlin-lovrich added a commit that referenced this issue Sep 20, 2023
…yle them to match example entries in figma #2 & #3
kaitlin-lovrich added a commit that referenced this issue Sep 21, 2023
…ch entry, and added a data-entry-id attribute to the li that stores the entryId of the entry being rendered #1 #2 #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant