From 976b6f153faa6fa6f17d96f8f740b8897ac5c999 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 19 Feb 2026 16:02:08 -0600 Subject: [PATCH] Fix slideover toggle: always-light button, map resize via LiveView JS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The slideover toggle button now uses a fixed light theme (white bg, dark arrow) so it's always visible on the map regardless of OS dark mode. Removed prefers-color-scheme overrides since the button overlays the always-light map tiles. Fixed map not resizing when closing the sidebar — the #aprs-map div has phx-update="ignore" so server-rendered classes never updated. Now uses LiveView JS commands (JS.toggle_class + JS.dispatch) to toggle classes client-side and trigger map.invalidateSize(), replacing the custom push_event/handleEvent JS handler. --- assets/js/map.ts | 9 +++++++ lib/aprsme_web/live/map_live/index.ex | 35 ++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/assets/js/map.ts b/assets/js/map.ts index 9c0d640..d43fcb3 100644 --- a/assets/js/map.ts +++ b/assets/js/map.ts @@ -1393,6 +1393,15 @@ let MapAPRSMap = { self.clearRfPathLines(); }); + // Resize map when slideover toggles (class changes handled by LiveView JS commands) + self.el.addEventListener("phx:map-resize", () => { + setTimeout(() => { + if (self.map) { + self.map.invalidateSize(); + } + }, 350); + }); + // Handle bounds-based marker filtering self.handleEvent( "filter_markers_by_bounds", diff --git a/lib/aprsme_web/live/map_live/index.ex b/lib/aprsme_web/live/map_live/index.ex index 43ab276..f70327c 100644 --- a/lib/aprsme_web/live/map_live/index.ex +++ b/lib/aprsme_web/live/map_live/index.ex @@ -11,7 +11,6 @@ defmodule AprsmeWeb.MapLive.Index do import Phoenix.LiveView, only: [connected?: 1, get_connect_params: 1, push_event: 3, push_patch: 2, put_flash: 3] - # Import the new components module alias Aprsme.Packets alias Aprsme.Packets.Clustering alias AprsmeWeb.Endpoint @@ -30,6 +29,9 @@ defmodule AprsmeWeb.MapLive.Index do alias AprsmeWeb.MapLive.RfPath alias AprsmeWeb.MapLive.UrlParams alias AprsmeWeb.TimeUtils + alias Phoenix.LiveView.JS + + # Import the new components module alias Phoenix.LiveView.Socket alias Phoenix.Socket.Broadcast @@ -1087,7 +1089,7 @@ defmodule AprsmeWeb.MapLive.Index do defp toggle_button(assigns) do ~H"""