Skip to content

Commit 3fb6bf5

Browse files
author
Dylan Harness
authored
Revert "[Contribution: @kaxi1993] Add typing indicator (#127)"
This reverts commit 56e73a7.
1 parent 56e73a7 commit 3fb6bf5

File tree

9 files changed

+17
-137
lines changed

9 files changed

+17
-137
lines changed

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class Demo extends Component {
4242
constructor() {
4343
super();
4444
this.state = {
45-
messageList: [],
46-
isTyping: true
45+
messageList: []
4746
};
4847
}
4948

@@ -75,7 +74,6 @@ class Demo extends Component {
7574
onMessageWasSent={this._onMessageWasSent.bind(this)}
7675
messageList={this.state.messageList}
7776
showEmoji
78-
showTypingIndicator={this.state.isTyping}
7977
/>
8078
</div>)
8179
}
@@ -94,16 +92,15 @@ Launcher props:
9492

9593
| prop | type | required | description |
9694
|------------------|--------|----------|-------------|
97-
| agentProfile | [object](#agent-profile-objects) | yes | Represents your product or service's customer service agent. Fields: imageUrl (string), teamName (string). |
98-
| handleClick | function | yes | Intercept the click event on the launcher. No argument sent when function is called. |
99-
| isOpen | boolean | yes | Force the open/close state of the chat window. If this is not set, it will open and close when clicked. |
100-
| messageList | [[message](#message-objects)] | yes | An array of message objects to be rendered as a conversation. |
101-
| mute | boolean | no | Don't play sound for incoming messages. Defaults to `false`. |
102-
| newMessagesCount | number | no | The number of new messages. If greater than 0, this number will be displayed in a badge on the launcher. Defaults to `0`. |
103-
| onFilesSelected | function([fileList](https://developer.mozilla.org/en-US/docs/Web/API/FileList)) | no | Called after file has been selected from dialogue in chat window. |
104-
| onMessageWasSent | function([message](#message-objects)) | yes | Called when a message is sent, with a message object as an argument. |
105-
| showEmoji | boolean | no | Whether or not to show the emoji button in the input bar. Defaults to `true`.
106-
| showTypingIndicator | boolean | no | Whether or not to show typing indicator in the message box. Defaults to `false`.
95+
| agentProfile | [object](#agent-profile-objects) | yes | Represents your product or service's customer service agent. Fields: imageUrl (string), teamName (string). |
96+
| handleClick | function | yes | Intercept the click event on the launcher. No argument sent when function is called. |
97+
| isOpen | boolean | yes | Force the open/close state of the chat window. If this is not set, it will open and close when clicked. |
98+
| messageList | [[message](#message-objects)] | yes | An array of message objects to be rendered as a conversation. |
99+
| mute | boolean | no | Don't play sound for incoming messages. Defaults to `false`. |
100+
| newMessagesCount | number | no | The number of new messages. If greater than 0, this number will be displayed in a badge on the launcher. Defaults to `0`. |
101+
| onFilesSelected | function([fileList](https://developer.mozilla.org/en-US/docs/Web/API/FileList)) | no | Called after file has been selected from dialogue in chat window. |
102+
| onMessageWasSent | function([message](#message-objects)) | yes | Called when a message is sent, with a message object as an argument. |
103+
| showEmoji | boolean | no | Whether or not to show the emoji button in the input bar. Defaults to `true`.
107104

108105

109106
### Message Objects

demo/src/TestArea.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
import React, { Component } from 'react'
22

33
class TestArea extends Component {
4-
constructor (props) {
5-
super(props);
6-
7-
this.timeout = null;
8-
this._onKeyUp = this._onKeyUp.bind(this);
9-
}
10-
11-
_onKeyUp() {
12-
if (this.timeout) {
13-
clearTimeout(this.timeout);
14-
}
15-
16-
this.props.startTyping();
17-
18-
// stop typing after 1 second of inactivity
19-
this.timeout = setTimeout(() => {
20-
this.props.stopTyping();
21-
}, 1000);
22-
}
23-
244
render () {
255
return (
266
<div className="demo-test-area--wrapper">
@@ -33,17 +13,13 @@ class TestArea extends Component {
3313
<form className="demo-test-area" onSubmit={(e)=> {
3414
e.preventDefault();
3515
this.props.onMessage(this.textArea.value);
36-
37-
this.props.stopTyping();
38-
3916
this.textArea.value = '';
4017
}}>
4118
<div className="demo-test-area--preamble">Test the chat window by sending a message:</div>
4219
<textarea
4320
ref={(e) => { this.textArea = e; }}
4421
className="demo-test-area--text"
4522
placeholder="Write a test message...."
46-
onKeyUp={this._onKeyUp}
4723
/>
4824
<button className="demo-test-area--button"> Send Message! </button>
4925
</form>

demo/src/index.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class Demo extends Component {
1818
this.state = {
1919
messageList: messageHistory,
2020
newMessagesCount: 0,
21-
isOpen: false,
22-
isTyping: false
21+
isOpen: false
2322
};
2423
}
2524

@@ -56,18 +55,6 @@ class Demo extends Component {
5655
}
5756
}
5857

59-
_startTyping() {
60-
this.setState({
61-
isTyping: true
62-
});
63-
}
64-
65-
_stopTyping() {
66-
this.setState({
67-
isTyping: false
68-
});
69-
}
70-
7158
_handleClick() {
7259
this.setState({
7360
isOpen: !this.state.isOpen,
@@ -80,8 +67,6 @@ class Demo extends Component {
8067
<Header />
8168
<TestArea
8269
onMessage={this._sendMessage.bind(this)}
83-
startTyping={this._startTyping.bind(this)}
84-
stopTyping={this._stopTyping.bind(this)}
8570
/>
8671
<Launcher
8772
agentProfile={{
@@ -95,7 +80,6 @@ class Demo extends Component {
9580
handleClick={this._handleClick.bind(this)}
9681
isOpen={this.state.isOpen}
9782
showEmoji
98-
showTypingIndicator={this.state.isTyping}
9983
/>
10084
<img className="demo-monster-img" src={monsterImgUrl} />
10185
<Footer />

src/components/ChatWindow.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class ChatWindow extends Component {
3434
<MessageList
3535
messages={messageList}
3636
imageUrl={this.props.agentProfile.imageUrl}
37-
showTypingIndicator={this.props.showTypingIndicator}
3837
/>
3938
<UserInput
4039
onSubmit={this.onUserInputSubmit.bind(this)}
@@ -52,8 +51,7 @@ ChatWindow.propTypes = {
5251
onClose: PropTypes.func.isRequired,
5352
onFilesSelected: PropTypes.func,
5453
onUserInputSubmit: PropTypes.func.isRequired,
55-
showEmoji: PropTypes.bool,
56-
showTypingIndicator: PropTypes.bool
54+
showEmoji: PropTypes.bool
5755
}
5856

5957
export default ChatWindow;

src/components/Launcher.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class Launcher extends Component {
6060
isOpen={isOpen}
6161
onClose={this.handleClick.bind(this)}
6262
showEmoji={this.props.showEmoji}
63-
showTypingIndicator={this.props.showTypingIndicator}
6463
/>
6564
</div>
6665
);
@@ -85,13 +84,11 @@ Launcher.propTypes = {
8584
messageList: PropTypes.arrayOf(PropTypes.object),
8685
mute: PropTypes.bool,
8786
showEmoji: PropTypes.bool,
88-
showTypingIndicator: PropTypes.bool
8987
};
9088

9189
Launcher.defaultProps = {
9290
newMessagesCount: 0,
93-
showEmoji: true,
94-
showTypingIndicator: false
95-
};
91+
showEmoji: true
92+
}
9693

9794
export default Launcher;

src/components/MessageList.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React, { Component } from 'react';
2-
3-
import Message from './Messages';
4-
import TypingIndicator from './TypingIndicator';
2+
import Message from './Messages'
53

64
class MessageList extends Component {
75

@@ -15,9 +13,8 @@ class MessageList extends Component {
1513
{this.props.messages.map((message, i) => {
1614
return <Message message={message} key={i} />
1715
})}
18-
{this.props.showTypingIndicator && <TypingIndicator />}
1916
</div>)
2017
}
2118
}
2219

23-
export default MessageList
20+
export default MessageList

src/components/TypingIndicator.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/styles/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ import './launcher.css';
44
import './header.css';
55
import './message.css';
66
import './user-input.css';
7-
import './popup-window.css';
8-
import './typing-indicator.css';
7+
import './popup-window.css';

src/styles/typing-indicator.css

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)