-
Notifications
You must be signed in to change notification settings - Fork 318
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
AIConversation: custom actions accept a react node #5999
Conversation
🦋 Changeset detectedLatest commit: 0c739a3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
import '@aws-amplify/ui-react-ai/ai-conversation-styles.css'; | ||
|
||
import { Authenticator, Card } from '@aws-amplify/ui-react'; | ||
import { INITIAL_MESSAGES } from '../../constants'; |
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.
For a lot of the UI customization stuff, we don't actually need a backend to be deployed, we can just pass in static messages to test. Neat!
handleSendMessage={() => {}} | ||
actions={[ | ||
{ | ||
component: <MdCopyAll />, |
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.
Custom actions now are just React nodes
functions: 70, | ||
lines: 70, | ||
statements: 70, | ||
branches: 68, |
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.
Bumping up thresholds because they were too low
messageRenderer, | ||
children, | ||
}: AIConversationProviderProps): JSX.Element { | ||
...rest |
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.
Moving all these to just rest, we only need the nested configurations like avatars and controls to merge those with the defaults.
|
||
function AIConversationBase(props: AIConversationBaseProps): JSX.Element { | ||
return ( | ||
<Provider {...props}> |
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 don't need to create a separate Provider component anymore
@@ -0,0 +1,184 @@ | |||
import React from 'react'; |
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.
Somewhat unrelated, started adding some more tests
Description of changes
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passes and tests are updated/addeddocs
,e2e
,examples
, or other private packages.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.