diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js index f845f3a375..fe5f0b810f 100644 --- a/frappe/public/js/frappe/list/list_sidebar.js +++ b/frappe/public/js/frappe/list/list_sidebar.js @@ -38,6 +38,8 @@ frappe.views.ListSidebar = class ListSidebar { this.reload_stats(); }); } + + this.add_insights_banner(); } setup_views() { @@ -239,4 +241,43 @@ frappe.views.ListSidebar = class ListSidebar { this.sidebar.find(".stat-no-records").remove(); this.get_stats(); } + + add_insights_banner() { + try { + if (this.list_view.view != "Report") { + return; + } + + if (localStorage.getItem("show_insights_banner") == "false") { + return; + } + + if (this.insights_banner) { + this.insights_banner.remove(); + } + + const message = "Get more insights from your data with Frappe Insights."; + const link = "https://frappe.io/s/insights"; + const cta = "Get Frappe Insights"; + + this.insights_banner = $(` +
+ `).appendTo(this.sidebar); + } catch (error) { + console.error(error); + } + } };