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

chore: Disable implicit tools integration into drawers list #1581

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

just-boris
Copy link
Member

@just-boris just-boris commented Sep 25, 2023

Description

Implement this proposal: ZuAXAsmOsora

Related links, issue #, if available: n/a

How has this been tested?

  • Updated related tests and added new dev pages for discovered corner-case
  • Run screenshot tests in my dev pipeline
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b7d291c) 94.05% compared to head (d509db0) 94.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1581      +/-   ##
==========================================
- Coverage   94.05%   94.05%   -0.01%     
==========================================
  Files         649      649              
  Lines       17572    17569       -3     
  Branches     5770     5772       +2     
==========================================
- Hits        16528    16524       -4     
- Misses        975      976       +1     
  Partials       69       69              
Files Coverage Δ
src/app-layout/drawer/index.tsx 98.59% <100.00%> (-0.04%) ⬇️
src/app-layout/index.tsx 94.07% <100.00%> (ø)
src/app-layout/mobile-toolbar/index.tsx 94.28% <100.00%> (-0.31%) ⬇️
src/app-layout/utils/use-drawers.ts 100.00% <100.00%> (ø)
src/app-layout/visual-refresh/context.tsx 91.78% <100.00%> (+0.11%) ⬆️
src/app-layout/visual-refresh/drawers.tsx 91.76% <100.00%> (-2.24%) ⬇️
src/app-layout/visual-refresh/layout.tsx 100.00% <100.00%> (ø)
src/app-layout/visual-refresh/mobile-toolbar.tsx 100.00% <100.00%> (ø)
src/app-layout/visual-refresh/tools.tsx 86.88% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

});

test('should apply drawers treatment to the tools if at least one other drawer is provided', () => {
Copy link
Member Author

@just-boris just-boris Sep 27, 2023

Choose a reason for hiding this comment

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

This and other tests from this file moved into runtime-drawers.test.tsx, because the tools+drawers merging feature is now only available for runtime drawers

fireNonCancelableEvent(ownDrawers?.onChange, newDrawerId);
}
if (!toolsProps.toolsHide) {
fireNonCancelableEvent(toolsProps.onToolsChange, { open: newDrawerId === TOOLS_DRAWER_ID });
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed repeating onToolsChange handlers from other places, this is the only one where we keep it to support compatibility between tools and drawers

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to check if tools are ignored?

Copy link
Member Author

Choose a reason for hiding this comment

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

We still have "multi drawer with tools mode" for runtime API, this is why the condition is here. See applyToolsDrawer function how exactly this works

@@ -36,7 +36,7 @@ import { useUniqueId } from '../../internal/hooks/use-unique-id';

interface AppLayoutInternals extends AppLayoutProps {
activeDrawerId: string | undefined;
drawers: Array<DrawerItem>;
drawers: Array<DrawerItem> | null;
Copy link
Member Author

Choose a reason for hiding this comment

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

Empty array [] means that <AppLayout drawers={[]}> is used and null means that there are no drawers registered in any form. This distinction is needed to decide what we render on the right hand side

@@ -50,7 +50,7 @@ export default function Layout({ children }: LayoutProps) {

// Content gaps on the left and right are used with the minmax function in the CSS grid column definition
const hasContentGapLeft = isNavigationOpen || navigationHide;
const hasContentGapRight = drawersTriggerCount <= 0 || hasOpenDrawer;
const hasContentGapRight = drawersTriggerCount === 0 || hasOpenDrawer;
Copy link
Member Author

Choose a reason for hiding this comment

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

I do not think this count can ever be negative number, so decided to simplify for readability

@just-boris just-boris force-pushed the feat-disable-drawers-tools-integration branch from 08565a2 to d509db0 Compare September 28, 2023 13:45
@just-boris just-boris merged commit ede01d3 into main Sep 28, 2023
40 checks passed
@just-boris just-boris deleted the feat-disable-drawers-tools-integration branch September 28, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants