Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoevanp committed Sep 1, 2022
1 parent fde96a4 commit b36bd23
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/livechat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,5 @@
"updateFiles": [
"package.json"
]
},
"volta": {
"extends": "../../package.json"
}
}
13 changes: 8 additions & 5 deletions packages/livechat/src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ function callHook(action, params) {
}

const updateWidgetStyle = (isOpened) => {
const isFullscreen = smallScreen && widget.dataset.state !== 'triggered';

if (smallScreen && isOpened) {
scrollPosition = document.documentElement.scrollTop;
document.body.classList.add('rc-livechat-mobile-full-screen');
Expand All @@ -80,8 +82,9 @@ const updateWidgetStyle = (isOpened) => {
}
}


if (isOpened) {
widget.style.left = smallScreen && widget.dataset.state !== 'triggered' ? '0' : 'auto';
widget.style.left = isFullscreen ? '0' : 'auto';

/**
* If we use widget.style.height = smallScreen ? '100vh' : ...
Expand All @@ -91,8 +94,8 @@ const updateWidgetStyle = (isOpened) => {
* for widget.style.width
*/

widget.style.height = smallScreen && widget.dataset.state !== 'triggered' ? '100%' : `${ WIDGET_MARGIN + widget_height + WIDGET_MARGIN + WIDGET_MINIMIZED_HEIGHT }px`;
widget.style.width = smallScreen && widget.dataset.state !== 'triggered' ? '100%' : `${ WIDGET_MARGIN + WIDGET_OPEN_WIDTH + WIDGET_MARGIN }px`;
widget.style.height = isFullscreen ? '100%' : `${ WIDGET_MARGIN + widget_height + WIDGET_MARGIN + WIDGET_MINIMIZED_HEIGHT }px`;
widget.style.width = isFullscreen ? '100%' : `${ WIDGET_MARGIN + WIDGET_OPEN_WIDTH + WIDGET_MARGIN }px`;
} else {
widget.style.left = 'auto';
widget.style.width = `${ WIDGET_MARGIN + WIDGET_MINIMIZED_WIDTH + WIDGET_MARGIN }px`;
Expand Down Expand Up @@ -159,17 +162,17 @@ const openWidget = () => {

const resizeWidget = (height) => {
widget_height = height;
updateWidgetStyle(true);
widget.dataset.state = 'triggered';
updateWidgetStyle(true);
};

function closeWidget() {
if (widget.dataset.state === 'closed') {
return;
}

updateWidgetStyle(false);
widget.dataset.state = 'closed';
updateWidgetStyle(false);
emitCallback('chat-minimized');
}

Expand Down
1 change: 0 additions & 1 deletion packages/livechat/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ module.exports = (env, argv) => [
clientLogLevel: 'trace',
overlay: true,
stats: 'normal',
writeToDisk: true,
watchOptions: {
ignored: [path.resolve(__dirname, './dist'), path.resolve(__dirname, './node_modules')],
},
Expand Down

0 comments on commit b36bd23

Please sign in to comment.