Skip to content

feat: Bottom drawer (v2)#3922

Merged
georgylobko merged 13 commits intomainfrom
feat/bottom-drawer-v2
Oct 24, 2025
Merged

feat: Bottom drawer (v2)#3922
georgylobko merged 13 commits intomainfrom
feat/bottom-drawer-v2

Conversation

@georgylobko
Copy link
Member

@georgylobko georgylobko commented Oct 9, 2025

Description

This PR introduces a new panel within existing AppLayout component. It does not affect any publicly available api. The only way to register it is using the existing plugin api registerDrawer with an additional parameter position: "bottom".

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

How has this been tested?

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 Oct 9, 2025

Codecov Report

❌ Patch coverage is 97.20280% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.17%. Comparing base (7d2d06e) to head (aadf3cb).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...al-refresh-toolbar/drawer/global-bottom-drawer.tsx 96.11% 3 Missing and 1 partial ⚠️
...ut/visual-refresh-toolbar/state/use-app-layout.tsx 94.73% 3 Missing ⚠️
...visual-refresh-toolbar/state/use-bottom-drawers.ts 98.21% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3922    +/-   ##
========================================
  Coverage   97.17%   97.17%            
========================================
  Files         854      856     +2     
  Lines       24988    25242   +254     
  Branches     8805     8937   +132     
========================================
+ Hits        24281    24528   +247     
- Misses        659      665     +6     
- Partials       48       49     +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

});

export const registerBottomDrawer = () => {
awsuiPlugins.appLayout.registerDrawer({
Copy link
Member

Choose a reason for hiding this comment

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

Can we from now on use the new awsuiWidgetsPlugins for all new runtime API?

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to the new runtime api

Comment on lines +283 to +285
if (!root) {
return;
}
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 not need to clean up the refs when unmounting?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because refs.close refers to the object link, not its value

}
if (props.globalDrawers && !checkAlreadyExists(!!toolbar.globalDrawers, 'globalDrawers')) {
toolbar.globalDrawersFocusControl = props.globalDrawersFocusControl;
toolbar.bottomDrawersFocusRef = props.bottomDrawersFocusRef;
Copy link
Member

Choose a reason for hiding this comment

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

Why does it go into props.globalDrawers condition instead of its own? What will happen if no global drawers registered?

Copy link
Member Author

@georgylobko georgylobko Oct 17, 2025

Choose a reason for hiding this comment

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

Made it go into its own array

maxGlobalDrawersSizes: Record<string, number>;
drawers: ReadonlyArray<InternalDrawer>;
drawersFocusControl: FocusControlState;
bottomDrawersFocusControl: FocusControlState;
Copy link
Member

Choose a reason for hiding this comment

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

AppLayoutInternals is the legacy widget interface which we will remove once all consumers update.

All new features should live AppLayoutWidgetizedState

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

"activeAiDrawerSize": 0,
"activeDrawer": undefined,
"activeDrawerSize": 290,
"activeGlobalBottomDrawerId": null,
Copy link
Member

Choose a reason for hiding this comment

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

Why is there a diff in the snapshot? Will it cause any impact in the widget?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

@georgylobko georgylobko force-pushed the feat/bottom-drawer-v2 branch from 7ef78e0 to d3771c6 Compare October 13, 2025 08:23
@georgylobko georgylobko force-pushed the feat/bottom-drawer-v2 branch 3 times, most recently from 7d952c5 to 2b86095 Compare October 15, 2025 12:20
@georgylobko georgylobko force-pushed the feat/bottom-drawer-v2 branch from 2b86095 to 27968fe Compare October 16, 2025 09:06
@georgylobko georgylobko force-pushed the feat/bottom-drawer-v2 branch from ad4ad2a to 7055078 Compare October 16, 2025 13:21
Copy link
Member

@just-boris just-boris left a comment

Choose a reason for hiding this comment

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

The comment about snapshot diff is blocking, everything else is FYI

Comment on lines +25 to +29
useEffect(() => {
if (activeGlobalBottomDrawerId) {
openBottomDrawersHistory.current.add(activeGlobalBottomDrawerId);
}
}, [activeGlobalBottomDrawerId]);
Copy link
Member

Choose a reason for hiding this comment

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

Ok, I will resolve this thread for now, but please make a follow up

Comment on lines -347 to +456
getMaxHeight: useStableCallback(() => {
getMaxHeight: useCallback(() => {
Copy link
Member

Choose a reason for hiding this comment

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

This smells like a beginning of the problem, but up to you if you are comfortable with that risk or not


/**
* Registers a new runtime drawer to app layout
* Registers a new ai runtime drawer to app layout
Copy link
Member

Choose a reason for hiding this comment

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

Let's call it "left" in the comment too.

Not for this PR, but in general, we should look for removing "ai" from the naming, because it is not relevant. "Global" drawers may contain "AI" stuff too

},
"AppLayoutSplitPanelDrawerBottomImplementation" => {
"appLayoutInternals": {
"widgetizedState": {
Copy link
Member

Choose a reason for hiding this comment

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

⛳️ There is still a diff in the snapshot even after the change is applied. It seems like more cross-boundary changes need to be fixed

@georgylobko georgylobko added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit 031f2af Oct 24, 2025
49 checks passed
@georgylobko georgylobko deleted the feat/bottom-drawer-v2 branch October 24, 2025 09:01
kuahuu pushed a commit to kuahuu/components that referenced this pull request Oct 24, 2025
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