diff --git a/lib/freedive_web/live/liliform_live.ex b/lib/freedive_web/live/liliform_live.ex
index 5379d0c..295b4e0 100644
--- a/lib/freedive_web/live/liliform_live.ex
+++ b/lib/freedive_web/live/liliform_live.ex
@@ -17,6 +17,8 @@ defmodule FreediveWeb.LiliformLive do
filters = filters()
socket = assign(socket, :opts, Keyword.get(unquote(opts), :opts, []))
socket = assign(socket, :items_all, items)
+ socket = assign(socket, :selected_item, nil)
+ socket = assign(socket, :details, nil)
socket =
assign(
@@ -55,6 +57,34 @@ defmodule FreediveWeb.LiliformLive do
{:noreply, socket}
end
+
+ def(handle_event("tap", %{"name" => item_name}, socket)) do
+ # 1 tap to select, 2 taps for details
+ item = socket.assigns.items[item_name]
+ socket =
+ case socket.assigns.selected_item do
+ nil ->
+ assign(socket, :selected_item, item)
+
+ selected ->
+ case selected.name == item_name do
+ true ->
+ case socket.assigns.details do
+ nil ->
+ assign(socket, :details, true)
+
+ _ ->
+ assign(socket, %{selected_item: item, details: nil})
+ end
+
+ false ->
+ assign(socket, %{selected_item: item, details: nil})
+ end
+ end
+ IO.inspect(socket.assigns.selected_item, label: "selected_item")
+ IO.inspect(socket.assigns.details, label: "details")
+ {:noreply, socket}
+ end
end
end
@@ -68,9 +98,10 @@ defmodule FreediveWeb.LiliformLive do
items
_ ->
- Enum.filter(items, fn item ->
+ Enum.filter(items, fn {_, item} ->
Map.get(item, key) == true
end)
+ Enum.into(%{}, items)
end
end
diff --git a/lib/freedive_web/live/service_live.ex b/lib/freedive_web/live/service_live.ex
index e4967d5..76a2754 100644
--- a/lib/freedive_web/live/service_live.ex
+++ b/lib/freedive_web/live/service_live.ex
@@ -4,14 +4,18 @@ defmodule FreediveWeb.ServiceLive do
def render(assigns) do
~H"""
<.page name="Services" filters={@filters}>
-