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

Implement dom task #526

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

Implement dom task #526

wants to merge 3 commits into from

Conversation

Semka094
Copy link
Contributor

DOM task

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 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:

  • Make sure your code follows General Requirements
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

By the way, you may proceed to the next task before this one is reviewed and merged.

Sincerely yours,
Submissions Kottachecker 😺

@OleksiyRudenko
Copy link
Member

Please remove the image. It is not required for the code review

@OleksiyRudenko
Copy link
Member

@Semka094 please read the bot's message carefully and act accordingly.

@Semka094
Copy link
Contributor Author

@OleksiyRudenko I've read the bot's massage carefully but couldn't find any issues. Could you please point out where is the problem with the code?

@Semka094
Copy link
Contributor Author

@Semka094 please read the bot's message carefully and act accordingly.

Probably, I should have stated that I had completed self-checks and fixed the code.

@Semka094
Copy link
Contributor Author

I have completed self-checks.

@OleksiyRudenko OleksiyRudenko added the self-check-done Student confirmed that self-checks against requirements/common-mistakes are done label Sep 20, 2022
@madmaxWMFU madmaxWMFU self-assigned this Sep 22, 2022
@stale
Copy link

stale bot commented Oct 6, 2022

This issue has been automatically marked as stale because there were no activity during last 14 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

А. Чому так?
Найбільш розповсюджена причина: Студент не реагує на коментарі змінами коду і не задає запитань через брак часу або зміну життєвих пріоритетів. Покинуті піари відволікають менторів. Коли у студента з'явиться час, він/вона зможе перевідкрити той самий піар і продовжити роботу.

Б. Що робити, якщо в піарі нема оновлень, оскільки не зрозуміло, що треба зробити?
Варіант 1. Задати питання в самому PR.
Варіант 2. Задати питання в студентському чаті.

В. А якщо я все зробив(ла) і це ментор не рев'юває мої зміни?

  1. Переконайся, що ти відреагував(ла) на всі коментарі або кодом, або запитаннями, або відповідями. Напиши в PR і в чаті, що чесно вважаєш, що все зроблено і попроси повторне рев'ю. Якщо щось не зрозуміло, задай запитання.
  2. Реагуй на коментарі як менторів, так і інших учасників, включаючи ботів.
  3. Не ігноруй прохання типу * "Let's do some self-checks ..." * "Go through the checklist below..." * "mark fulfilled requirements..." * "if you would silently ignore this recommendation, a mentor may think that you are still working on fixes"
    навіть якщо вони написані ботом. Боти помічники і ментори покладаються на те, що прохання і пропозиції бота дотримуються.
    Не лінись піти по лінках в коментарях, погуглити термінологію та скористатись Google Translate.
  4. Можливо, у менторів склалися інші пріоритети через роботу, сімейні обставини і т.п. В такому разі, якщо ти зробив(ла) рекомендоване вище, то волай в чаті, що PR позначений stale, наче, все зроблено, а ментори чомусь не реагують - рятуйте!

Г. Хіба недостатньо того, що я додав(ла) коміт із змінами?
Часто буває так, що бачиш новий коміт, ідеш перевіряти, змін багато, доводиться перечитувати весь код. А потім з'ясовується, що одна невеличка зміна "відкладена на потім" чи з'являється ще один коміт і знов треба перечитувати все. Любіть нас, спілкуйтеся з нами - і ми відповімо повною взаємністю.

Традиційна пропозиція: задай питання по вищенаписаному в студентському чаті.

@stale stale bot added the 💤 Stale label Oct 6, 2022
@Semka094
Copy link
Contributor Author

Semka094 commented Oct 6, 2022

Hello, @OleksiyRudenko & @madmaxWMFU Can you please, check my PR?

@stale stale bot removed the 💤 Stale label Oct 6, 2022
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.

submissions/Semka094/dom/index.html Outdated Show resolved Hide resolved
},
}

document.getElementById('menu').addEventListener('click', (e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, split the code.

const menuWrap = document.getElementById('menu');
const getData = ({ target }) => { ... }
menuWrap.addEventListener('click', getData);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not see any benefit in splitting the code, can you please explain a bit?
In my opinion, it is redundant as neither menuWrap nor getData will be reused later in the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps for simple tasks it is not necessary to do this. But the declaration and description of individual functions makes it possible to clearly understand the structured code, re-calling of functions and other aspects for further support of the project.

submissions/Semka094/dom/script.js Outdated Show resolved Hide resolved
});


