From f42f050de0c13eed407dc320ec2257402d9f8ac2 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 16 Sep 2025 21:01:44 +0300 Subject: [PATCH] Simplify scrobbled tracks layout Remove no results view --- .../scrobbled_tracks_live/index.html.heex | 135 +++++++++--------- priv/gettext/default.pot | 24 +--- priv/gettext/en/LC_MESSAGES/default.po | 24 +--- .../live/scrobbled_tracks_live_test.exs | 11 -- 4 files changed, 74 insertions(+), 120 deletions(-) diff --git a/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex b/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex index d588577d..d9b9777d 100644 --- a/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex +++ b/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex @@ -59,94 +59,91 @@ -
- <.icon name="hero-musical-note" class="h-12 w-12 text-zinc-400 mx-auto mb-4" /> -

- {gettext("No scrobbled tracks found")} -

-

- {gettext("Try adjusting your search or clearing the filter")} -

-
- -
-
-
+
    +
+ -
-
-
-
- {"Cover track.album.title} - onerror={"this.src = '" <> ~p"/images/cover-not-found.png" <> "';"} - /> -
-
-
- <.icon name="hero-musical-note" class="h-6 w-6 text-zinc-400" /> -
-
- -
-

- {track.title} -

-

- {track.artist.name} -

-

- {track.album.title} -

-

- {track.scrobbled_at_label} -

+
+
+ {"Cover track.album.title} + onerror={"this.src = '" <> ~p"/images/cover-not-found.png" <> "';"} + /> +
+
+
+ <.icon name="hero-musical-note" class="h-6 w-6 text-zinc-400" />
-
- <.button - patch={~p"/scrobbled-tracks/#{track.scrobbled_at_uts}/edit"} - size="sm" - variant="outline" - > - <.icon name="hero-pencil" class="h-4 w-4" /> - {gettext("Edit track")} - - <.button +
+

+ {track.title} +

+

+ {track.artist.name} +

+

+ {track.album.title} +

+

+ {track.scrobbled_at_label} +

+
+
+ +
+ <.dropdown id={"actions-#{track.scrobbled_at_uts}"} placement="bottom-end"> + <:toggle> +
+ {gettext("Actions")} + <.icon + name="hero-ellipsis-vertical" + class="-mt-1 h-5 w-5 text-zinc-500 dark:text-zinc-400 cursor-pointer" + aria-hidden="true" + data-slot="icon" + /> +
+ + <.dropdown_link patch={~p"/scrobbled-tracks/#{track.scrobbled_at_uts}/edit"}> + {gettext("Edit")} + + <.dropdown_button phx-click={ JS.push("delete", value: %{"scrobbled-at-uts": track.scrobbled_at_uts}) |> JS.hide(to: "##{id}") } - data-confirm={gettext("Are you sure you want to delete this scrobbled track?")} - size="sm" - variant="outline" - class="text-red-600 hover:text-red-800 border-red-200 hover:border-red-300" + data-confirm={gettext("Are you sure?")} + class={[ + "text-red-900! hover:bg-red-50! dark:text-red-500! dark:hover:bg-red-900/30! dark:hover:text-red-600!" + ]} > - <.icon name="hero-trash" class="h-4 w-4" /> - {gettext("Delete track")} - -
+ {gettext("Delete")} + +
-
-
+ + <.pagination id={:bottom_pagination} pagination_params={@track_list_params} />
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 00cc9905..1a808330 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -15,6 +15,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Are you sure?" @@ -38,6 +39,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Delete" @@ -51,6 +53,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.ex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -912,6 +915,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Actions" @@ -1332,11 +1336,6 @@ msgstr[1] "" msgid "Album name" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Are you sure you want to delete this scrobbled track?" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format msgid "Artist name" @@ -1347,11 +1346,6 @@ msgstr "" msgid "Cover Image URL (optional)" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Delete track" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format msgid "Edit Scrobbled Track" @@ -1362,11 +1356,6 @@ msgstr "" msgid "Edit Track" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Edit track" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #, elixir-autogen, elixir-format msgid "No scrobbled tracks found" @@ -1398,11 +1387,6 @@ msgstr "" msgid "Track updated successfully" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Try adjusting your search or clearing the filter" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format msgid "Update Track" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 7e75e4e3..03f37250 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -15,6 +15,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Are you sure?" @@ -38,6 +39,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Delete" @@ -51,6 +53,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.ex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format @@ -912,6 +915,7 @@ msgstr "" #: lib/music_library_web/live/collection_live/show.html.heex #: lib/music_library_web/live/online_store_template_live/index.html.heex #: lib/music_library_web/live/scrobble_rules_live/index.html.heex +#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #: lib/music_library_web/live/wishlist_live/show.html.heex #, elixir-autogen, elixir-format msgid "Actions" @@ -1332,11 +1336,6 @@ msgstr[1] "" msgid "Album name" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Are you sure you want to delete this scrobbled track?" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format, fuzzy msgid "Artist name" @@ -1347,11 +1346,6 @@ msgstr "" msgid "Cover Image URL (optional)" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format, fuzzy -msgid "Delete track" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format, fuzzy msgid "Edit Scrobbled Track" @@ -1362,11 +1356,6 @@ msgstr "" msgid "Edit Track" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Edit track" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex #, elixir-autogen, elixir-format, fuzzy msgid "No scrobbled tracks found" @@ -1398,11 +1387,6 @@ msgstr "" msgid "Track updated successfully" msgstr "" -#: lib/music_library_web/live/scrobbled_tracks_live/index.html.heex -#, elixir-autogen, elixir-format -msgid "Try adjusting your search or clearing the filter" -msgstr "" - #: lib/music_library_web/live/scrobbled_tracks_live/form_component.ex #, elixir-autogen, elixir-format, fuzzy msgid "Update Track" diff --git a/test/music_library_web/live/scrobbled_tracks_live_test.exs b/test/music_library_web/live/scrobbled_tracks_live_test.exs index b0aec881..bbb1077b 100644 --- a/test/music_library_web/live/scrobbled_tracks_live_test.exs +++ b/test/music_library_web/live/scrobbled_tracks_live_test.exs @@ -96,17 +96,6 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do assert html =~ "Unique Album Title" end - - test "shows no results message for non-matching search", %{conn: conn} do - {:ok, index_live, _html} = live(conn, ~p"/scrobbled-tracks") - - html = - index_live - |> form("form[phx-submit='search']", %{query: "NonexistentTrack"}) - |> render_submit() - - assert html =~ "Try adjusting your search" - end end describe "Edit track" do