Conversation
|
Looks like some client-side tests are failing |
| this.handleSubmit(); | ||
| } | ||
| } | ||
| // if (event.key === ' ') { |
There was a problem hiding this comment.
Is the plan to re-add the commented out code?
There was a problem hiding this comment.
we need to talk about the userflow and UX, as mentioned below. do we want each word occupy one bubble, and as user type each word, more bubbles will pop out?
There was a problem hiding this comment.
Does this answer: https://github.com/imann24/now/pull/15/files#r315968692 ?
| value={this.state.text} | ||
| onKeyPress={this.onKeyPress} | ||
| onChange={e => this.setState({ text: e.target.value })}/> | ||
| onChange={e => this.setState({ text: e.target.value },()=> console.log())}/> |
There was a problem hiding this comment.
Perhaps some of your changes aren't committed yet?
| </div> | ||
|
|
||
| <ChatFeed | ||
| messages={[new Message({id: 1,message: this.state.conversation.lastMessage.text,senderName:this.state.user.name}), |
There was a problem hiding this comment.
Hmm, so looks like this kind of changes the spec.
I would imagine that breaks in conversation create a new chat bubble. Instead of only have a single chat bubble per user
There was a problem hiding this comment.
Also we should clarify if a chat session only allows 2 users max
There was a problem hiding this comment.
what if we only allow 2 users for now, for simplicity sake. and we can add group chat functionality in later version.
There was a problem hiding this comment.
Hmm, so looks like this kind of changes the spec.
I would imagine that breaks in conversation create a new chat bubble. Instead of only have a single chat bubble per user
do you mean each word would occupy one bubble, and as user type each word, more bubbles will pop out?
There was a problem hiding this comment.
Sounds good on 2 users. Spun up an extra ticket to cover error handling (e.g. a 3rd user tries to join): #17
Let's see Issue #17 is outside the scope of this PR though and tackle that later.
In terms of bubbles, my thought is: create new bubbles whenever the person talking changes. For example:
Isaiah is talking (bubble 1 - blue)
Bill starts talking (bubble 2 - white)
Isaiah resumes talking (bubble 3 - blue)
Bill resumes talking (bubble 4 - white)
What do you think?
| "recursive-install": "^1.4.0" | ||
| }, | ||
| "dependencies": { | ||
| "react-chat-ui": "^0.3.2" |
There was a problem hiding this comment.
The hierarchy of this repo is kind of difficult. So:
|-package.json : top level development dependencies
|-- src
|--- server
|---- package.json : dependencies for frontend (probably where this belongs)
|-- src
|--- server
|---- package.json : dependencies for backend/Express server
There was a problem hiding this comment.
You may need to run npm unstainll react-chat-ui at the top level directory to remove this change (or just deletethese lines from the JSON)
|
I think the issue bug you mentioned may have something to do with needing to invoke |
|
okay i will try to amend the concerns raised in your comments! |
Sounds good! I was just teasing you about the I really like the React messaging UI. Looks very clean |
imann24
left a comment
There was a problem hiding this comment.
A few more things on a second review! Always worth looking again when you've actually had some coffee 😅 . Anyways, great PR!
| <img src={logo} className="App-logo" alt="logo" /> | ||
| </header> | ||
|
|
||
|
|
There was a problem hiding this comment.
Nice spacing for visual clarity!
| })} | ||
| </div> | ||
|
|
||
| <ChatFeed |
There was a problem hiding this comment.
Very clean integration with the React component! Finally make React work for us!
| </div> | ||
|
|
||
| <ChatFeed | ||
| messages={[new Message({id: 1,message: this.state.conversation.lastMessage.text,senderName:this.state.user.name}), |
There was a problem hiding this comment.
Oh! Now I see that we needed to rename Msg to avoid a conflict w/ the React component. Good call!
| // this.handleSubmit(); | ||
| // } | ||
| // } | ||
| this.handleSubmit(); |
There was a problem hiding this comment.
May want to re-consider this spec in future? Sending a message through the socket on every letter typed may cause some issues (too much network traffic)
There was a problem hiding this comment.
okay, whats your thoughts on this? My impression was that, as was described, user can see each letters being typed/deleted in real-time. also, i found that instead of using onKeyPress props we could use onKeyDown to trigger handleSubmit() even while user pressed backspace/shift/ctrl key.
There was a problem hiding this comment.
regarding network throughput, is there anyway we could make that work? how much traffic could websocket handle?
There was a problem hiding this comment.
Yeah, I like realtime if it's possible. Would probably have to load test to know. Want to write us some automated tests? 😅
Let's keep it live for now. We can switch it back to sending every word if we run into performance issues
imann24
left a comment
There was a problem hiding this comment.
Good code cleanup! May still have a few notes to address though
| "recursive-install": "^1.4.0" | ||
| }, | ||
| "dependencies": { | ||
| "react-chat-ui": "^0.3.2" |
There was a problem hiding this comment.
You may need to run npm unstainll react-chat-ui at the top level directory to remove this change (or just deletethese lines from the JSON)
| this.handleSubmit(); | ||
| } | ||
| } | ||
| // if (event.key === ' ') { |
| e.preventDefault(); | ||
| } | ||
| let newMessage = new Message(this.state.user, this.state.text) | ||
| this.setState(previousState => ({ |
There was a problem hiding this comment.
Believe we still need a call to update the React state
There was a problem hiding this comment.
which state should we update in handleSubmit?
There was a problem hiding this comment.
this.state.conversation and this.state.text
| value={this.state.text} | ||
| onKeyPress={this.onKeyPress} | ||
| onChange={e => this.setState({ text: e.target.value })}/> | ||
| onChange={e => this.setState({ text: e.target.value },()=> console.log())}/> |
There was a problem hiding this comment.
Perhaps some of your changes aren't committed yet?
| } else { | ||
| this.messages.push(message); | ||
| } | ||
| // let newSender = message.sender; |
| @@ -18,5 +18,8 @@ | |||
| "devDependencies": { | |||
There was a problem hiding this comment.
Having some functional issues when I test the app:
- Not able to send messages with this version
- When I start the chat there are empty chat bubbles
- Think it would preferable to aim for the flow that we create a new chat bubble when the other person starts speaking

Fixes #6
imported react-chat-ui (https://www.npmjs.com/package/react-chat-ui)
renamed class {Message} in to {Msg} to avoid naming conflict with react-chat-ui
Problem:
right now the chat is always one char behind while chatting with another user. I think it has something to do with react life cycle/state update but couldnt figure out how to resolve.