Revise naming and notification around purchasing records

This commit is contained in:
Claudio Ortolina
2025-02-04 12:11:16 +00:00
parent 6cac09e81b
commit acd52978ae
6 changed files with 22 additions and 14 deletions
@@ -167,9 +167,9 @@ defmodule MusicLibraryWeb.RecordComponents do
role="menuitem"
tabindex="-1"
id={"actions-#{record.id}-purchase"}
phx-click={JS.push("purchase", value: %{id: record.id})}
phx-click={JS.push("add-to-collection", value: %{id: record.id})}
>
{gettext("Purchase")}
{gettext("Purchased")}
</.link>
<.link
@@ -129,7 +129,7 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
end
end
def handle_event("purchase", %{"id" => id}, socket) do
def handle_event("add-to-collection", %{"id" => id}, socket) do
record = Records.get_record!(id)
current_time = DateTime.utc_now()
@@ -137,7 +137,7 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
{:ok, _} ->
{:noreply,
socket
|> put_flash(:info, gettext("Record updated successfully"))
|> put_flash(:info, gettext("Record added to the collection"))
|> push_patch(to: ~p"/wishlist")}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -102,7 +102,7 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
end
end
def handle_event("purchase", %{"id" => id}, socket) do
def handle_event("add-to-collection", %{"id" => id}, socket) do
record = Records.get_record!(id)
current_time = DateTime.utc_now()
@@ -110,7 +110,7 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
{:ok, _} ->
{:noreply,
socket
|> put_flash(:info, gettext("Record updated successfully"))
|> put_flash(:info, gettext("Record added to the collection"))
|> push_navigate(to: ~p"/wishlist")}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -126,7 +126,7 @@
role="menuitem"
tabindex="-1"
id={"actions-#{@record.id}-purchase"}
phx-click={JS.push("purchase", value: %{id: @record.id})}
phx-click={JS.push("add-to-collection", value: %{id: @record.id})}
>
<.icon
name="hero-banknotes"
@@ -134,7 +134,7 @@
aria-hidden="true"
data-slot="icon"
/>
{gettext("Purchase")}
{gettext("Purchased")}
</.link>
<.link