feat(rover): drop Min Elev Gain section, link 'Sign in to save' to log-in
This commit is contained in:
parent
c13a5f53be
commit
db1539086b
2 changed files with 8 additions and 35 deletions
|
|
@ -30,7 +30,6 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
@default_mode :ssb
|
||||
@default_forecast_hour 0
|
||||
@default_max_drive_min 120
|
||||
@default_min_elev_gain 0
|
||||
@avg_speed_kmh 65.0
|
||||
|
||||
# NTMS-area anonymous home: EM13 centroid.
|
||||
|
|
@ -52,7 +51,6 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
forecast_hour: @default_forecast_hour,
|
||||
max_drive_min: @default_max_drive_min,
|
||||
drive_radius_km: drive_radius_km(@default_max_drive_min),
|
||||
min_elev_gain: @default_min_elev_gain,
|
||||
fixed_stations: fixed_stations,
|
||||
persisted?: persisted?,
|
||||
home: home,
|
||||
|
|
@ -133,11 +131,6 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
|> push_event("update_drive_radius", %{km: radius_km})}
|
||||
end
|
||||
|
||||
def handle_event("set_min_elev_gain", %{"value" => v}, socket) do
|
||||
gain = v |> parse_int(@default_min_elev_gain) |> clamp(0, 500)
|
||||
{:noreply, assign(socket, min_elev_gain: gain)}
|
||||
end
|
||||
|
||||
def handle_event("toggle_station", %{"id" => id}, socket) do
|
||||
handle_station_mutation(socket, id, &toggle_station/2)
|
||||
end
|
||||
|
|
@ -442,7 +435,7 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
valid_time: socket.assigns.current_valid_time || DateTime.utc_now(),
|
||||
mode: socket.assigns.mode,
|
||||
max_drive_min: socket.assigns.max_drive_min,
|
||||
min_elev_gain: socket.assigns.min_elev_gain
|
||||
min_elev_gain: 0
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -622,8 +615,9 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
<p :if={@station_form_error} class="text-error text-[11px] mt-1">
|
||||
{@station_form_error}
|
||||
</p>
|
||||
<p :if={!@persisted?} class="text-[11px] opacity-50 mt-2">
|
||||
Sign in to save your station list.
|
||||
<p :if={!@persisted?} class="text-[11px] opacity-70 mt-2">
|
||||
<.link href={~p"/users/log-in"} class="link link-primary">Sign in</.link>
|
||||
to save your station list.
|
||||
</p>
|
||||
</.sidebar_section>
|
||||
|
||||
|
|
@ -676,21 +670,6 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
</div>
|
||||
</.sidebar_section>
|
||||
|
||||
<.sidebar_section title="MIN ELEV GAIN">
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="500"
|
||||
step="25"
|
||||
value={@min_elev_gain}
|
||||
phx-change="set_min_elev_gain"
|
||||
phx-debounce="200"
|
||||
name="value"
|
||||
class="range range-xs range-primary"
|
||||
/>
|
||||
<div class="text-xs opacity-70 mt-1">{@min_elev_gain} m above home</div>
|
||||
</.sidebar_section>
|
||||
|
||||
<div class="mt-auto p-3 text-[11px] text-neutral-content/50 border-t border-base-300/50">
|
||||
Tip: click any cell to see per-station predicted SNR.
|
||||
</div>
|
||||
|
|
@ -730,7 +709,9 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
<button type="submit" class="btn btn-xs">Set</button>
|
||||
</form>
|
||||
<p :if={@error} class="text-error text-[11px] mt-1">{@error}</p>
|
||||
<p :if={!@persisted?} class="text-[11px] opacity-50 mt-1">Sign in to save.</p>
|
||||
<p :if={!@persisted?} class="text-[11px] opacity-70 mt-1">
|
||||
<.link href={~p"/users/log-in"} class="link link-primary">Sign in</.link> to save.
|
||||
</p>
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ defmodule MicrowavepropWeb.RoverLiveTest do
|
|||
assert html =~ "FORECAST HOUR"
|
||||
assert html =~ "BAND"
|
||||
assert html =~ "MAX DRIVE TIME"
|
||||
assert html =~ "MIN ELEV GAIN"
|
||||
refute html =~ ">MODE<"
|
||||
refute html =~ "MIN ELEV GAIN"
|
||||
end
|
||||
|
||||
test "displays the three default NTMS stations", %{conn: conn} do
|
||||
|
|
@ -73,14 +73,6 @@ defmodule MicrowavepropWeb.RoverLiveTest do
|
|||
assert_in_delta km, 130.0, 0.1
|
||||
end
|
||||
|
||||
test "set_min_elev_gain updates the slider label", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, ~p"/rover")
|
||||
|
||||
render_hook(view, "set_min_elev_gain", %{"value" => "150"})
|
||||
|
||||
assert render(view) =~ "150 m above home"
|
||||
end
|
||||
|
||||
test "calculate triggers a rover_results push_event with cells + drive_radius_km", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, ~p"/rover")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue