-
Notifications
You must be signed in to change notification settings - Fork 313
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
feat(content-sidebar): Expand Box AI Sidebar to Modal #3878
feat(content-sidebar): Expand Box AI Sidebar to Modal #3878
Conversation
onSelectAgent={onSelectAgent} | ||
recordAction={recordAction} | ||
shouldHideAgentSelectorOnLoad={false} | ||
// @ts-ignore variant will be available in higher version |
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.
do we still need this comment?
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.
Yeah, it's no longer needed, I've removed it.
@@ -16,16 +16,19 @@ export interface BoxAISidebarContextValues { | |||
cache: { encodedSession?: string | null; questions?: QuestionType[] }; | |||
contentName: string; | |||
elementId: string; | |||
fileExtension: string; |
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.
Curious why do we pass those props, especially avatar which will be deleted from modal and sidebar shortly?
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.
fileExtension
is used in IntelligenceModal
- it's used as one of the properties that are tracked with Resin (and Pendo). It will also be used to track the "load" of Box AI Sidebar, which will be added with a different ticket.
And we can't really remove the avatarURL
until the avatar is removed from BoxAiContentAnswers
.
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.
minor comments but non blocking
<> | ||
<SidebarContent | ||
actions={renderActions()} | ||
className={classNames('bcs-BoxAISidebar', { 'with-modal-open': isModalOpen })} |
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.
suit naming would make the class is-modal-open
rather than with-
https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md#is-stateOfComponent
// @ts-ignore variant will be available in higher version | ||
variant="sidebar" | ||
/> | ||
<div className="bcs-BoxAISidebar-agent-selector-container"> |
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.
so for suit naming, the class name should start with the component name and then descendants are listed in camelcase after a dash: bcs-BoxAISidebarContent-agentSelector
but since bcs-BoxAISidebar
is already the pattern in this file, I guess call this bcs-BoxAISidebar-agentSelector
?
expect(await screen.findByTestId('content-answers-modal')).toBeInTheDocument(); | ||
|
||
const switchToSidebarButton = screen.getByRole('button', { name: 'Switch to sidebar view' }); | ||
await userEvent.click(switchToSidebarButton); | ||
|
||
expect(screen.queryByTestId('content-answers-modal')).not.toBeInTheDocument(); |
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.
is there a role or label we can query by instead of test id?
const onModalClose = () => { | ||
setIsModalOpen(false); | ||
}; | ||
|
||
const onSwitchToModalClick = () => { | ||
setIsModalOpen(true); | ||
}; |
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.
nit: these could be named as handleModalClose
and handleModalOpen
reserving on
for the prop and handle
for the function
Thanks for review @tjuanitas. I will merge it, since it's a time sensitive change. We will work on UI improvements of Box AI Sidebar very soon and we'll address your comments then. |
Description:
Added option to Switch Box AI Sidebar view into Modal view. The session, conversation history and Agent Selector data are shared between the two, so that user can start conversation in one experience, switch and seamlessly continue in the other.
More detailed checks verifying the continuity of conversation will be added in E2E tests as a separate PR soon.
Demo:
![box-ai-modal-pr-demo](https://private-user-images.githubusercontent.com/105496865/407714669-7d726531-9d83-46d0-a782-08988c7b39e3.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MTc2NTEsIm5iZiI6MTczODkxNzM1MSwicGF0aCI6Ii8xMDU0OTY4NjUvNDA3NzE0NjY5LTdkNzI2NTMxLTlkODMtNDZkMC1hNzgyLTA4OTg4YzdiMzllMy5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QwODM1NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMzhmMWNjYjgzM2Y1OGZiMDUwMThlNmU0YjJjNWI2MTY2ZmExNzgzYmFmMWFkNjQ3Y2MxZWUwNWQyNTNjMTBhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.-696UCzPYWBwbk7Fgh3PxlapzU1gSUQeAQlsZRKQsw8)