Skip to content

Vladimir Kulikov #4

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 4 commits into
base: master
Choose a base branch
from
Open

Conversation

kulikov98
Copy link

No description provided.

@@ -0,0 +1,20 @@
h1, h2 {

Choose a reason for hiding this comment

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

Are you sure that all h1, h2 on your page should have the same margin? It's better to add class and create css rule for class

padding: 20px 0;
}

select {

Choose a reason for hiding this comment

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

Same with previous. Select should have class

<label for="task">Task</label>
<input type="text" class="add-task-text form-control" id="task" aria-describedby="taskHelp"
placeholder="What should be done?">
<div class="invalid-feedback">

Choose a reason for hiding this comment

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

If you add additional functionality, it has to work. There isn't a requirement for any validation in the task description. It's a good idea to prohibit adding an empty task. But it doesn't work. I'm able to add an empty task

<tr>
<th scope="col">Task</th>
<th scope="col">Deadline</th>
<th scope="col"></th>

Choose a reason for hiding this comment

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

It's strange that the column doesn't have a name. You can call it 'Actions' or something like this

};

var run = function () {
if (!localStorage.getItem('todoList')) localStorage.setItem('todoList', "[]");

Choose a reason for hiding this comment

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

It's better to write like this (even when you have only one action):

if (...) {
    ...
}

https://stackoverflow.com/questions/4797286/are-braces-necessary-in-one-line-statements-in-javascript


var removeTaskBtns = document.querySelectorAll(DOMSelectors.removeTaskBtns);
removeTaskBtns.forEach(function (btn) {
btn.addEventListener('click', removeTask);

Choose a reason for hiding this comment

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

You can just add a listener for the delete button when you create a new task. It'll work faster


var completeTaskBtns = document.querySelectorAll(DOMSelectors.completeTaskBtns);
completeTaskBtns.forEach(function (btn) {
btn.addEventListener('click', completeTask);

Choose a reason for hiding this comment

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

Same with delete button


var filters = document.querySelectorAll(DOMSelectors.filters);
filters.forEach(function (filter) {
filter.addEventListener('change', render);

Choose a reason for hiding this comment

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

Same with the button Add task

saveTasks(tasks);
task.value = "";
deadline.value = "";
render();
Copy link

@mariia-zu mariia-zu Aug 20, 2019

Choose a reason for hiding this comment

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

You definitely don't need to rerender existed tasks, they haven't been changed for sure.
Here you should add a new task and listener on complete and delete.

return task;
});
saveTasks(updatedTasks);
render();

Choose a reason for hiding this comment

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

Here also only one task has been changed

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

Successfully merging this pull request may close these issues.

2 participants