-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
added DOM-API homework #360
Conversation
Hey! Congratulations on your PR! 😎😎😎 Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code. Go through the requirements/most common mistakes listed/linked below and fix the code as appropriate. If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat. When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly. Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒 Please, make sure you haven't made common mistakes Universal recommendations:
Also take a note of the requirements above and follow them in all your future projects. By the way, you may proceed to the next task before this one is reviewed and merged. Sincerely yours, |
@OleksiyRudenko |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! See some comments below.
'Git Basics':`<ol class="task"> | ||
<li class="task__item"> | ||
Прослухайте тижні 1 і 2 курсу <a class="link tomato" href="https://www.coursera.org/learn/introduction-git-github">Introduction to Git and GitHub</a> | ||
</li> | ||
<li class="task__item"> | ||
Пройдіть наступні рівні тут <a class="link tomato" href="https://learngitbranching.js.org/">learngitbranching.js.org:</a> | ||
<ul> | ||
<li class="task__item">Основи: Introduction Sequence, Ramping Up</li> | ||
<li class="task__item">Віддалені репозиторії: Push & Pull -- віддалені репозиторії в Git!</li> | ||
</ul> | ||
</li> | ||
<li class="task__item"> | ||
Створіть репозиторій та назвіть його kottans-frontend. | ||
</li> | ||
<li class="task__item"> | ||
Створіть README.md для репозиторію. | ||
</li> | ||
<li class="task__item"> | ||
Опишіть свої враження від вивченого матеріалу. | ||
</li> | ||
<li class="task__item"> | ||
Надішліть pull-request сюди Kottans/mock-repo пропонуючи зміни. | ||
</li> | ||
</ol>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid a tag name in the data list.
Get more interactive objects.
const taskList = [{
id: 0,
taskName: 'Git Basics',
taskExesice: ['Опишіть свої враження від вивченого матеріалу.', 'Надішліть pull-request сюди Kottans/mock-repo пропонуючи зміни.', ....... ],
linkHomePage: '.....',
linkTaskPage: '.......'
}, ....]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello) I fixed dataObj, but left the link in list items, because that was the only way I could keep the links to certain words in the description of the task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const dataObj = [
{
taskName: 'Git Basics',
taskExesice: [
{
url: "https://www.coursera.org/learn/introduction-git-github",
urlText: "Introduction to Git and GitHub",
taskText: null
},
{
url: "https://learngitbranching.js.org/",
urlText: "learngitbranching.js.org",
taskText: "Пройдіть наступні рівні тут "
},
{
url: null,
urlText: null,
taskText: "Створіть репозиторій та назвіть його kottans-frontend."
},
{
url: null,
urlText: null,
taskText: "Створіть README.md для репозиторію."
},
{
url: null,
urlText: null,
taskText: "Опишіть свої враження від вивченого матеріалу."
},
{
url: null,
urlText: null,
taskText: "Надішліть pull-request сюди Kottans/mock-repo пропонуючи зміни."
},
]
},
{
taskName: 'Linux CLI and Networking',
taskExesice: [
{
url: "https://linuxsurvival.com/linux-tutorial-introduction/",
urlText: "Linux Survival (4 modules)",
taskText: null
},
{
url: "https://code.tutsplus.com/uk/tutorials/http-the-protocol-every-web-developer-must-know-part-1--net-31177",
urlText: "HTTP: Протокол, який повинен розуміти кожний веб-розробник - Частина 1",
taskText: null
},
{
url: "https://code.tutsplus.com/uk/tutorials/http-the-protocol-every-web-developer-must-know-part-2--net-31155",
urlText: "HTTP: Протокол, який повинен розуміти кожний веб-розробник - Частина 2",
taskText: null
},
]
},
......
];
function renderPage(targetTaskName) {
const desc = document.createElement('div');
desc.classList.add('description');
const taskList = document.createElement("ol");
taskList.classList.add('task');
const filteredTaskList = dataObj.filter(task => task.taskName === targetTaskName);
const [{ taskExesice }] = filteredTaskList;
const taskExesiceList = taskExesice.map(task => {
const { taskText, url, urlText } = task;
return`
<li class="task__item">
${taskText ? taskText : ""}
${url ? `<a class="link tomato" href="${url}" target="_blank">${urlText}</a>` : ""}
</li>
`;
}).join('');
taskList.innerHTML = taskExesiceList;
desc.append(taskList);
return desc;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@madmaxWMFU thank you! Its works!)))
dataObj.filter(function(item) { | ||
return item.taskName == taskName; | ||
})[0].taskExesice.forEach(item => { | ||
const listItem = document.createElement("li"); | ||
listItem.classList.add("task__item"); | ||
listItem.innerHTML = item; | ||
taskList.append(listItem); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataObj.filter(function(item) { | |
return item.taskName == taskName; | |
})[0].taskExesice.forEach(item => { | |
const listItem = document.createElement("li"); | |
listItem.classList.add("task__item"); | |
listItem.innerHTML = item; | |
taskList.append(listItem); | |
}); | |
const filteredTaskList = dataObj.filter(task => task.taskName === taskName) | |
const [{ taskExesice }] = filteredTaskList; | |
taskExesice.forEach(item => { | |
const listItem = document.createElement("li"); | |
listItem.classList.add("task__item"); | |
listItem.innerHTML = item; | |
taskList.append(listItem); | |
}); |
taskList.classList.add('task'); | ||
|
||
dataObj.filter(function(item) { | ||
return item.taskName == taskName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your menu with tasks is static. If someone who didn't know about your functionality changes the task name in dataObj
, then we have no working link.
Add a property taskId
to dataObj
and compare results by id
@madmaxWMFU Hi! Please, re-review my DOM task |
const title = document.querySelector('.title__chapter'); | ||
const description = document.querySelector('.description'); | ||
|
||
let newTitle = document.createElement("h4"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
const task = dataObj.filter(task => task.id == id); | ||
const taskExesiceList = task[0].taskExesice.map(task => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const task = dataObj.filter(task => task.id == id); | |
const taskExesiceList = task[0].taskExesice.map(task => { | |
const [{ taskExesice }] = dataObj.filter(task => task.id == id); | |
const taskExesiceList = taskExesice.map(task => { |
checkboxes.forEach(item => { if (item.checked) { currentProgress++;}}); | ||
progressDig.textContent = Math.floor((currentProgress / progressMax * 100)) + "%"; | ||
progressLine.style.width = Math.floor((currentProgress / progressMax * 100)) + "%"; | ||
if (currentProgress == 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3
set like a variable
Maybe totalParts
nav_items.forEach(item => { | ||
item.classList.remove('selected'); | ||
}); | ||
changePage('Welcome to Kottans!', 15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15
also a variable
default: | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you write and return nothing? I think it must be delete.
@madmaxWMFU Hi! I corrected main.js based on your comments. Please, re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I approve of your work. Good luck with future tasks!
DOM-API
Demo
Code base
The code is submitted in a dedicated feature branch.
Only code files are submitted.
Please, review.