diff --git a/lib/music_library_web/components/barcode_scanner_component.ex b/lib/music_library_web/components/barcode_scanner_component.ex index 77339682..9c22bd2a 100644 --- a/lib/music_library_web/components/barcode_scanner_component.ex +++ b/lib/music_library_web/components/barcode_scanner_component.ex @@ -286,12 +286,18 @@ defmodule MusicLibraryWeb.BarcodeScannerComponent do )}
- <.badge :if={@status == :new} color={:gray} text={gettext("New")} /> + <.badge :if={@status == :new}> + {gettext("New")} + <.link :if={@status == :wishlisted} navigate={~p"/wishlist/#{@record_id}"}> - <.badge color={:yellow} text={gettext("Wishlisted")} /> + <.badge color="yellow"> + {gettext("Wishlisted")} + <.link :if={@status == :collected} navigate={~p"/collection/#{@record_id}"}> - <.badge color={:green} text={gettext("Collected")} /> + <.badge color="green"> + {gettext("Collected")} + """ diff --git a/lib/music_library_web/components/core_components.ex b/lib/music_library_web/components/core_components.ex index bc8a381a..96820a2d 100644 --- a/lib/music_library_web/components/core_components.ex +++ b/lib/music_library_web/components/core_components.ex @@ -19,6 +19,7 @@ defmodule MusicLibraryWeb.CoreComponents do alias Phoenix.LiveView.JS use Gettext, backend: MusicLibraryWeb.Gettext + defdelegate badge(assigns), to: Fluxon.Components.Badge defdelegate button(assigns), to: Fluxon.Components.Button defdelegate date_time_picker(assigns), to: Fluxon.Components.DatePicker defdelegate input(assigns), to: Fluxon.Components.Input @@ -272,77 +273,6 @@ defmodule MusicLibraryWeb.CoreComponents do """ end - @doc """ - Renders a round badge. - """ - attr :text, :string, required: true - attr :class, :string, default: nil - - def round_badge(assigns) do - ~H""" - - {assigns.text} - - """ - end - - attr :color, :atom, values: [:green, :yellow, :gray], required: true - attr :text, :string, required: true - - def badge(assigns) do - case assigns.color do - :green -> - ~H""" - - {@text} - - """ - - :yellow -> - ~H""" - - {@text} - - """ - - :gray -> - ~H""" - - {@text} - - """ - end - end - ## JS Commands def show(js \\ %JS{}, selector) do diff --git a/lib/music_library_web/live/artist_live/show.html.heex b/lib/music_library_web/live/artist_live/show.html.heex index b6c0b3ca..80525cc1 100644 --- a/lib/music_library_web/live/artist_live/show.html.heex +++ b/lib/music_library_web/live/artist_live/show.html.heex @@ -24,10 +24,11 @@ - <.round_badge text={gettext("On Tour")} class="mr-2" /> + <.badge variant="pill" class="mr-2">{gettext("On Tour")} 0} diff --git a/lib/music_library_web/live/stats_live/index.html.heex b/lib/music_library_web/live/stats_live/index.html.heex index 51e44ee9..9036ebad 100644 --- a/lib/music_library_web/live/stats_live/index.html.heex +++ b/lib/music_library_web/live/stats_live/index.html.heex @@ -201,18 +201,18 @@