-
Notifications
You must be signed in to change notification settings - Fork 0
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
work in progress #15
base: master
Are you sure you want to change the base?
work in progress #15
Conversation
Looks like some client-side tests are failing |
this.handleSubmit(); | ||
} | ||
} | ||
// if (event.key === ' ') { |
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.
Is the plan to re-add the commented out code?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this answer: https://github.com/imann24/now/pull/15/files#r315968692 ?
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.
Planning to remove this code?
@@ -55,12 +61,17 @@ class App extends Component { | |||
type="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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty console log?
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.
lol fixed
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we should clarify if a chat session only allows 2 users max
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -18,5 +18,8 @@ | |||
"devDependencies": { | |||
"concurrently": "^4.0.1", | |||
"recursive-install": "^1.4.0" | |||
}, | |||
"dependencies": { | |||
"react-chat-ui": "^0.3.2" |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
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.
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 |
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.
A few more things on a second review! Always worth looking again when you've actually had some coffee 😅 . Anyways, great PR!
@@ -47,6 +51,8 @@ class App extends Component { | |||
<header className="App-header"> | |||
<img src={logo} className="App-logo" alt="logo" /> | |||
</header> | |||
|
|||
|
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 spacing for visual clarity!
})} | ||
</div> | ||
|
||
<ChatFeed |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding network throughput, is there anyway we could make that work? how much traffic could websocket handle?
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.
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
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 code cleanup! May still have a few notes to address though
@@ -18,5 +18,8 @@ | |||
"devDependencies": { | |||
"concurrently": "^4.0.1", | |||
"recursive-install": "^1.4.0" | |||
}, | |||
"dependencies": { | |||
"react-chat-ui": "^0.3.2" |
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.
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 === ' ') { |
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.
Planning to remove this code?
} | ||
handleSubmit = async e => { | ||
if (e) { | ||
e.preventDefault(); | ||
} | ||
let newMessage = new Message(this.state.user, this.state.text) | ||
this.setState(previousState => ({ |
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.
Believe we still need a call to update the React state
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.
which state should we update in handleSubmit?
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.
this.state.conversation
and this.state.text
@@ -55,12 +61,17 @@ class App extends Component { | |||
type="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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some of your changes aren't committed yet?
} else { | ||
this.messages.push(message); | ||
} | ||
// let newSender = message.sender; |
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.
Commented out code
@@ -18,5 +18,8 @@ | |||
"devDependencies": { |
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.
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.