The personal finance app for everyone
Fix AI sidebar overflow when user hasn't enabled or created a chat yet (#2044)
Zach Gollwitzer02bfa9f25162
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex d131447f..2089e0f7 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -190,7 +190,8 @@ module ApplicationHelperis_open: right_sidebar_showing,initial_width: right_panel_width,min_width: right_panel_min_width,- max_width: right_panel_max_width+ max_width: right_panel_max_width,+ overflow: right_sidebar_showing ? "auto" : "hidden"},content_max_width: content_max_width}diff --git a/app/javascript/controllers/sidebar_controller.js b/app/javascript/controllers/sidebar_controller.jsindex c5eb3a0c..5e51a01c 100644--- a/app/javascript/controllers/sidebar_controller.js+++ b/app/javascript/controllers/sidebar_controller.js@@ -30,6 +30,7 @@ export default class extends Controller {this.contentTarget.style.maxWidth = `${this.#contentMaxWidth()}px`;this.leftPanelTarget.style.width = `${this.#leftPanelWidth()}px`;this.rightPanelTarget.style.width = `${this.#rightPanelWidth()}px`;+ this.rightPanelTarget.style.overflow = this.#rightPanelOverflow();}#leftPanelWidth() {@@ -52,6 +53,14 @@ export default class extends Controller {return 0;}+ #rightPanelOverflow() {+ if (this.rightPanelOpen) {+ return "auto";+ }++ return "hidden";+ }+#contentMaxWidth() {if (!this.leftPanelOpen && !this.rightPanelOpen) {return 1024;diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erbindex 4f9208ba..d250f1e8 100644--- a/app/views/layouts/application.html.erb+++ b/app/views/layouts/application.html.erb@@ -67,7 +67,7 @@<%# AI chat sidebar %><%= tag.div id: "chat-container",- style: "width: #{sidebar_config.dig(:right_panel, :initial_width)}px",+ style: "width: #{sidebar_config.dig(:right_panel, :initial_width)}px; overflow: #{sidebar_config.dig(:right_panel, :overflow)}",class: class_names("flex flex-col justify-between shrink-0 transition-all duration-300"),data: { controller: "chat hotkey", sidebar_target: "rightPanel", turbo_permanent: true } do %>