From 9ef81aa39199484b253992b92c607151c514d362 Mon Sep 17 00:00:00 2001 From: William Wong Date: Fri, 18 Jan 2019 00:47:52 -0800 Subject: [PATCH] Fix avatar initials --- CHANGELOG.md | 1 + packages/playground/src/App.js | 66 +++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3521810153..feeca6142d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix [#1402](https://github.com/Microsoft/BotFramework-WebChat/issues/1402). Add `messageBack` support, by [@corinagum](https://github.com/corinagum) in PR [#1581](https://github.com/Microsoft/BotFramework-WebChat/pull/1581) - Fix [#1539], outgoing typing indicators are not sent and acknowledged properly, in PR [#1541](https://github.com/Microsoft/BotFramework-WebChat/pull/1541) - `component`: Fix [#1547](https://github.com/Microsoft/BotFramework-WebChat/issues/1547). Fixed unhandled activity type should be forwarded to custom middleware, by [@compulim](https://github.com/compulim) in PR [#1569](https://github.com/Microsoft/BotFramework-WebChat/pull/1569) +- `playground`: Fix [#1610](https://github.com/Microsoft/BotFramework-WebChat/issues/1610). Fixed bot and user avatar initials not working, by [@compulim](https://github.com/compulim) in PR [#1611](https://github.com/Microsoft/BotFramework-WebChat/pull/1611) ### Removed - `botAvatarImage` and `userAvatarImage` props, as they are moved inside `styleOptions`, in PR [#1486](https://github.com/Microsoft/BotFramework-WebChat/pull/1486) diff --git a/packages/playground/src/App.js b/packages/playground/src/App.js index 450e427924..2673db3b59 100644 --- a/packages/playground/src/App.js +++ b/packages/playground/src/App.js @@ -6,7 +6,6 @@ import ReactWebChat, { createBrowserWebSpeechPonyfillFactory, createCognitiveServicesBingSpeechPonyfillFactory, createCognitiveServicesSpeechServicesPonyfillFactory, - createStyleSet, renderMarkdown } from 'botframework-webchat'; @@ -73,7 +72,13 @@ export default class extends React.Component { this.mainRef = React.createRef(); this.activityMiddleware = createDevModeActivityMiddleware(); this.attachmentMiddleware = createDevModeAttachmentMiddleware(); - this.createMemoizedStyleSet = memoize(hideSendBox => createStyleSet({ hideSendBox })); + this.createMemoizedStyleOptions = memoize( + (hideSendBox, botAvatarInitials, userAvatarInitials) => ({ + botAvatarInitials, + hideSendBox, + userAvatarInitials + }) + ); const params = new URLSearchParams(window.location.search); const directLineToken = params.get('t'); @@ -220,9 +225,24 @@ export default class extends React.Component { } render() { - const { props: { store }, state } = this; - const styleSet = this.createMemoizedStyleSet(this.state.hideSendBox); - const { groupTimestamp } = state; + const { + props: { store }, + state: { + botAvatarInitials, + directLine, + disabled, + faulty, + groupTimestamp, + hideSendBox, + language, + sendTimeout, + sendTyping, + userAvatarInitials, + userID, + webSpeechPonyfillFactory + } + } = this; + const styleOptions = this.createMemoizedStyleOptions(hideSendBox, botAvatarInitials, userAvatarInitials); return (