|
|
@@ -11,6 +11,7 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
{:ok,
|
|
|
socket
|
|
|
|> assign(
|
|
|
+ noob_mode: true,
|
|
|
is_local?: is_local?,
|
|
|
locations: locations,
|
|
|
locations_with_early_slots: MapSet.new(),
|
|
|
@@ -31,7 +32,10 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
end
|
|
|
|
|
|
@impl true
|
|
|
- def handle_params(%{}, _url, socket), do: {:noreply, socket}
|
|
|
+ def handle_params(params, _url, socket) when params == %{}, do: {:noreply, socket}
|
|
|
+
|
|
|
+ def handle_params(%{"noob" => _}, _url, socket),
|
|
|
+ do: {:noreply, socket |> assign(noob_mode: true)}
|
|
|
|
|
|
@impl true
|
|
|
def handle_event("add_location", %{"location_raw" => params}, socket) do
|
|
|
@@ -53,6 +57,14 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
def handle_event("toggle_form", _, socket = %{assigns: %{display_cs: display}}),
|
|
|
do: {:noreply, socket |> assign(display_cs: not display)}
|
|
|
|
|
|
+ def handle_event("trigger_noob_mode", _, socket = %{assigns: %{noob_mode: true}}),
|
|
|
+ do:
|
|
|
+ {:noreply,
|
|
|
+ socket |> assign(noob_mode: false) |> push_patch(to: Routes.index_path(socket, :index))}
|
|
|
+
|
|
|
+ def handle_event("trigger_noob_mode", _, socket = %{assigns: %{noob_mode: false}}),
|
|
|
+ do: {:noreply, socket |> push_patch(to: Routes.index_path(socket, :index, noob: true))}
|
|
|
+
|
|
|
@impl true
|
|
|
def handle_info({:query_sent, id, ref}, socket = %{assigns: %{pending: pending}}) do
|
|
|
{:noreply, socket |> assign(pending: pending |> Map.put(ref, id))}
|