From 71b44f15dd5e516faf9e95083157f9abbd8e65d1 Mon Sep 17 00:00:00 2001 From: Romain Estievenart Date: Thu, 13 Aug 2020 09:18:50 +0000 Subject: [PATCH] [FIX] im_livechat, website_event_track_online: avoid overlapping banners On mobile devices, when you go for the first time inside the event public page the PWA install bar and the livechat tooltip are displayed at same area. Because of this it's was difficult to click on the "install" button. X-original-commit: 6705c6b6fe0360f95b4a499a9141f876648b7202 --- addons/im_livechat/static/src/legacy/public_livechat.js | 7 +++++++ .../static/src/js/website_event_pwa_widget.js | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/legacy/public_livechat.js b/addons/im_livechat/static/src/legacy/public_livechat.js index 67d93ffab48..5a29d6e667f 100644 --- a/addons/im_livechat/static/src/legacy/public_livechat.js +++ b/addons/im_livechat/static/src/legacy/public_livechat.js @@ -110,6 +110,13 @@ var LivechatButton = Widget.extend({ if (this.options.button_text_color) { this.$el.css('color', this.options.button_text_color); } + + // If website_event_track_online installed, put the livechat banner above the PWA banner. + var pwaBannerHeight = $('.o_pwa_install_banner').outerHeight(true); + if (pwaBannerHeight) { + this.$el.css('bottom', pwaBannerHeight + 'px'); + } + return this._super(); }, diff --git a/addons/website_event_track_online/static/src/js/website_event_pwa_widget.js b/addons/website_event_track_online/static/src/js/website_event_pwa_widget.js index 15770c023dd..c50e9955c68 100644 --- a/addons/website_event_track_online/static/src/js/website_event_pwa_widget.js +++ b/addons/website_event_track_online/static/src/js/website_event_pwa_widget.js @@ -76,6 +76,7 @@ odoo.define("website_event_track_online.website_event_pwa_widget", function (req */ _hideInstallBanner: function () { this.installBanner ? this.installBanner.destroy() : undefined; + $('.o_livechat_button').css('bottom', '0'); }, /** @@ -102,7 +103,11 @@ odoo.define("website_event_track_online.website_event_pwa_widget", function (req */ _showInstallBanner: function () { this.installBanner = new PWAInstallBanner(this); - this.installBanner.appendTo(this.$el); + this.installBanner.appendTo(this.$el).then(() => { + // If Livechat available, It should be placed above the PWA banner. + var height = this.$('.o_pwa_install_banner').outerHeight(true); + $('.o_livechat_button').css('bottom', height + 'px'); + }); }, //--------------------------------------------------------------------------