Solution#2038
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on structuring the application and implementing the core logic! The component separation is well done. However, there are a couple of issues that need to be addressed before this can be approved.
First, in src/components/PostInfo/PostInfo.tsx, the text "Posted by" is displayed even when there is no user associated with the post. This is a minor visual bug and also violates the guideline on rendering static text [CHECKLIST ITEM #5]. To fix this, please move the "Posted by" text inside the conditional block so it only renders when post.user exists.
Additionally, the function names in src/App.tsx could be more descriptive. According to our guidelines [CHECKLIST ITEM #6], functions that find an entity by a filter should specify it in the name. Please rename getUser to getUserById and getComments to getCommentsByPostId for better clarity.
Once these changes are made, your solution will be ready for approval. Keep up the great work!
✨ 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
| <h3 className="PostInfo__title">{post.title}</h3> | ||
|
|
||
| <p> | ||
| {' Posted by '} |
There was a problem hiding this comment.
This method of rendering a static string is inconsistent with the guidelines in checklist item #5. It's better to place static text directly within the JSX. To conditionally render both the text and the UserInfo component, you can group them together within the post.user check.
|
|
||
| <p> | ||
| {' Posted by '} | ||
| function getUser(userId: number): User | null { |
There was a problem hiding this comment.
This violates checklist item #6: 'If you are searching some entity by some filter, specify it in function/method name'. Since this function finds a user by their ID, a more descriptive name would be getUserById.
| </a> | ||
| </p> | ||
| </div> | ||
| function getComments(postId: number): Comment[] { |
There was a problem hiding this comment.
This violates checklist item #6: 'If you are searching some entity by some filter, specify it in function/method name'. This function filters comments by postId, so it should be named getCommentsByPostId for clarity.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this submission! You've successfully addressed all the functional requirements and naming conventions from the previous review. The application is well-structured, the components are logically separated, and everything works as expected.
I am approving your solution.
As a final tip for even cleaner code, you can simplify how you add static text in JSX. For example, in CommentInfo.tsx, instead of <strong>...</strong>{' by '}<a...>, you can write it more directly as <strong>...</strong> by <a.... This is a minor style point that improves readability, but your current implementation is fully functional.
Great job overall!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| <div className="CommentInfo__title"> | ||
| <strong className="CommentInfo__name">{comment.name}</strong> | ||
|
|
||
| {' by '} |
There was a problem hiding this comment.
This way of adding a static string is a bit verbose and could be simplified. According to checklist item #5, it's better to avoid using {'...'} for static text. You can write the string directly between the components, like ...</strong> by <a..., which is cleaner and improves readability.
DEMO LINK