fix weather page

This commit is contained in:
Graham McIntire 2025-07-08 13:21:02 -05:00
parent 32838712c6
commit 7168448a38
No known key found for this signature in database
4 changed files with 40 additions and 16 deletions

View file

@ -1,5 +1,31 @@
<% assigns = assign_new(assigns, :map_page, fn -> false end) %>
<style>
/* Non-map pages should allow scrolling */
body:not(.map-page) {
overflow: auto;
height: auto;
}
body:not(.map-page) html {
overflow: auto;
height: auto;
}
body:not(.map-page) main {
overflow: visible;
height: auto;
}
body:not(.map-page) .phx-main {
overflow: visible;
height: auto;
}
body:not(.map-page) div[data-phx-main="true"] {
overflow: visible;
height: auto;
}
/* Map page specific styles */
body.map-page header {
display: none;

View file

@ -19,8 +19,8 @@ defmodule AprsmeWeb.LocaleHook do
Gettext.put_locale(AprsmeWeb.Gettext, locale)
end
# Set map_page assign based on route
map_page = is_map_page?(params)
# Set map_page assign based on the view module
map_page = is_map_page?(socket, params)
{:cont, assign(socket, locale: locale, map_page: map_page)}
end
@ -35,17 +35,12 @@ defmodule AprsmeWeb.LocaleHook do
end
end
defp is_map_page?(%{"callsign" => callsign}) when map_size(%{"callsign" => callsign}) == 1 do
# Root callsign route (e.g., /:callsign) is a map page
true
end
defp is_map_page?(%{}) do
# Root route (/) is a map page
true
end
defp is_map_page?(_) do
false
defp is_map_page?(socket, params) do
# Only check the view module from socket private data
case socket.private[:phoenix_live_view] do
%{view: AprsmeWeb.MapLive.Index} -> true
%{view: AprsmeWeb.MapLive.CallsignView} -> true
_ -> false
end
end
end

View file

@ -61,7 +61,9 @@ defmodule AprsmeWeb.MapLive.CallsignView do
latest_symbol_table_id: "/",
latest_symbol_code: ">",
# Flag to track if latest marker was already pushed
latest_marker_pushed: false
latest_marker_pushed: false,
# Indicate this is a map page for proper styling
map_page: true
)
if connected?(socket) do

View file

@ -55,7 +55,8 @@ defmodule AprsmeWeb.MapLive.Index do
historical_hours: "1",
packet_age_threshold: one_hour_ago,
slideover_open: true,
deployed_at: deployed_at
deployed_at: deployed_at,
map_page: true
)}
end