Use LiveToast instead of built-in flash helpers

So that they can stack and get dismissed automatically
This commit is contained in:
Claudio Ortolina
2025-07-16 15:26:30 +01:00
parent 41f040363e
commit acd34424f7
18 changed files with 64 additions and 61 deletions
@@ -92,7 +92,7 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.FormComponent do
{:noreply,
socket
|> put_flash(:info, gettext("Scrobble rule updated successfully"))
|> put_toast(:info, gettext("Scrobble rule updated successfully"))
|> push_patch(to: socket.assigns.patch)}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -107,7 +107,7 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.FormComponent do
{:noreply,
socket
|> put_flash(:info, gettext("Scrobble rule created successfully"))
|> put_toast(:info, gettext("Scrobble rule created successfully"))
|> push_patch(to: socket.assigns.patch)}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -77,11 +77,11 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.Index do
case ScrobbleRules.apply_rule(scrobble_rule) do
{:ok, count} ->
message = gettext("Rule applied successfully. Updated %{count} tracks.", count: count)
{:noreply, put_flash(socket, :info, message)}
{:noreply, put_toast(socket, :info, message)}
{:error, reason} ->
message = gettext("Error applying rule: %{reason}", reason: reason)
{:noreply, put_flash(socket, :error, message)}
{:noreply, put_toast(socket, :error, message)}
end
end
@@ -100,7 +100,7 @@ defmodule MusicLibraryWeb.ScrobbleRulesLive.Index do
count: total_updated
)
{:noreply, put_flash(socket, :info, message)}
{:noreply, put_toast(socket, :info, message)}
end
attr :type, :atom, required: true, values: [:album, :artist]