diff --git a/lib/wild_web/live/book_read_live/form_component.ex b/lib/wild_web/live/book_read_live/form_component.ex
deleted file mode 100644
index 9d7be8c..0000000
--- a/lib/wild_web/live/book_read_live/form_component.ex
+++ /dev/null
@@ -1,86 +0,0 @@
-defmodule WildWeb.BookReadLive.FormComponent do
- use WildWeb, :live_component
-
- alias Wild.BookReads
-
- @impl true
- def render(assigns) do
- ~H"""
-
- <.header>
- {@title}
- <:subtitle>Use this form to manage book_read records in your database.
-
-
- <.simple_form
- for={@form}
- id="book_read-form"
- phx-target={@myself}
- phx-change="validate"
- phx-submit="save"
- >
- <.input field={@form[:rating]} type="number" label="Rating" />
- <.input field={@form[:thoughts]} type="text" label="Thoughts" />
- <.input field={@form[:read_start]} type="datetime-local" label="Read start" />
- <.input field={@form[:read_finish]} type="datetime-local" label="Read finish" />
- <.input field={@form[:progress]} type="number" label="Progress" />
- <:actions>
- <.button phx-disable-with="Saving...">Save Book read
-
-
-
- """
- end
-
- @impl true
- def update(%{book_read: book_read} = assigns, socket) do
- {:ok,
- socket
- |> assign(assigns)
- |> assign_new(:form, fn ->
- to_form(BookReads.change_book_read(book_read))
- end)}
- end
-
- @impl true
- def handle_event("validate", %{"book_read" => book_read_params}, socket) do
- changeset = BookReads.change_book_read(socket.assigns.book_read, book_read_params)
- {:noreply, assign(socket, form: to_form(changeset, action: :validate))}
- end
-
- def handle_event("save", %{"book_read" => book_read_params}, socket) do
- save_book_read(socket, socket.assigns.action, book_read_params)
- end
-
- defp save_book_read(socket, :edit, book_read_params) do
- case BookReads.update_book_read(socket.assigns.book_read, book_read_params) do
- {:ok, book_read} ->
- notify_parent({:saved, book_read})
-
- {:noreply,
- socket
- |> put_flash(:info, "Book read updated successfully")
- |> push_patch(to: socket.assigns.patch)}
-
- {:error, %Ecto.Changeset{} = changeset} ->
- {:noreply, assign(socket, form: to_form(changeset))}
- end
- end
-
- defp save_book_read(socket, :new, book_read_params) do
- case BookReads.create_book_read(book_read_params) do
- {:ok, book_read} ->
- notify_parent({:saved, book_read})
-
- {:noreply,
- socket
- |> put_flash(:info, "Book read created successfully")
- |> push_patch(to: socket.assigns.patch)}
-
- {:error, %Ecto.Changeset{} = changeset} ->
- {:noreply, assign(socket, form: to_form(changeset))}
- end
- end
-
- defp notify_parent(msg), do: send(self(), {__MODULE__, msg})
-end
diff --git a/lib/wild_web/live/book_read_live/index.ex b/lib/wild_web/live/book_read_live/index.ex
deleted file mode 100644
index dccc6d9..0000000
--- a/lib/wild_web/live/book_read_live/index.ex
+++ /dev/null
@@ -1,47 +0,0 @@
-defmodule WildWeb.BookReadLive.Index do
- use WildWeb, :live_view
-
- alias Wild.BookReads
- alias Wild.BookReads.BookRead
-
- @impl true
- def mount(_params, _session, socket) do
- {:ok, stream(socket, :book_reads, BookReads.list_book_reads())}
- end
-
- @impl true
- def handle_params(params, _url, socket) do
- {:noreply, apply_action(socket, socket.assigns.live_action, params)}
- end
-
- defp apply_action(socket, :edit, %{"id" => id}) do
- socket
- |> assign(:page_title, "Edit Book read")
- |> assign(:book_read, BookReads.get_book_read!(id))
- end
-
- defp apply_action(socket, :new, _params) do
- socket
- |> assign(:page_title, "New Book read")
- |> assign(:book_read, %BookRead{})
- end
-
- defp apply_action(socket, :index, _params) do
- socket
- |> assign(:page_title, "Listing Book reads")
- |> assign(:book_read, nil)
- end
-
- @impl true
- def handle_info({WildWeb.BookReadLive.FormComponent, {:saved, book_read}}, socket) do
- {:noreply, stream_insert(socket, :book_reads, book_read)}
- end
-
- @impl true
- def handle_event("delete", %{"id" => id}, socket) do
- book_read = BookReads.get_book_read!(id)
- {:ok, _} = BookReads.delete_book_read(book_read)
-
- {:noreply, stream_delete(socket, :book_reads, book_read)}
- end
-end
diff --git a/lib/wild_web/live/book_read_live/index.html.heex b/lib/wild_web/live/book_read_live/index.html.heex
deleted file mode 100644
index 6d9c3d5..0000000
--- a/lib/wild_web/live/book_read_live/index.html.heex
+++ /dev/null
@@ -1,45 +0,0 @@
-<.header>
- Listing Book reads
- <:actions>
- <.link patch={~p"/book_reads/new"}>
- <.button>New Book read
-
-
-
-
-<.table
- id="book_reads"
- rows={@streams.book_reads}
- row_click={fn {_id, book_read} -> JS.navigate(~p"/book_reads/#{book_read}") end}
->
- <:col :let={{_id, book_read}} label="Rating">{book_read.rating}
- <:col :let={{_id, book_read}} label="Thoughts">{book_read.thoughts}
- <:col :let={{_id, book_read}} label="Read start">{book_read.read_start}
- <:col :let={{_id, book_read}} label="Read finish">{book_read.read_finish}
- <:col :let={{_id, book_read}} label="Progress">{book_read.progress}
- <:action :let={{_id, book_read}}>
-
- <.link navigate={~p"/book_reads/#{book_read}"}>Show
-
- <.link patch={~p"/book_reads/#{book_read}/edit"}>Edit
-
- <:action :let={{id, book_read}}>
- <.link
- phx-click={JS.push("delete", value: %{id: book_read.id}) |> hide("##{id}")}
- data-confirm="Are you sure?"
- >
- Delete
-
-
-
-
-<.modal :if={@live_action in [:new, :edit]} id="book_read-modal" show on_cancel={JS.patch(~p"/book_reads")}>
- <.live_component
- module={WildWeb.BookReadLive.FormComponent}
- id={@book_read.id || :new}
- title={@page_title}
- action={@live_action}
- book_read={@book_read}
- patch={~p"/book_reads"}
- />
-
diff --git a/lib/wild_web/live/book_read_live/show.ex b/lib/wild_web/live/book_read_live/show.ex
deleted file mode 100644
index ed329c8..0000000
--- a/lib/wild_web/live/book_read_live/show.ex
+++ /dev/null
@@ -1,21 +0,0 @@
-defmodule WildWeb.BookReadLive.Show do
- use WildWeb, :live_view
-
- alias Wild.BookReads
-
- @impl true
- def mount(_params, _session, socket) do
- {:ok, socket}
- end
-
- @impl true
- def handle_params(%{"id" => id}, _, socket) do
- {:noreply,
- socket
- |> assign(:page_title, page_title(socket.assigns.live_action))
- |> assign(:book_read, BookReads.get_book_read!(id))}
- end
-
- defp page_title(:show), do: "Show Book read"
- defp page_title(:edit), do: "Edit Book read"
-end
diff --git a/lib/wild_web/live/book_read_live/show.html.heex b/lib/wild_web/live/book_read_live/show.html.heex
deleted file mode 100644
index af74354..0000000
--- a/lib/wild_web/live/book_read_live/show.html.heex
+++ /dev/null
@@ -1,30 +0,0 @@
-<.header>
- Book read {@book_read.id}
- <:subtitle>This is a book_read record from your database.
- <:actions>
- <.link patch={~p"/book_reads/#{@book_read}/show/edit"} phx-click={JS.push_focus()}>
- <.button>Edit book_read
-
-
-
-
-<.list>
- <:item title="Rating">{@book_read.rating}
- <:item title="Thoughts">{@book_read.thoughts}
- <:item title="Read start">{@book_read.read_start}
- <:item title="Read finish">{@book_read.read_finish}
- <:item title="Progress">{@book_read.progress}
-
-
-<.back navigate={~p"/book_reads"}>Back to book_reads
-
-<.modal :if={@live_action == :edit} id="book_read-modal" show on_cancel={JS.patch(~p"/book_reads/#{@book_read}")}>
- <.live_component
- module={WildWeb.BookReadLive.FormComponent}
- id={@book_read.id}
- title={@page_title}
- action={@live_action}
- book_read={@book_read}
- patch={~p"/book_reads/#{@book_read}"}
- />
-
diff --git a/lib/wild_web/live/index.ex b/lib/wild_web/live/index.ex
new file mode 100644
index 0000000..0dc2683
--- /dev/null
+++ b/lib/wild_web/live/index.ex
@@ -0,0 +1,45 @@
+defmodule WildWeb.Index do
+ use WildWeb, :live_view
+
+ @impl true
+ def mount(_params, _session, socket) do
+ # {:ok, stream(socket, :book_reads, BookReads.list_book_reads())}
+ {:ok, socket}
+ end
+
+ # @impl true
+ # def handle_params(params, _url, socket) do
+ # {:noreply, apply_action(socket, socket.assigns.live_action, params)}
+ # end
+ #
+ # defp apply_action(socket, :edit, %{"id" => id}) do
+ # socket
+ # |> assign(:page_title, "Edit Book read")
+ # |> assign(:book_read, BookReads.get_book_read!(id))
+ # end
+ #
+ # defp apply_action(socket, :new, _params) do
+ # socket
+ # |> assign(:page_title, "New Book read")
+ # |> assign(:book_read, %BookRead{})
+ # end
+ #
+ # defp apply_action(socket, :index, _params) do
+ # socket
+ # |> assign(:page_title, "Listing Book reads")
+ # |> assign(:book_read, nil)
+ # end
+ #
+ # @impl true
+ # def handle_info({WildWeb.BookReadLive.FormComponent, {:saved, book_read}}, socket) do
+ # {:noreply, stream_insert(socket, :book_reads, book_read)}
+ # end
+ #
+ # @impl true
+ # def handle_event("delete", %{"id" => id}, socket) do
+ # book_read = BookReads.get_book_read!(id)
+ # {:ok, _} = BookReads.delete_book_read(book_read)
+ #
+ # {:noreply, stream_delete(socket, :book_reads, book_read)}
+ # end
+end
diff --git a/lib/wild_web/live/index.html.heex b/lib/wild_web/live/index.html.heex
new file mode 100644
index 0000000..88990aa
--- /dev/null
+++ b/lib/wild_web/live/index.html.heex
@@ -0,0 +1 @@
+Hello World
diff --git a/lib/wild_web/router.ex b/lib/wild_web/router.ex
index eae605c..070f39d 100644
--- a/lib/wild_web/router.ex
+++ b/lib/wild_web/router.ex
@@ -17,11 +17,11 @@ defmodule WildWeb.Router do
plug :accepts, ["json"]
end
- scope "/", WildWeb do
- pipe_through :browser
-
- get "/", PageController, :home
- end
+ # scope "/", WildWeb do
+ # pipe_through :browser
+ #
+ # get "/", PageController, :home
+ # end
# Other scopes may use custom stacks.
# scope "/api", WildWeb do
@@ -80,6 +80,7 @@ defmodule WildWeb.Router do
on_mount: [{WildWeb.UserAuth, :mount_current_user}] do
live "/account/confirm/:token", UserConfirmationLive, :edit
live "/account/confirm", UserConfirmationInstructionsLive, :new
+ live "/", Index
end
end
end