diff --git a/webapp/lib/augie_web/live/gps_live.ex b/webapp/lib/augie_web/live/gps_live.ex index 5cc3937..9c86057 100644 --- a/webapp/lib/augie_web/live/gps_live.ex +++ b/webapp/lib/augie_web/live/gps_live.ex @@ -33,8 +33,8 @@ defmodule AugieWeb.GpsLive do def handle_info(%GPS{} = sample, socket) do socket = socket - |> assign(sample_to_assigns(sample)) - |> assign(map_url(sample_to_map_opts(sample))) + |> assign(sample_to_assigns(Map.from_struct(sample))) + |> assign(map_src: map_url(sample_to_map_opts(sample))) {:noreply, socket} end @@ -42,7 +42,6 @@ defmodule AugieWeb.GpsLive do defp sample_to_assigns(sample) do sample |> Enum.map(fn - {key, nil} -> {key, "-"} {key, value} when is_float(value) -> {key, Float.round(value, 2)} {key, value} -> {key, value} end) @@ -53,8 +52,8 @@ defmodule AugieWeb.GpsLive do [ center: location, - marker: "color:red|#{location}", - zoom: 15 + markers: "color:red|#{location}", + zoom: 19 ] end diff --git a/webapp/lib/augie_web/live/gps_live.html.leex b/webapp/lib/augie_web/live/gps_live.html.leex index d5ff89a..ad6ac01 100644 --- a/webapp/lib/augie_web/live/gps_live.html.leex +++ b/webapp/lib/augie_web/live/gps_live.html.leex @@ -6,31 +6,61 @@
Status
-
<%= @status %>
+
<%= @status || "-" %>
Latitude
-
<%= @latitude %>
+
+ <%= if @latitude do %> + <%= @latitude %>° + <% else %> + - + <% end %> +
Longitude
-
<%= @longitude %>
+
+ <%= if @longitude do %> + <%= @longitude %>° + <% else %> + - + <% end %> +
Altitude
-
<%= @altitude %>
+
+ <%= if @altitude do %> + <%= @altitude %> m + <% else %> + - + <% end %> +
Heading
-
<%= @heading %>
+
+ <%= if @heading do %> + <%= @heading %>° + <% else %> + - + <% end %> +
Speed
-
<%= @speed %>
+
+ <%= if @speed do %> + <%= @speed %> m/s + <% else %> + - + <% end %> +
Satellites
-
<%= @satellites %>
+
<%= @satellites || "-" %>