Skip to content

LONDON | Gislaine Della Bella | Module-Data-Groups | WEEK 3 | Todo List #225

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Della-Bella
Copy link

Learners, PR Template

Self checklist

  • [x ] I have committed my files one by one, on purpose, and for a reason
  • [x ] I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • [x ] I have tested my changes
  • [x ] My changes follow the style guide
  • [x ] My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Hello Voluntear,
Here is my code. It is still dificult to write all the function on my onw so I'm trying to undestand the challenges with some tutorials I found on Youtube.
thank you again for your time helping us,
thank you,

@Della-Bella Della-Bella added the Needs Review Participant to add when requesting review label Dec 22, 2024
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 2, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While your method works, it missed using the approach specified in the Instructions section.

  • Your code does not use the supplied array 'todos` to store the "todo items"
  • You didn't implement populateTodoList()
  • Each todo item does not has the specified HTML

More importantly, you missed the opportunities to apply an approach commonly used in implementing GUI. The approach works in the following way:

  • Represent the "application state" using only JS data.
    • For this app, the todos array would be the application state.
  • Dynamically update the view using HTML and CSS based on the "application state".
    • The code inside populateTodoList() should, based on the value of todos, construct the list items using the API like document.createElement(), and add event listeners to the <i> elements using .addEventListener().
  • Whenever you need to mark or unmark an item as completed, change the completed property of the corresponding item in todos.
  • Whenever you need to add/delete an item, do it in todos.
  • Every time todos is modified, call populateTodoList() to update the view.

If you have difficulty figuring out how to implement this, try asking ChatGPT or ask a volunteer.
(Let me know if you want to know what question you can ask ChatGPT to get a sample code)

If you want to store todos in window.localStorage as a bonus feature, you can lookup How to store an array of objects in window.localStorage.


In VSCode, your can right-click in the editor and select "Format Document" to help you indent the code properly. It works for HTML, CSS, and JS. Properly indented code makes code reading easier.

<h2>To-Do-List <img src="assets/icon.png" alt="icon of an arrow"></h2>
<div class="row">
<input type="text" id="input-box" placeholder="New todo...">
<button onclick="addTask()" >add</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using onclick="addTask()" to assign event listener, you should try using

  let theElement = ...; // select the element
  theElement.addEventListener("click", () => {
     // 
  });

The latter approach is more flexible, and works also for dynamically created elements.

@cjyuan cjyuan added 👀 Review Requirements Changes requested to meet requirements Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 2, 2025
@Della-Bella
Copy link
Author

Hi Cyuan,

Now I understand this approach for the populate function is the same as the one we are using for the TV show, and it is much clearer to me now.
I have made the changes.

Thank you!

@Della-Bella Della-Bella added the Complete Volunteer to add when work is complete and review comments have been addressed label Jan 16, 2025
@Della-Bella
Copy link
Author

I forgt to mention the tip about "format the code "with right click was the best of my day !!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed 👀 Review Requirements Changes requested to meet requirements Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants