Skip to content

Commit

Permalink
Merge branch 'master' into mergeToOpenSource
Browse files Browse the repository at this point in the history
* master:
  Fixed Quick Reply and Menu buttons
  Added button click user message to list
  Removed commented out code
  Bump version

# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
JWandrocke committed Aug 27, 2021
2 parents e7ff180 + 12fb9d6 commit 8059512
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
6 changes: 4 additions & 2 deletions src/components/Input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { safeArrayOfItem } from 'helpers'
import Menu from 'components/Menu'
import MenuSVG from 'components/svgs/menu'
import './style.scss'
import { pathOr } from 'ramda'

// Number of minimum char to display the char limit.
const NUMBER_BEFORE_LIMIT = 5
Expand Down Expand Up @@ -106,7 +107,8 @@ class Input extends Component {
}
sendMenuSelection = (action) => {
if (action) {
this.props.onSubmit(action)
const title = pathOr(null, ['content', 'title'], action)
this.props.onSubmit(action, title)
}
}
sendMessage = () => {
Expand All @@ -115,7 +117,7 @@ class Input extends Component {
this.props.onSubmit({
type: 'text',
content,
})
}, content.title)
this.setState(prevState => {
const historyValues = append(content, prevState.historyValues)
const previousValues = append('', historyValues)
Expand Down
4 changes: 3 additions & 1 deletion src/components/Message/QuickReplies.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { truncate, safeArrayOfItem, validButtonContent } from 'helpers'

import Text from './Text'
import { PrevArrow, NextArrow } from 'components/arrows'
import { pathOr } from 'ramda'

class QuickReplies extends Component {
state = {
Expand Down Expand Up @@ -46,8 +47,9 @@ class QuickReplies extends Component {
// then one button click has already been send.
if (!this._messageHasAlreadyBeenSent) {
this._messageHasAlreadyBeenSent = true
const title = pathOr(null, ['content', 'title'], message)
this.setState({ displayQuickReplies: false }, () => {
this.props.sendMessage(message)
this.props.sendMessage(message, title)
})
}
}
Expand Down
14 changes: 2 additions & 12 deletions src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const NO_LOCALSTORAGE_MESSAGE
removeAllMessages,
},
)

class App extends Component {
state = {
expanded: this.props.expanded || false,
Expand Down Expand Up @@ -90,7 +91,7 @@ class App extends Component {
}

componentDidUpdate (prevProps, prevState) {
const { onToggle, conversationHistoryId } = this.props
const { onToggle } = this.props

if (prevState.expanded !== this.state.expanded) {
if (window.localStorage) {
Expand Down Expand Up @@ -146,17 +147,6 @@ class App extends Component {

return (
<div className='RecastApp CaiApp'>
{/* <link
rel='stylesheet'
type='text/css'
href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css'
/>
<link
rel='stylesheet'
type='text/css'
href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css'
/> */}

<Expander
show={!expanded}
onClick={this.toggleChat}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class Chat extends Component {
}

this.setState(
prevState => ({ messages: concat(prevState.messages, [backendMessage]) }),
prevState => ({ messages: concat(prevState.messages, [userMessage || backendMessage]) }),
() => {
if (sendMessagePromise) {
addUserMessage(userMessage || backendMessage)
Expand Down

0 comments on commit 8059512

Please sign in to comment.