feat(contact): link grid squares to gridmap.org
This commit is contained in:
parent
0cf044be30
commit
610892e77e
1 changed files with 21 additions and 1 deletions
|
|
@ -1064,7 +1064,8 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
<div class="text-sm font-mono mb-2 text-center">
|
<div class="text-sm font-mono mb-2 text-center">
|
||||||
{format_band(@contact.band)} · {@contact.mode} · {format_dist(
|
{format_band(@contact.band)} · {@contact.mode} · {format_dist(
|
||||||
@elevation_profile.dist_km
|
@elevation_profile.dist_km
|
||||||
)} · {@contact.grid1 || "—"} → {@contact.grid2 || "—"}
|
)} · <.grid_link grid={@contact.grid1} /> →
|
||||||
|
<.grid_link grid={@contact.grid2} />
|
||||||
</div>
|
</div>
|
||||||
<table class="text-sm font-mono mb-2 mx-auto">
|
<table class="text-sm font-mono mb-2 mx-auto">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -2467,4 +2468,23 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
defp maybe_put_band(params, band) when is_integer(band), do: Map.put(params, "band", Integer.to_string(band))
|
defp maybe_put_band(params, band) when is_integer(band), do: Map.put(params, "band", Integer.to_string(band))
|
||||||
defp maybe_put_band(params, band) when is_binary(band), do: Map.put(params, "band", band)
|
defp maybe_put_band(params, band) when is_binary(band), do: Map.put(params, "band", band)
|
||||||
defp maybe_put_band(params, _), do: params
|
defp maybe_put_band(params, _), do: params
|
||||||
|
|
||||||
|
attr :grid, :string, default: nil
|
||||||
|
|
||||||
|
defp grid_link(assigns) do
|
||||||
|
~H"""
|
||||||
|
<%= if @grid && @grid != "" do %>
|
||||||
|
<a
|
||||||
|
href={"https://gridmap.org/#{@grid}"}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="link link-hover"
|
||||||
|
>
|
||||||
|
{@grid}
|
||||||
|
</a>
|
||||||
|
<% else %>
|
||||||
|
—
|
||||||
|
<% end %>
|
||||||
|
"""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue