Simplify non-linked state using Last.fm connect button

This commit is contained in:
Claudio Ortolina
2025-09-24 10:23:03 +03:00
parent 6a0c4289f6
commit d9abad53d5
4 changed files with 11 additions and 16 deletions
@@ -13,7 +13,7 @@ defmodule MusicLibraryWeb.ScrobbleLive.Index do
selected_release_group: nil, selected_release_group: nil,
releases: [], releases: [],
loading: false, loading: false,
can_scrobble: ScrobbleActivity.can_scrobble?() can_scrobble?: ScrobbleActivity.can_scrobble?()
)} )}
end end
@@ -3,22 +3,15 @@
<h1 class="mt-5 text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold"> <h1 class="mt-5 text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
{gettext("Scrobble to Last.fm")} {gettext("Scrobble to Last.fm")}
</h1> </h1>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-2">
Search for MusicBrainz releases and scrobble them to Last.fm
</p>
<%= if not @can_scrobble do %> <div
<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mt-4"> :if={!@can_scrobble?}
<div class="flex"> class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mt-4"
<.icon name="hero-exclamation-triangle" class="h-5 w-5 text-yellow-400" /> >
<div class="ml-3"> <.button :if={!@can_scrobble?} size="sm" href={LastFm.auth_url()}>
<p class="text-sm text-yellow-800 dark:text-yellow-200"> {gettext("Connect your Last.fm account")}
You need to connect your Last.fm account to scrobble. Please set up your Last.fm session key in the settings. </.button>
</p> </div>
</div>
</div>
</div>
<% end %>
<div class="mt-6 space-y-6"> <div class="mt-6 space-y-6">
<.form for={%{}} as={:search} phx-submit="search" class="space-y-4"> <.form for={%{}} as={:search} phx-submit="search" class="space-y-4">
+1
View File
@@ -748,6 +748,7 @@ msgid "Release scrobbled successfully"
msgstr "" msgstr ""
#: lib/music_library_web/components/release.ex #: lib/music_library_web/components/release.ex
#: lib/music_library_web/live/scrobble_live/index.html.heex
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Connect your Last.fm account" msgid "Connect your Last.fm account"
msgstr "" msgstr ""
+1
View File
@@ -748,6 +748,7 @@ msgid "Release scrobbled successfully"
msgstr "" msgstr ""
#: lib/music_library_web/components/release.ex #: lib/music_library_web/components/release.ex
#: lib/music_library_web/live/scrobble_live/index.html.heex
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Connect your Last.fm account" msgid "Connect your Last.fm account"
msgstr "" msgstr ""