-
Notifications
You must be signed in to change notification settings - Fork 113
Ruby - Anh Huynh Chat Log #110
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
base: main
Are you sure you want to change the base?
Conversation
…one of the tests in Wave 3
kendallatada
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Anh! Your project has been scored as green. You can find my comments in your PR. Let me know if you have any questions. Nice work! 😊
| // { | ||
| // 'sender':'Vladimir', | ||
| // 'body':'why are you arguing with me', | ||
| // 'timeStamp':'2018-05-29T22:49:06+00:00', | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to remove unused code, print tests, and any comments that shouldn't be published before finalizing a project. It's good practice to keep a clean main branch that's production ready. This helps with the readability and maintainability of a project. 🧹😌
| const likeCounts = () => { | ||
| let likeCount = 0; | ||
| for (let entry of chatData) { | ||
| if (entry.liked === true) { | ||
| likeCount += 1; | ||
| } | ||
| } | ||
| return likeCount; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job calculating the number of likes from state! ✨
| const chatEntryComponents = props.entries.map((entry, index) => { | ||
| return ( | ||
| <li key={index}> | ||
| <ChatEntry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it's best practice not to use the index of an item as the list item key in React since the order of items in an array can change. I'd recommend using the entry ID as the key. Also, to cut down on the number of tags, you can put the key attribute directly on the <ChatEntry> component and drop the <li> tag. This means you also won't need the <ul> tag on line 24.
| ChatLog.propTypes = { | ||
| entries: PropTypes.arrayOf( | ||
| PropTypes.shape({ | ||
| id: PropTypes.number.isRequired, | ||
| sender: PropTypes.string.isRequired, | ||
| body: PropTypes.string.isRequired, | ||
| timeStamp: PropTypes.string.isRequired, | ||
| liked: PropTypes.bool, | ||
| }) | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job with your prop types! I'd recommend making liked required and also the entries array required too.
| props.onUpdate(updatedChatEntry); | ||
| }; | ||
|
|
||
| const like = props.liked ? '❤️' : '🤍'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good usage of the ternary operator ✨
| sender: PropTypes.string.isRequired, | ||
| body: PropTypes.string.isRequired, | ||
| timeStamp: PropTypes.string.isRequired, | ||
| liked: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend having liked be a required prop here too
No description provided.