Add button to refresh Scrobble activity

This commit is contained in:
Claudio Ortolina
2024-11-17 21:55:43 +00:00
parent 1936075bc0
commit e0ac8d1923
3 changed files with 36 additions and 7 deletions
@@ -77,6 +77,11 @@ defmodule MusicLibraryWeb.StatsLive.Index do
end
end
def handle_event("refresh_lastfm_feed", _, socket) do
LastFm.Refresh.refresh()
{:noreply, socket}
end
def handle_info(%{tracks: recent_tracks}, socket) do
release_ids =
recent_tracks
@@ -62,9 +62,28 @@
</div>
<div class="flow-root">
<h1 class="mt-5 text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
<%= gettext("Scrobble activity") %>
</h1>
<div class="mt-5 flex justify-between items-center">
<h1 class="text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
<%= gettext("Scrobble activity") %>
</h1>
<button
type="button"
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
phx-click={
JS.transition("animate-spin", to: "#refresh-lastfm-feed", time: 1000)
|> JS.push("refresh_lastfm_feed")
}
>
<span class="sr-only"><%= gettext("Refresh LastFm Feed") %></span>
<.icon
id="refresh-lastfm-feed"
name="hero-arrow-path"
class="-mt-1 h-5 w-5"
aria-hidden="true"
data-slot="icon"
/>
</button>
</div>
<ul
id="scrobble-activity"
role="list"
+9 -4
View File
@@ -178,7 +178,7 @@ msgid "No results"
msgstr ""
#: lib/music_library_web/live/record_live/index.html.heex:121
#: lib/music_library_web/live/stats_live/index.html.heex:145
#: lib/music_library_web/live/stats_live/index.html.heex:164
#: lib/music_library_web/live/wishlist_live/index.html.heex:121
#, elixir-autogen, elixir-format
msgid "Open options"
@@ -363,7 +363,7 @@ msgstr ""
msgid "MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex:66
#: lib/music_library_web/live/stats_live/index.html.heex:67
#, elixir-autogen, elixir-format
msgid "Scrobble activity"
msgstr ""
@@ -373,12 +373,12 @@ msgstr ""
msgid "Choose which format to import"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex:114
#: lib/music_library_web/live/stats_live/index.html.heex:133
#, elixir-autogen, elixir-format
msgid "Collected"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex:127
#: lib/music_library_web/live/stats_live/index.html.heex:146
#, elixir-autogen, elixir-format
msgid "Wishlisted"
msgstr ""
@@ -414,3 +414,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Refresh MB Data"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex:77
#, elixir-autogen, elixir-format
msgid "Refresh LastFm Feed"
msgstr ""