Skip to content

Commit

Permalink
[AC-3505] fix: add root element to full screen component for modal (#329
Browse files Browse the repository at this point in the history
)

## Changes

- Fixed a crash when opening a modal in the full-screen widget (root
element for React portal not found).

ticket: [AC-3505]

[AC-3505]:
https://sendbird.atlassian.net/browse/AC-3505?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
bang9 authored Aug 7, 2024
1 parent e066ed7 commit ea75707
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/components/widget/WidgetWindowExternal.tsx

This file was deleted.

23 changes: 23 additions & 0 deletions src/components/widget/WidgetWindowFullScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Chat from './Chat';
import { ChatAiWidgetProps } from './ChatAiWidget';
import ProviderContainer from './ProviderContainer';
import { elementIds } from '../../const';

/**
* NOTE: External purpose only.
* Do not use this component directly. Use Chat instead for internal use.
*/
function WidgetWindowFullScreen(props: ChatAiWidgetProps) {
return (
<ProviderContainer {...props}>
<div
id={elementIds.widgetWindow}
style={{ position: 'fixed', left: 0, top: 0, width: '100%', height: '100%', transform: 'scale(1)' }}
>
<Chat />
</div>
</ProviderContainer>
);
}

export default WidgetWindowFullScreen;
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { default as ChatAiWidget } from './components/widget/ChatAiWidget';
export { type ProviderContainerProps as ChatAiWidgetConfigs } from './components/widget/ProviderContainer';
export { default as ChatWindow } from './components/widget/WidgetWindowExternal';
export { default as ChatWindow } from './components/widget/WidgetWindowFullScreen';
export { widgetServiceName } from './const';
export { clearWidgetSessionCache, clearCache } from './libs/storage/widgetSessionCache';

Expand Down

0 comments on commit ea75707

Please sign in to comment.