Skip to content
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

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

kkuliczkowski-box
Copy link
Contributor

@kkuliczkowski-box kkuliczkowski-box commented Jan 29, 2025

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

@kkuliczkowski-box kkuliczkowski-box requested review from a team as code owners January 29, 2025 11:48
onSelectAgent={onSelectAgent}
recordAction={recordAction}
shouldHideAgentSelectorOnLoad={false}
// @ts-ignore variant will be available in higher version
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

@kkuliczkowski-box kkuliczkowski-box Jan 29, 2025

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.

Copy link
Contributor

@tjuanitas tjuanitas left a 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 })}
Copy link
Contributor

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">
Copy link
Contributor

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?

Comment on lines +216 to +221
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();
Copy link
Contributor

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?

Comment on lines +75 to +81
const onModalClose = () => {
setIsModalOpen(false);
};

const onSwitchToModalClick = () => {
setIsModalOpen(true);
};
Copy link
Contributor

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

@mergify mergify bot merged commit 9c7aab0 into box:master Jan 29, 2025
6 checks passed
@kkuliczkowski-box
Copy link
Contributor Author

minor comments but non blocking

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants