Consolidate Fluxon button usage via CoreComponents

This commit is contained in:
Claudio Ortolina
2025-05-12 17:13:04 +01:00
parent 7733022cb0
commit 8890c78913
5 changed files with 19 additions and 27 deletions
@@ -48,14 +48,14 @@ defmodule MusicLibraryWeb.BarcodeScannerComponent do
</ul>
<div class="mt-4 flex justify-center">
<Fluxon.Components.Button.button
<.button
variant="solid"
disabled={length(@scan_results) == 0}
phx-disable-with={gettext("Adding...")}
phx-click={JS.push("import_releases", target: "#barcode-scanner")}
>
{gettext("Add releases")}
</Fluxon.Components.Button.button>
</.button>
</div>
</div>
"""
@@ -19,6 +19,7 @@ defmodule MusicLibraryWeb.CoreComponents do
alias Phoenix.LiveView.JS
use Gettext, backend: MusicLibraryWeb.Gettext
defdelegate button(assigns), to: Fluxon.Components.Button
defdelegate date_time_picker(assigns), to: Fluxon.Components.DatePicker
defdelegate input(assigns), to: Fluxon.Components.Input
defdelegate loading(assigns), to: Fluxon.Components.Loading
@@ -114,13 +114,9 @@ defmodule MusicLibraryWeb.FormComponent do
</div>
<:actions>
<div class="w-full md:flex md:justify-center">
<Fluxon.Components.Button.button
variant="solid"
class="w-full md:w-auto"
phx-disable-with={gettext("Saving...")}
>
<.button variant="solid" class="w-full md:w-auto" phx-disable-with={gettext("Saving...")}>
{gettext("Save")}
</Fluxon.Components.Button.button>
</.button>
</div>
</:actions>
</.simple_form>
@@ -37,7 +37,7 @@ defmodule MusicLibraryWeb.ReleaseComponent do
<.sheet :if={@record.selected_release_id} id={@sheet_id} placement="right">
<div class="mt-6 flex justify-between items-center gap-4">
<h3 class="text-lg font-semibold text-zinc-700 dark:text-zinc-300">{gettext("Tracks")}</h3>
<Fluxon.Components.Button.button
<.button
:if={@can_scrobble?}
size="sm"
phx-click="scrobble_release"
@@ -45,15 +45,10 @@ defmodule MusicLibraryWeb.ReleaseComponent do
phx-disable-with={gettext("Scrobbling...")}
>
{gettext("Scrobble release")}
</Fluxon.Components.Button.button>
<Fluxon.Components.Button.button
:if={!@can_scrobble?}
as="link"
size="sm"
href={LastFm.auth_url()}
>
</.button>
<.button :if={!@can_scrobble?} as="link" size="sm" href={LastFm.auth_url()}>
{gettext("Connect your Last.fm account")}
</Fluxon.Components.Button.button>
</.button>
</div>
<div :if={@release_with_tracks} class="space-y-4 mt-4">
@@ -81,7 +76,7 @@ defmodule MusicLibraryWeb.ReleaseComponent do
<h4 class="text-sm md:text-md font-semibold text-zinc-700 dark:text-zinc-300">
{medium_title(medium)}
</h4>
<Fluxon.Components.Button.button
<.button
:if={@can_scrobble?}
size="sm"
phx-click="scrobble_medium"
@@ -90,7 +85,7 @@ defmodule MusicLibraryWeb.ReleaseComponent do
phx-disable-with={gettext("Scrobbling...")}
>
{gettext("Scrobble disc")}
</Fluxon.Components.Button.button>
</.button>
</div>
<ul id={"disc-#{medium.number}"} class="w-full table table-auto">
<li