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

added DOM-API homework #360

Merged
merged 8 commits into from
Sep 30, 2022
Merged

added DOM-API homework #360

merged 8 commits into from
Sep 30, 2022

Conversation

Yuliiadd
Copy link
Contributor

@Yuliiadd Yuliiadd commented Aug 30, 2022

DOM-API

Demo
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

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:

  • Give variables and functions meaningful names. Avoid generic names like item, element, key, object, array or their variations. Exception: helper functions that are specifically and intentionally designed to be multipurpose.
  • Function names should start with a verb as they denote actions; variables are normally nouns; boolean variables/functions start with is, does, has etc; variable containing multiple entities and functions returning lists contain entity name in plural form.
  • Have consistent code style and formatting. Employ Prettier to do all dirty work for you.
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

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,
Submissions Kottachecker 😺

@Yuliiadd
Copy link
Contributor Author

@OleksiyRudenko
Hi) Is everything good with my PR? Should I make some changes in it?

Copy link
Contributor

@madmaxWMFU madmaxWMFU left a 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.

Comment on lines 5 to 28
'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>`,
Copy link
Contributor

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: '.......'
}, ....]

Copy link
Contributor Author

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

Copy link
Contributor

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;
}

Copy link
Contributor Author

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!)))

submissions/YuliiaDyka/dom-api/base.js Outdated Show resolved Hide resolved
submissions/YuliiaDyka/dom-api/main.js Outdated Show resolved Hide resolved
submissions/YuliiaDyka/dom-api/main.js Outdated Show resolved Hide resolved
submissions/YuliiaDyka/dom-api/main.js Outdated Show resolved Hide resolved
submissions/YuliiaDyka/dom-api/main.js Outdated Show resolved Hide resolved
submissions/YuliiaDyka/dom-api/main.js Outdated Show resolved Hide resolved
@madmaxWMFU madmaxWMFU self-assigned this Sep 11, 2022
@Yuliiadd Yuliiadd requested a review from madmaxWMFU September 12, 2022 10:24
Comment on lines 81 to 88
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);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Contributor

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

submissions/YuliiaDyka/dom-api/main.js Show resolved Hide resolved
@Yuliiadd Yuliiadd requested a review from madmaxWMFU September 17, 2022 07:01
@Yuliiadd
Copy link
Contributor Author

@madmaxWMFU Hi! Please, re-review my DOM task

const title = document.querySelector('.title__chapter');
const description = document.querySelector('.description');

let newTitle = document.createElement("h4");
Copy link
Contributor

Choose a reason for hiding this comment

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

const

Comment on lines 87 to 88
const task = dataObj.filter(task => task.id == id);
const taskExesiceList = task[0].taskExesice.map(task => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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) {
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

15 also a variable

Comment on lines 48 to 49
default:
return;
Copy link
Contributor

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.

@Yuliiadd Yuliiadd requested a review from madmaxWMFU September 30, 2022 08:39
@Yuliiadd
Copy link
Contributor Author

@madmaxWMFU Hi! I corrected main.js based on your comments. Please, re-review.

Copy link
Contributor

@madmaxWMFU madmaxWMFU left a 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!

@madmaxWMFU madmaxWMFU merged commit 392dd75 into kottans:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants