Skip to content

Commit 8f2c7f2

Browse files
authored
fix(lightspeed): fix the overlay mode opening underneath the ApplicationDrawer (#2632)
1 parent 7b7bab9 commit 8f2c7f2

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-lightspeed': patch
3+
---
4+
5+
fix the overlay mode opening underneath the ApplicationDrawer

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedDrawerProvider.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { useLocation, useMatch, useNavigate } from 'react-router-dom';
2727
import { makeStyles } from '@mui/styles';
2828
import { ChatbotDisplayMode, ChatbotModal } from '@patternfly/chatbot';
2929

30+
import { DOCKED_CONTENT_OFFSET } from '../const';
3031
import { useBackstageUserIdentity, useDisplayModeSettings } from '../hooks';
3132
import { FileContent } from '../types';
3233
import { LightspeedChatContainer } from './LightspeedChatContainer';
@@ -40,6 +41,10 @@ const useStyles = makeStyles(theme => ({
4041
right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,
4142
maxWidth: 'min(30rem, calc(100vw - 32px)) !important',
4243
overflowX: 'hidden' as const,
44+
transition: 'margin-right 0.3s ease',
45+
'body.docked-drawer-open &': {
46+
marginRight: DOCKED_CONTENT_OFFSET,
47+
},
4348
},
4449
}));
4550

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedFAB.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Tooltip from '@mui/material/Tooltip';
2020
import { makeStyles } from '@mui/styles';
2121
import { ChatbotDisplayMode } from '@patternfly/chatbot';
2222

23+
import { DOCKED_CONTENT_OFFSET } from '../const';
2324
import { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';
2425
import { LightspeedFABIcon } from './LightspeedIcon';
2526

@@ -41,10 +42,10 @@ const useStyles = makeStyles(theme => ({
4142
display: 'flex',
4243
position: 'fixed',
4344

44-
// When drawer is docked, adjust margin
45-
'.docked-drawer-open &': {
45+
// When ApplicationDrawer is docked, match main content inset
46+
'body.docked-drawer-open &': {
4647
transition: 'margin-right 0.3s ease',
47-
marginRight: 'var(--docked-drawer-width, 500px) ',
48+
marginRight: DOCKED_CONTENT_OFFSET,
4849
},
4950
},
5051
}));

workspaces/lightspeed/plugins/lightspeed/src/const.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@ export const RHDH_SAMPLE_PROMPTS: SamplePrompts = [
7070
export const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [
7171
'lightspeed_question_validity-shield',
7272
];
73+
74+
// Matches app shell margin on main when ApplicationDrawer is docked (e.g. Root.tsx).
75+
export const DOCKED_CONTENT_OFFSET =
76+
'calc(var(--docked-drawer-width, 500px) + 1.5em)';

0 commit comments

Comments
 (0)