fix(rover): wire delete X button to actually remove station rows
This commit is contained in:
parent
10fcc764f6
commit
6f25993998
1 changed files with 18 additions and 17 deletions
|
|
@ -465,8 +465,9 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
Enum.find_value(@bands, "#{band} MHz", fn b -> if b.value == band, do: b.label end)
|
||||
end
|
||||
|
||||
defp station_id(%{id: id}), do: to_string(id)
|
||||
defp station_id(_), do: nil
|
||||
defp station_id(%{id: id}) when not is_nil(id), do: to_string(id)
|
||||
defp station_id(%{callsign: call}) when is_binary(call), do: "call:" <> call
|
||||
defp station_id(_), do: ""
|
||||
|
||||
# ── Render ───────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -571,9 +572,9 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
</.sidebar_section>
|
||||
|
||||
<.sidebar_section title="FIXED STATIONS">
|
||||
<ul class="menu menu-sm p-0 gap-0.5">
|
||||
<li :for={s <- @fixed_stations}>
|
||||
<label class="cursor-pointer flex items-center gap-2 py-1">
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<div :for={s <- @fixed_stations} class="flex items-center gap-2 py-1">
|
||||
<label class="cursor-pointer flex items-center gap-2 flex-1 min-w-0">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox checkbox-xs"
|
||||
|
|
@ -581,20 +582,20 @@ defmodule MicrowavepropWeb.RoverLive do
|
|||
phx-click="toggle_station"
|
||||
phx-value-id={station_id(s)}
|
||||
/>
|
||||
<span class="font-mono text-xs flex-1">{s.callsign}</span>
|
||||
<span class="font-mono text-xs flex-1 truncate">{s.callsign}</span>
|
||||
<span :if={s.grid} class="opacity-60 text-[11px]">{s.grid}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-ghost btn-xs btn-square opacity-50 hover:opacity-100"
|
||||
phx-click="delete_station"
|
||||
phx-value-id={station_id(s)}
|
||||
title="Remove"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-ghost btn-xs btn-square opacity-50 hover:opacity-100 shrink-0"
|
||||
phx-click="delete_station"
|
||||
phx-value-id={station_id(s)}
|
||||
title="Remove"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form phx-submit="add_station" class="flex gap-1 mt-2">
|
||||
<input
|
||||
type="text"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue