Skip to content

solution#103

Open
kami2693 wants to merge 2 commits into
mate-academy:masterfrom
kami2693:develop
Open

solution#103
kami2693 wants to merge 2 commits into
mate-academy:masterfrom
kami2693:develop

Conversation

@kami2693
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

Thank you for your hard work! Before this can be approved, please address a critical issue: the client and server use different message object structures (username/message vs. author/text/time). This mismatch will cause messages to display incorrectly or not at all. Please update your code so that both the client and server use the same message object structure (with author, text, and time fields) when sending and displaying messages. Once this is fixed, your chat app will work as expected! 🚀


✨ 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

Comment thread src/client.js
Comment on lines +145 to +157
function addMessageToChat(message) {
const messageElement = document.createElement('div');

messageElement.className = 'message';

messageElement.innerHTML = `
<span class="author">${message.author}</span>
<span class="time">${new Date(message.time).toLocaleTimeString()}</span>
<div class="text">${message.text}</div>
`;
messagesContainer.appendChild(messageElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue: The addMessageToChat function expects message objects to have author, time, and text properties. However, when sending a message in handleSendMessage, the client emits an object with username and message fields. This property mismatch will cause messages to display incorrectly or not at all. Please ensure that the message object structure is consistent between sending and displaying messages.

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! 🎉 Your implementation meets all the core requirements: the chat app supports real-time messaging, multiple rooms, consistent message structure, and a well-structured UI. All files are present and functional, and there are no critical issues. Keep up the good work! If you want to further improve, consider refining code style or adding more features in the future.


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

Footnotes

  1. Rate AI review example

Copy link
Copy Markdown

@alexander-ignatow alexander-ignatow left a comment

Choose a reason for hiding this comment

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

Looks good!

There are some minor comments, but you have got the idea of the sockets!

Comment thread src/client.js
@@ -0,0 +1,160 @@
/* global io, localStorage */
const socket = io('http://localhost:3000');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not critical for the learning project - but overall you should also pass parameters like endpoint URLs via the configuration

Comment thread src/index.html
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Чат</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 Tailwind is a good choice for a quick styling here

Comment thread src/index.html
<body class="bg-gray-100">
<div class="container mx-auto p-4">
<!-- Форма входу -->
<div id="loginForm" class="mb-4">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

div is not form

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.

3 participants