const contentElement = document.getElementById('content');
Copy link
Contributor

Choose a reason for hiding this comment

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

You better use the class name to search.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is better to use ID since it is unique and the class names might be used in other parts of the project.
In this case, I will be forced to rely on the order of elements in the DOM structure.
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is only a recommendation. Also you can read a post

submissions/Semka094/dom/script.js Outdated Show resolved Hide resolved
Comment on lines +110 to +112
const { sections } = data[menuId];

const pageSectionsHtml = sections.map(({title, items}) => {
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 { sections } = data[menuId];
const pageSectionsHtml = sections.map(({title, items}) => {
const const [[ title, { sections } ]] = Object.entries(data).filter(([key, val]) => key === menuId);
const pageSectionsHtml = sections.map(({title, items}) => {

Comment on lines +110 to +112
const { sections } = data[menuId];

const pageSectionsHtml = sections.map(({title, items}) => {
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 { sections } = data[menuId];
const pageSectionsHtml = sections.map(({title, items}) => {
const const [[ title, { sections } ]] = Object.entries(data).filter(([key, val]) => key === menuId);
const pageSectionsHtml = sections.map(({title, items}) => {

const titleHtml = title ? `<h3>${title}</h3>` : '';
const textHtml = items.map((text) => `<p>${text}</p>`).join('');

return `${titleHtml}${textHtml}`
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
return `${titleHtml}${textHtml}`
return `${titleHtml}${textHtml}`;

});


const contentElement = document.getElementById('content');
Copy link
Contributor

Choose a reason for hiding this comment

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

It is only a recommendation. Also you can read a post

},
}

document.getElementById('menu').addEventListener('click', (e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps for simple tasks it is not necessary to do this. But the declaration and description of individual functions makes it possible to clearly understand the structured code, re-calling of functions and other aspects for further support of the project.

@stale
Copy link

stale bot commented Apr 29, 2023

This issue has been automatically marked as stale because there were no activity during last 14 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

А. Чому так?
Найбільш розповсюджена причина: Студент не реагує на коментарі змінами коду і не задає запитань через брак часу або зміну життєвих пріоритетів. Покинуті піари відволікають менторів. Коли у студента з'явиться час, він/вона зможе перевідкрити той самий піар і продовжити роботу.

Б. Що робити, якщо в піарі нема оновлень, оскільки не зрозуміло, що треба зробити?
Варіант 1. Задати питання в самому PR.
Варіант 2. Задати питання в студентському чаті.

В. А якщо я все зробив(ла) і це ментор не рев'юває мої зміни?

  1. Переконайся, що ти відреагував(ла) на всі коментарі або кодом, або запитаннями, або відповідями. Напиши в PR і в чаті, що чесно вважаєш, що все зроблено і попроси повторне рев'ю. Якщо щось не зрозуміло, задай запитання.
  2. Реагуй на коментарі як менторів, так і інших учасників, включаючи ботів.
  3. Не ігноруй прохання типу * "Let's do some self-checks ..." * "Go through the checklist below..." * "mark fulfilled requirements..." * "if you would silently ignore this recommendation, a mentor may think that you are still working on fixes"
    навіть якщо вони написані ботом. Боти помічники і ментори покладаються на те, що прохання і пропозиції бота дотримуються.
    Не лінись піти по лінках в коментарях, погуглити термінологію та скористатись Google Translate.
  4. Можливо, у менторів склалися інші пріоритети через роботу, сімейні обставини і т.п. В такому разі, якщо ти зробив(ла) рекомендоване вище, то волай в чаті, що PR позначений stale, наче, все зроблено, а ментори чомусь не реагують - рятуйте!

Г. Хіба недостатньо того, що я додав(ла) коміт із змінами?
Часто буває так, що бачиш новий коміт, ідеш перевіряти, змін багато, доводиться перечитувати весь код. А потім з'ясовується, що одна невеличка зміна "відкладена на потім" чи з'являється ще один коміт і знов треба перечитувати все. Любіть нас, спілкуйтеся з нами - і ми відповімо повною взаємністю.

Традиційна пропозиція: задай питання по вищенаписаному в студентському чаті.

@stale stale bot added the 💤 Stale label Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-check-done Student confirmed that self-checks against requirements/common-mistakes are done 💤 Stale task-DOM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants