+ <.link
+ href={@item.url}
+ class="block p-1 w-full border border-white hover:bg-slate-100 hover:border-black select-none"
+ target="_blank"
+ >
+ Go to URL
+
+
+ """
+ end
end
diff --git a/lib/wish_web/live/home_live/index.html.heex b/lib/wish_web/live/home_live/index.html.heex
index 9dc02e2..d8bd356 100644
--- a/lib/wish_web/live/home_live/index.html.heex
+++ b/lib/wish_web/live/home_live/index.html.heex
@@ -16,7 +16,6 @@
:for={item <- @items}
phx-click={JS.navigate(~p"/details/#{item}")}
class="h-72 p-2 rounded hover:bg-zinc-100 active:bg-zinc-200"
- ,
>
@item.id})
+ |> JS.hide(to: "#dropdown-#{@item.id}")
+ }
+ >
+ Mark received
+
+
<.icon name="hero-check-circle" />Received
@@ -37,24 +36,12 @@
<%= item.title %>
<.icon name="hero-ellipsis-vertical" class="w-7 h-7" />
-
-
+ <.dropdown item={item} />
item.id})
- |> JS.hide(to: "#dropdown-#{item.id}")
- }
- >
- Mark received
-
-
+ <%= item.description %>
+
<% else %>
@@ -71,7 +58,7 @@
alt={item.title}
class="max-h-full rounded"
/>
- <%= if item.received do %>
+ <%= if item.received && !@current_user do %>
<.icon name="hero-check-circle" />Received
@@ -82,22 +69,7 @@
<.icon name="hero-ellipsis-vertical" class="w-7 h-7" />
-
diff --git a/lib/wish_web/live/item_live/form_component.ex b/lib/wish_web/live/item_live/form_component.ex
index 0206993..913fff4 100644
--- a/lib/wish_web/live/item_live/form_component.ex
+++ b/lib/wish_web/live/item_live/form_component.ex
@@ -23,7 +23,6 @@ defmodule WishWeb.ItemLive.FormComponent do
<.input field={@form[:description]} type="text" label="Description" />
<.input field={@form[:url]} type="text" label="Url" />
<.input field={@form[:image_url]} type="text" label="Image URL" />
- <.input field={@form[:received]} type="checkbox" label="Received" />
<.input field={@form[:desire]} type="number" label="Desire" />
<:actions>
<.button phx-disable-with="Saving...">Save Item
diff --git a/lib/wish_web/live/item_live/show.html.heex b/lib/wish_web/live/item_live/show.html.heex
index aeb5508..37f23dc 100644
--- a/lib/wish_web/live/item_live/show.html.heex
+++ b/lib/wish_web/live/item_live/show.html.heex
@@ -12,7 +12,6 @@
<:item title="Title"><%= @item.title %>
<:item title="Description"><%= @item.description %>
<:item title="Url"><%= @item.url %>
- <:item title="Received"><%= @item.received %>
<:item title="Desire"><%= @item.desire %>
diff --git a/lib/wish_web/router.ex b/lib/wish_web/router.ex
index 74f826c..3665ff3 100644
--- a/lib/wish_web/router.ex
+++ b/lib/wish_web/router.ex
@@ -24,8 +24,11 @@ defmodule WishWeb.Router do
scope "/", WishWeb do
pipe_through [:browser, :get_layout]
- live "/", HomeLive.Index, :index
- live "/details/:id", HomeLive.Details, :index
+ live_session :home_page,
+ on_mount: [{WishWeb.UserAuth, :mount_current_user}] do
+ live "/", HomeLive.Index, :index
+ live "/details/:id", HomeLive.Details, :index
+ end
end
# Other scopes may use custom stacks.
@@ -57,7 +60,7 @@ defmodule WishWeb.Router do
live_session :redirect_if_user_is_authenticated,
on_mount: [{WishWeb.UserAuth, :redirect_if_user_is_authenticated}] do
- live "/users/register", UserRegistrationLive, :new
+ # live "/users/register", UserRegistrationLive, :new
live "/users/log_in", UserLoginLive, :new
live "/users/reset_password", UserForgotPasswordLive, :new
live "/users/reset_password/:token", UserResetPasswordLive, :edit
-
+ <.dropdown item={item} />
item.id})
- |> JS.hide(to: "#dropdown-#{item.id}")
- }
- >
- Mark received
-
-