Skip to content

solution#3635

Open
uselessmorning wants to merge 4 commits intomate-academy:masterfrom
uselessmorning:develop
Open

solution#3635
uselessmorning wants to merge 4 commits intomate-academy:masterfrom
uselessmorning:develop

Conversation

@uselessmorning
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Good work on the core logic for the Person component! The conditional rendering for age and marital status is implemented correctly. However, changes are needed because of a critical error and a couple of style guide violations.

  • Critical: In src/App.jsx, the Person component is used but it hasn't been imported. This causes the application to crash. Please add the import statement at the top of the file.
  • Style: In src/components/Person/Person.jsx, you need to fully destructure the properties from the person object in the component's signature to comply with [CHECKLIST ITEM #1].
  • Style: The nested ternary operator for displaying the partner's status should be formatted with each operand on a new line, as required by [CHECKLIST ITEM #2].

Please address these points to get your solution approved.


✨ 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. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

@@ -1 +1,11 @@
// export const Person = ({ person }) => ();
export const Person = ({ person }) => (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job destructuring the person prop. To fully follow the style guide in checklist item #1 and improve readability, consider destructuring the properties within the person object as well. This will let you use variables like name, age, and sex directly in the JSX without the person. prefix.

{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'}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Format ternary operator operands correctly - move each operand to the separate line'. The nested ternary operator should also be formatted with each part on a new line to improve readability, just like you did with the outer one.

Comment on lines +28 to +30
<Person person={misha} />
<Person person={olya} />
<Person person={alex} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Person component is used here, but it hasn't been imported into this file. You need to import it to make it available for use.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job fixing the import issue from the previous review! The app now runs, which is a big step forward. However, some changes are needed before this can be approved.

There's a critical issue in src/components/Person/Person.jsx with how props are destructured. The component receives a single person prop, so the props object looks like { person: { name: 'Misha', ... } }. Your current destructuring ({ name, age, sex, married, partner }) is looking for these properties at the top level of props, causing them all to be undefined. To fix this, you need to destructure the person object first. [CHECKLIST ITEM #1]

Additionally, the nested ternary operator for determining the partner's title ('wife' or 'husband') should be formatted across multiple lines for readability, as required by the style guide. [CHECKLIST ITEM #2]

Please address these two points, and your solution will be ready!


✨ 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. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

@@ -1 +1,12 @@
// export const Person = ({ person }) => ();
export const Person = ({ name, age, sex, isMarried, partnerName }) => (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The component is called with a single person prop, like <Person person={misha} />. This means the props object looks like { person: { ... } }. The current destructuring expects name, age, etc. at the top level of props, which isn't the case here, causing all values to be undefined.

To fix this, you should first destructure the person object from props, and then access its properties.

{age && <p className="Person__age">I am {age}</p>}
<p className="Person__partner">
{isMarried
? `${partnerName} is my ${sex === 'm' ? 'wife' : 'husband'}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #2: '[CODE STYLE] - Readabily is everything. Format ternary operator operands correctly - move each operand to the separate line:'.

The nested ternary operator sex === 'm' ? 'wife' : 'husband' should also be formatted across multiple lines for readability. To keep the JSX clean, you could move this logic into a new variable defined before the return statement.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

I am approving this solution as an educational override so you can move on to the next task.

Excellent work fixing the props destructuring! The component now functions perfectly and meets all the core requirements. The only remaining issue is a minor code style violation in src/components/Person/Person.jsx that was also present in the last review.

The nested ternary operator for determining the partner's title should be split across multiple lines for better readability, as per our style guide. [CHECKLIST ITEM #2]

For example:

const partnerLabel = sex === 'm'
  ? 'wife'
  : 'husband';

Please keep this formatting in mind for future tasks. You've made great progress!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

<h2 className="Person__name">My name is {name}</h2>
{age && <p className="Person__age">I am {age}</p>}
<p className="Person__partner">
{isMarried
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Format ternary operator operands correctly - move each operand to the separate line'.

The nested ternary operator sex === 'm' ? 'wife' : 'husband' should be split across multiple lines for better readability. Consider creating a separate variable for the partner's title (e.g., wife or husband) before the return statement to make the JSX cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants