Nav reorder + path calc link from beacon detail

Move Scoring Algorithm directly above About in map and weather-map
sidebars; reorder the horizontal nav so Submit sits before Contacts
to match.

Add a "Plot path to beacon" button on the beacon detail page that
navigates to /path with destination, band (snapped via BandResolver),
and dst_height_ft prefilled from the beacon.
This commit is contained in:
Graham McIntire 2026-04-12 16:33:01 -05:00
parent 73dbe16691
commit ad041ccf4a
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
4 changed files with 31 additions and 13 deletions

View file

@ -43,9 +43,9 @@ defmodule MicrowavepropWeb.Layouts do
<.link navigate="/map" class="btn btn-ghost btn-sm">Map</.link>
<.link navigate="/path" class="btn btn-ghost btn-sm">Path</.link>
<.link navigate="/beacons" class="btn btn-ghost btn-sm">Beacons</.link>
<.link navigate="/submit" class="btn btn-ghost btn-sm">Submit</.link>
<.link navigate="/contacts" class="btn btn-ghost btn-sm">Contacts</.link>
<.link navigate="/contacts/map" class="btn btn-ghost btn-sm">Contact Map</.link>
<.link navigate="/submit" class="btn btn-ghost btn-sm">Submit</.link>
<.link navigate="/about" class="btn btn-ghost btn-sm">About</.link>
<.link
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}

View file

@ -5,6 +5,7 @@ defmodule MicrowavepropWeb.BeaconLive.Show do
alias Microwaveprop.Beacons
alias Microwaveprop.Beacons.Beacon
alias Microwaveprop.Beacons.RangeEstimate
alias Microwaveprop.Radio.BandResolver
@impl true
def render(assigns) do
@ -29,6 +30,9 @@ defmodule MicrowavepropWeb.BeaconLive.Show do
<.button navigate={~p"/beacons"}>
<.icon name="hero-arrow-left" />
</.button>
<.button navigate={path_calc_link(@beacon)}>
<.icon name="hero-map" /> Plot path to beacon
</.button>
<.button
:if={admin?(@current_scope)}
variant="primary"
@ -211,6 +215,20 @@ defmodule MicrowavepropWeb.BeaconLive.Show do
defp format_coord(value) when is_float(value), do: :erlang.float_to_binary(value, decimals: 6)
defp format_coord(value), do: to_string(value)
defp path_calc_link(%Beacon{} = beacon) do
base = %{
"destination" => beacon.grid,
"dst_height_ft" => to_string(beacon.height_ft)
}
params = maybe_put(base, "band", BandResolver.resolve_as_string(beacon.frequency_mhz))
"/path?" <> URI.encode_query(params)
end
defp maybe_put(map, _key, nil), do: map
defp maybe_put(map, key, value), do: Map.put(map, key, value)
attr :label, :string, required: true
slot :inner_block, required: true

View file

@ -474,9 +474,6 @@ defmodule MicrowavepropWeb.MapLive do
<.link navigate="/weather" class="btn btn-xs btn-ghost justify-start">
Weather Map
</.link>
<.link navigate="/algo" class="btn btn-xs btn-ghost justify-start">
Scoring Algorithm
</.link>
<.link navigate="/submit" class="btn btn-xs btn-ghost justify-start">
Submit a Contact
</.link>
@ -486,6 +483,9 @@ defmodule MicrowavepropWeb.MapLive do
<.link navigate="/contacts/map" class="btn btn-xs btn-ghost justify-start">
Contact Map
</.link>
<.link navigate="/algo" class="btn btn-xs btn-ghost justify-start">
Scoring Algorithm
</.link>
<.link navigate="/about" class="btn btn-xs btn-ghost justify-start">
About
</.link>
@ -631,9 +631,6 @@ defmodule MicrowavepropWeb.MapLive do
<li>
<.link navigate="/weather">Weather Map</.link>
</li>
<li>
<.link navigate="/algo">Scoring Algorithm</.link>
</li>
<li>
<.link navigate="/submit">Submit a Contact</.link>
</li>
@ -643,6 +640,9 @@ defmodule MicrowavepropWeb.MapLive do
<li>
<.link navigate="/contacts/map">Contact Map</.link>
</li>
<li>
<.link navigate="/algo">Scoring Algorithm</.link>
</li>
<li>
<.link navigate="/about">About</.link>
</li>

View file

@ -306,9 +306,6 @@ defmodule MicrowavepropWeb.WeatherMapLive do
<.link navigate="/beacons" class="btn btn-xs btn-ghost justify-start">
Beacons
</.link>
<.link navigate="/algo" class="btn btn-xs btn-ghost justify-start">
Scoring Algorithm
</.link>
<.link navigate="/submit" class="btn btn-xs btn-ghost justify-start">
Submit a Contact
</.link>
@ -318,6 +315,9 @@ defmodule MicrowavepropWeb.WeatherMapLive do
<.link navigate="/contacts/map" class="btn btn-xs btn-ghost justify-start">
Contact Map
</.link>
<.link navigate="/algo" class="btn btn-xs btn-ghost justify-start">
Scoring Algorithm
</.link>
<.link navigate="/about" class="btn btn-xs btn-ghost justify-start">
About
</.link>
@ -426,9 +426,6 @@ defmodule MicrowavepropWeb.WeatherMapLive do
<li>
<.link navigate="/beacons">Beacons</.link>
</li>
<li>
<.link navigate="/algo">Scoring Algorithm</.link>
</li>
<li>
<.link navigate="/submit">Submit a Contact</.link>
</li>
@ -438,6 +435,9 @@ defmodule MicrowavepropWeb.WeatherMapLive do
<li>
<.link navigate="/contacts/map">Contact Map</.link>
</li>
<li>
<.link navigate="/algo">Scoring Algorithm</.link>
</li>
<li>
<.link navigate="/about">About</.link>
</li>