add task solution#3740
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly handles all functional requirements—the conditional age display, gender-aware partner naming, and marriage status messages all work as expected. However, there are three explicit checklist violations that need to be addressed: [CHECKLIST ITEM #1] In src/components/Person/Person.jsx, you're destructuring person from props but then accessing properties as person.name, person.age, etc. Instead, destructure all properties directly: const { name, age, sex, isMarried, partnerName } = person; [CHECKLIST ITEM #2] The ternary operator operands must be on separate lines for readability—format the condition, truthy value, and falsy value each on their own line. [CHECKLIST ITEM #3] Avoid nested ternary operators in JSX. Create a separate variable (e.g., const partnerLabel = sex === 'm' ? 'husband' : 'wife';) before the return statement and use that variable instead. The same destructuring issue exists in src/App.jsx. Once these checklist items are addressed, your solution will be complete.
✨ 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
| @@ -1,5 +1,6 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
This violates checklist item #1: Use destructuring for getting access to values of props object. The component should destructure all properties from the person object (name, age, isMarried, partnerName, sex) rather than accessing them via person.xxx throughout the component.
| @@ -1 +1,11 @@ | |||
| // export const Person = ({ person }) => (); | |||
| export const Person = ({ person }) => ( | |||
There was a problem hiding this comment.
Checklist item #1 violation: Use destructuring for accessing individual values. Destructure name, age, sex, isMarried, partnerName directly from props instead of accessing through person object. See the GOOD examples in checklist for the expected pattern.
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
Checklist item #2 violation: Ternary operands must be on separate lines for readability. The condition and each operand should be on its own line.
| {person.age && <p className="Person__age">I am {person.age}</p>} | ||
| <p className="Person__partner"> | ||
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
Checklist item #3 violation: Avoid nested ternary operators and multiple cases in conditional rendering. Create a separate variable for the partner label (wife or husband) before the return statement.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This solution requires changes before it can be approved. There are 2 critical issues that need fixing:
-
CHECKLIST VIOLATIONS (3 items): The code still has all 3 checklist violations from the previous review. In
Person.jsx, you need to: (1) destructurename,age,sex,isMarried,partnerNamefrom thepersonprop directly instead of accessingperson.nameetc.; (2) move ternary operands to separate lines with proper indentation; (3) extract the partner label (wife/husband) to a variable likeconst partnerLabel = sex === 'm' ? 'husband' : 'wife';before the return statement instead of using a nested ternary in JSX. -
TEST FAILURES: Two Cypress component tests are failing because your component outputs improper whitespace. The tests expect
'Natasha is my wife'but get'Natasha is my\n wife'- this indicates your JSX text spans multiple lines or has incorrect interpolation formatting. Fix the partner relationship text to render as a clean single-line string on one line in your JSX.
These are critical blockers that prevent the task from being considered complete. Please address all checklist items and ensure your component produces clean text output.
✨ 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
| @@ -1 +1,12 @@ | |||
| // export const Person = ({ person }) => (); | |||
| export const Person = ({ person }) => ( | |||
There was a problem hiding this comment.
[CHECKLIST ITEM #1] Instead of accessing person.name, person.age, etc., destructure the properties from person directly: const { name, age, sex, isMarried, partnerName } = person;
| {person.isMarried | ||
| ? `${person.partnerName} is my | ||
| ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
[CHECKLIST ITEM #3] Avoid nested ternary inside the template string. Create a separate variable before the return: const partnerLabel = sex === 'm' ? 'wife' : 'husband'; and use it in the template.
| {person.isMarried | ||
| ? `${person.partnerName} is my | ||
| ${person.sex === 'm' ? 'wife' : 'husband'}` | ||
| : 'I am not married'} |
There was a problem hiding this comment.
[CHECKLIST ITEM #2] Format ternary operands correctly - move each operand to a separate line with proper indentation.
| @@ -1,5 +1,6 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
[CHECKLIST ITEM #1] This destructures only person and then accesses properties as person.name, person.age, etc. Instead, destructure all properties directly from props: export const Person = ({ name, age, sex, isMarried, partnerName }) => (
| @@ -1,5 +1,6 @@ | |||
| import React from 'react'; | |||
| import './App.scss'; | |||
| import { Person } from './components/Person/Person'; | |||
There was a problem hiding this comment.
[CHECKLIST ITEM #1] Use destructured name instead of person.name
| import React from 'react'; | ||
| import './App.scss'; | ||
| import { Person } from './components/Person/Person'; | ||
|
|
There was a problem hiding this comment.
[CHECKLIST ITEM #1] Use destructured age instead of person.age
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
Anton-Kuchmasov
left a comment
There was a problem hiding this comment.
Good job!
Thread in fe_chat: https://mate.academy/chats/20895?selectedMessageId=11467880
DEMO LINK