mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
fix: Fixes widget unread view blocking parent page (#3658)
Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9c31d7c672
commit
94209d29cb
@@ -169,7 +169,6 @@ export const IFrameHelper = {
|
|||||||
},
|
},
|
||||||
updateIframeHeight: message => {
|
updateIframeHeight: message => {
|
||||||
const { extraHeight = 0, isFixedHeight } = message;
|
const { extraHeight = 0, isFixedHeight } = message;
|
||||||
if (!extraHeight) return;
|
|
||||||
|
|
||||||
IFrameHelper.setFrameHeightToFitContent(extraHeight, isFixedHeight);
|
IFrameHelper.setFrameHeightToFitContent(extraHeight, isFixedHeight);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export const SDK_CSS = `.woot-widget-holder {
|
|||||||
|
|
||||||
.woot-widget-holder.has-unread-view {
|
.woot-widget-holder.has-unread-view {
|
||||||
border-radius: 0 !important;
|
border-radius: 0 !important;
|
||||||
|
min-height: 80px;
|
||||||
|
height: auto;
|
||||||
bottom: 94px;
|
bottom: 94px;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export default {
|
|||||||
!isEmptyObject(activeCampaign) && !messageCount;
|
!isEmptyObject(activeCampaign) && !messageCount;
|
||||||
if (this.isIFrame && isCampaignReadyToExecute) {
|
if (this.isIFrame && isCampaignReadyToExecute) {
|
||||||
this.replaceRoute('campaigns').then(() => {
|
this.replaceRoute('campaigns').then(() => {
|
||||||
this.setIframeHeight(this.isMobile);
|
this.setIframeHeight(true);
|
||||||
IFrameHelper.sendMessage({ event: 'setUnreadMode' });
|
IFrameHelper.sendMessage({ event: 'setUnreadMode' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -175,17 +175,16 @@ export default {
|
|||||||
const { unreadMessageCount } = this;
|
const { unreadMessageCount } = this;
|
||||||
if (this.isIFrame && unreadMessageCount > 0 && !this.isWidgetOpen) {
|
if (this.isIFrame && unreadMessageCount > 0 && !this.isWidgetOpen) {
|
||||||
this.replaceRoute('unread-messages').then(() => {
|
this.replaceRoute('unread-messages').then(() => {
|
||||||
this.setIframeHeight(this.isMobile);
|
this.setIframeHeight(true);
|
||||||
IFrameHelper.sendMessage({ event: 'setUnreadMode' });
|
IFrameHelper.sendMessage({ event: 'setUnreadMode' });
|
||||||
});
|
});
|
||||||
this.setIframeHeight(this.isMobile);
|
|
||||||
this.handleUnreadNotificationDot();
|
this.handleUnreadNotificationDot();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unsetUnreadView() {
|
unsetUnreadView() {
|
||||||
if (this.isIFrame) {
|
if (this.isIFrame) {
|
||||||
IFrameHelper.sendMessage({ event: 'resetUnreadMode' });
|
IFrameHelper.sendMessage({ event: 'resetUnreadMode' });
|
||||||
this.setIframeHeight();
|
this.setIframeHeight(false);
|
||||||
this.handleUnreadNotificationDot();
|
this.handleUnreadNotificationDot();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -260,17 +259,18 @@ export default {
|
|||||||
} else if (message.event === 'toggle-open') {
|
} else if (message.event === 'toggle-open') {
|
||||||
this.$store.dispatch('appConfig/toggleWidgetOpen', message.isOpen);
|
this.$store.dispatch('appConfig/toggleWidgetOpen', message.isOpen);
|
||||||
|
|
||||||
if (
|
const shouldShowMessageView =
|
||||||
['home'].includes(this.$route.name) &&
|
['home'].includes(this.$route.name) &&
|
||||||
message.isOpen &&
|
message.isOpen &&
|
||||||
this.messageCount
|
this.messageCount;
|
||||||
) {
|
const shouldShowHomeView =
|
||||||
|
!message.isOpen &&
|
||||||
|
['unread-messages', 'campaigns'].includes(this.$route.name);
|
||||||
|
|
||||||
|
if (shouldShowMessageView) {
|
||||||
this.replaceRoute('messages');
|
this.replaceRoute('messages');
|
||||||
}
|
}
|
||||||
if (
|
if (shouldShowHomeView) {
|
||||||
!message.isOpen &&
|
|
||||||
['unread-messages', 'campaigns'].includes(this.$route.name)
|
|
||||||
) {
|
|
||||||
this.$store.dispatch('conversation/setUserLastSeen');
|
this.$store.dispatch('conversation/setUserLastSeen');
|
||||||
this.unsetUnreadView();
|
this.unsetUnreadView();
|
||||||
this.replaceRoute('home');
|
this.replaceRoute('home');
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const getExtraSpaceToScroll = () => {
|
|||||||
if (!unreadMessageWrap) return 0;
|
if (!unreadMessageWrap) return 0;
|
||||||
|
|
||||||
// 24px to compensate the paddings
|
// 24px to compensate the paddings
|
||||||
let extraHeight = 24 + unreadMessageWrap.scrollHeight;
|
let extraHeight = 48 + unreadMessageWrap.scrollHeight;
|
||||||
if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
|
if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
|
||||||
if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user