develop#1751
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The provided response is not valid JSON and does not match the expected schema. It contains a detailed explanation of JavaScript syntax errors instead of a properly formatted JSON object with 'decision' and 'reason' fields.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation does not meet the core requirements. The task explicitly requires event delegation — adding a single click listener to a parent element (like the gallery container) and using event.target to detect which child element was clicked. Instead, your code uses forEach to add individual listeners to each image, which is the opposite of event delegation. Additionally, your code only handles clicks on img elements, but the task specifies that event.target can be either an img or a element, so you need to handle both cases. To fix this: add one listener to the parent container, use event.target to check if the click was on an img or a element, and update the main image accordingly. The Cypress test failures are unrelated to your code — they appear to be environment timeout issues with the dev server, not functionality problems.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const small = document.querySelectorAll('.gallery__img'); | ||
|
|
||
| small.forEach((img) => { |
There was a problem hiding this comment.
Task requirement violation: You must use event delegation. Instead of adding listeners to each image individually, add ONE listener to a parent element (like the gallery container) and use event.target to detect which element was clicked.
| small.forEach((img) => { | ||
| img.addEventListener('click', () => { | ||
| if (bigI) { | ||
| bigI.src = img.src; | ||
| } | ||
| }); |
There was a problem hiding this comment.
Replace this loop-based approach with a single delegated event listener on a parent element. Use event.target to check if the click was on an img or a element, then update the main image accordingly.
No description provided.