-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Typing Indicator to SendBox (#2321)
* Moved typing indicator to the send box. * Added tests for typing indicator * Updated CHANGELOG.md * Fixed eslint issues * Moved TypingIndicator above ConnectivityStatus * Update CHANGELOG.md * Update CHANGELOG.md * Requested Changes * Fixed offline ui test failure
- Loading branch information
Showing
22 changed files
with
194 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
- `component`: Remove [`react`](https://www.npmjs.com/package/react) and [`react-dom`](https://www.npmjs.com/package/react-dom) from `devDependencies` | ||
- `playground`: Remove [`react`](https://www.npmjs.com/package/react) and [`react-dom`](https://www.npmjs.com/package/react-dom) from `dependencies` | ||
- `samples/*`: Move to production version of Web Chat, and bump to [`[email protected]`](https://www.npmjs.com/package/react) and [`[email protected]`](https://www.npmjs.com/package/react-dom) | ||
- Moved the typing indicator to the send box and removed the typing indicator logic from the sagas, by [@tdurnford](https://github.com/tdurnford), in PR [#2321](https://github.com/microsoft/BotFramework-WebChat/pull/2321) | ||
|
||
### Fixed | ||
|
||
|
Binary file added
BIN
+16.5 KB
...send-typing-indicator-js-typing-indicator-should-display-in-send-box-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.8 KB
...dicator-js-typing-indicator-should-not-display-after-second-activity-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Condition } from 'selenium-webdriver'; | ||
|
||
export default function typingActivityReceived() { | ||
return new Condition( | ||
`Waiting for typing activity`, | ||
async driver => | ||
await driver.executeScript( | ||
() => | ||
~window.WebChatTest.actions | ||
.filter(({ type }) => type === 'DIRECT_LINE/INCOMING_ACTIVITY') | ||
.findIndex( | ||
({ | ||
payload: { | ||
activity: { | ||
from: { role }, | ||
type | ||
} | ||
} | ||
}) => role === 'bot' && type === 'typing' | ||
) | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import { localize } from '../Localization/Localize'; | ||
import connectToWebChat from '../connectToWebChat'; | ||
import TypingAnimation from './Assets/TypingAnimation'; | ||
|
||
const TypingIndicator = ({ | ||
language, | ||
lastTypingAt, | ||
styleSet: { | ||
options: { typingAnimationDuration }, | ||
typingIndicator | ||
} | ||
}) => { | ||
const [showTyping, setShowTyping] = useState(false); | ||
|
||
useEffect(() => { | ||
let timeout; | ||
const last = Math.max(Object.values(lastTypingAt)); | ||
const typingAnimationTimeRemaining = typingAnimationDuration - Date.now() + last; | ||
|
||
if (last && typingAnimationTimeRemaining > 0) { | ||
setShowTyping(true); | ||
timeout = setTimeout(() => setShowTyping(false), typingAnimationTimeRemaining); | ||
} else { | ||
setShowTyping(false); | ||
} | ||
|
||
return () => clearTimeout(timeout); | ||
}, [lastTypingAt, typingAnimationDuration]); | ||
|
||
return ( | ||
showTyping && ( | ||
<div className={typingIndicator}> | ||
<TypingAnimation aria-label={localize('TypingIndicator', language)} /> | ||
</div> | ||
) | ||
); | ||
}; | ||
|
||
TypingIndicator.propTypes = { | ||
language: PropTypes.string.isRequired, | ||
lastTypingAt: PropTypes.any.isRequired, | ||
styleSet: PropTypes.shape({ | ||
options: PropTypes.shape({ | ||
typingAnimationDuration: PropTypes.number | ||
}).isRequired, | ||
typingIndicator: PropTypes.any.isRequired | ||
}).isRequired | ||
}; | ||
|
||
export default connectToWebChat(({ lastTypingAt, language, styleSet }) => ({ lastTypingAt, language, styleSet }))( | ||
TypingIndicator | ||
); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function createTypingIndicatorStyle({ paddingRegular }) { | ||
return { | ||
paddingBottom: paddingRegular, | ||
paddingLeft: paddingRegular | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.