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(boxai-sidebar): BoxAISidebar header added #3698

Merged
merged 11 commits into from
Oct 16, 2024

Conversation

DanilaRubleuski
Copy link
Contributor

@DanilaRubleuski DanilaRubleuski commented Oct 5, 2024

Description

Added header to BoxAISidebar, which contains Expand button.

Screenshots

image

@DanilaRubleuski DanilaRubleuski requested a review from a team as a code owner October 5, 2024 21:08
@kkuliczkowski-box
Copy link
Contributor

Because this is a public repo, we should not paste Jira tickets.

Shouldn't the "expand" button be right aligned?

src/elements/content-sidebar/BoxAISidebar.tsx Outdated Show resolved Hide resolved
src/elements/content-sidebar/BoxAISidebar.tsx Outdated Show resolved Hide resolved
@@ -15,3 +13,5 @@ export default {
token: global.TOKEN,
},
};

export const basic = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for moving this line below default export?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No exact reason, just looked at other tests

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to reiterate, the default export is usually on the bottom, so the basic export should be moved above it

@MateuszMamczarz
Copy link
Contributor

Looks like style of the header is not matching other headers. It should be bold, also not sure about font size

@DanilaRubleuski
Copy link
Contributor Author

Shouldn't the "expand" button be right aligned?

@MateuszMamczarz could confirm, that for now BoxAISidebarHeader should only have this Expand button on the left, near the Box AI title

@DanilaRubleuski DanilaRubleuski requested review from a team as code owners October 7, 2024 15:03
src/elements/content-sidebar/BoxAISidebar.tsx Outdated Show resolved Hide resolved
@@ -15,3 +13,5 @@ export default {
token: global.TOKEN,
},
};

export const basic = {};

This comment was marked as resolved.

src/elements/content-sidebar/BoxAISidebar.scss Outdated Show resolved Hide resolved
i18n/en-US.properties Outdated Show resolved Hide resolved
Copy link
Contributor

@jmalinna jmalinna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/elements/content-sidebar/BoxAISidebar.scss Outdated Show resolved Hide resolved
justify-content: left;

.bcs-title {
padding-right: $space-3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably use gap in this case?

@@ -117,6 +117,11 @@ const messages = defineMessages({
defaultMessage: 'Modify General Task',
description: 'modal title for when editing an existing general task',
},
expandBoxAI: {
id: 'be.expandBoxAI',
Copy link
Contributor

@tjuanitas tjuanitas Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add be.contentSidebar to the id prefix since we dont want to risk any conflicts. i.e. in case some other part of the repo has the same message id - we can't have duplicates

@@ -24,3 +24,12 @@ export const BoxAIInSidebar: StoryObj<typeof BoxAISidebar> = {
expect(sidebar).toBeInTheDocument();
},
};

export const ExpandButtonCheck: StoryObj<typeof BoxAISidebar> = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume this test will become a visual regression for the entire expanded view in Box AI right? so maybe we can name it like BoxAIWithExpandedView

@@ -15,3 +13,5 @@ export default {
token: global.TOKEN,
},
};

export const basic = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to reiterate, the default export is usually on the bottom, so the basic export should be moved above it

const expandButton = screen.getByRole('button', { name: 'Expand' });
await userEvent.click(expandButton);

expect(mockOnExpandClick).toHaveBeenCalled();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there can be issues and unexpected behavior if we forget to clear/reset the mock calls between tests. i think we handle this in a global configuration but just in case, it's better to not use reuse the fn mock for the expect so it's more intentional about what should happen

e.g. check for a separate prop (defined in the local scope) and/or explicitly add an afterEach

afterEach(() => {
    jest.clearAllMocks();
});

// or

const onExpandClick = jest.fn();
renderComponent({ onExpandClick });

...

expect(onExpandClick).toHaveBeenCalled();

@DanilaRubleuski DanilaRubleuski requested review from tjuanitas and JChan106 and removed request for greg-in-a-box October 15, 2024 14:47
Copy link
Contributor

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from some minor feedback.

@@ -117,6 +117,11 @@ const messages = defineMessages({
defaultMessage: 'Modify General Task',
description: 'modal title for when editing an existing general task',
},
expandBoxAI: {
id: 'be.contentSidebarExpandBoxAI',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we namespace this to be similar to the other messages? Maybe be.contentSidebar.boxAI.expand?

expandBoxAI: {
id: 'be.contentSidebarExpandBoxAI',
description: 'Default message for Box AI expand button in sidebar header',
defaultMessage: 'Expand',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but let's move this up a line to stay consistent with the other messages.

@@ -117,6 +117,11 @@ const messages = defineMessages({
defaultMessage: 'Modify General Task',
description: 'modal title for when editing an existing general task',
},
expandBoxAI: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxAISidebarExpand seems accurate?

}

function BoxAISidebar() {
function BoxAISidebar({ onExpandClick }: BoxAISidebarProps) {
const { formatMessage } = useIntl();

return (
<SidebarContent
className={'bcs-BoxAISidebar'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but this can be a regular string: className="bcs-BoxAISidebar"

<IconButton
onClick={onExpandClick}
icon={ArrowsExpand}
aria-label={formatMessage(sidebarMessages.expandBoxAI)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically alphabetize our props whenever possible.

@jstoffan jstoffan dismissed greg-in-a-box’s stale review October 16, 2024 16:14

Reviewer out of office, but all feedback appears to have been addressed.

jstoffan
jstoffan previously approved these changes Oct 16, 2024
jstoffan
jstoffan previously approved these changes Oct 16, 2024
tjuanitas
tjuanitas previously approved these changes Oct 16, 2024
@mergify mergify bot merged commit 130b6b6 into box:master Oct 16, 2024
6 checks passed
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.

10 participants