diff --git a/lib/music_library_web/live/scrobble_live/index.ex b/lib/music_library_web/live/scrobble_live/index.ex index f0d4313f..9986d3de 100644 --- a/lib/music_library_web/live/scrobble_live/index.ex +++ b/lib/music_library_web/live/scrobble_live/index.ex @@ -1,7 +1,7 @@ defmodule MusicLibraryWeb.ScrobbleLive.Index do use MusicLibraryWeb, :live_view - import MusicLibraryWeb.RecordComponents, only: [type_label: 1] + import MusicLibraryWeb.RecordComponents, only: [type_label: 1, country_label: 1] alias MusicBrainz.{Release, ReleaseGroupSearchResult} alias MusicLibrary.Records diff --git a/lib/music_library_web/live/scrobble_live/index.html.heex b/lib/music_library_web/live/scrobble_live/index.html.heex index f3233736..ca5ddc67 100644 --- a/lib/music_library_web/live/scrobble_live/index.html.heex +++ b/lib/music_library_web/live/scrobble_live/index.html.heex @@ -29,16 +29,16 @@ onerror={"this.src = '" <> ~p"/images/cover-not-found.png" <> "';"} />
-

+

{release_group.artists} -

-

+

+

{release_group.title} -

-

- {Records.Record.format_release_date(release_group.release_date)} ยท {type_label( - release_group.type - )} +

+

+ {Records.Record.format_release_date(release_group.release_date)} + · + <.badge variant="soft" size="xs">{type_label(release_group.type)}

@@ -55,69 +55,57 @@ size="sm" phx-click="clear_selection" > - <.icon name="hero-arrow-left" class="h-4 w-4" /> + <.icon name="hero-arrow-left" class="icon" aria-hidden="true" data-slot="icon" /> + {gettext("Back")}

{gettext("Releases for \"%{title}\"", title: @selected_release_group.title)}

-
- <%= for release <- @releases do %> -
- <.link - navigate={~p"/scrobble/#{release.id}"} - class="block p-4" - > -
-
- {release.title} ~p"/images/cover-not-found.png" <> "';"} - /> -
-
-

- {release.title} -

-
- <%= if release.date do %> -

Released: {release.date}

- <% end %> - <%= if release.country do %> -

Country: {release.country}

- <% end %> - <%= if release.barcode do %> -

Barcode: {release.barcode}

- <% end %> - <%= if release.catalog_number do %> -

Catalog: {release.catalog_number}

- <% end %> - <%= if release.media != [] do %> -

- {ngettext("1 disc", "%{count} discs", Release.media_count(release))} -

- <% end %> -
-
+
    +
  • + <.link + navigate={~p"/scrobble/#{release.id}"} + class="flex items-center gap-x-4 py-5 px-4 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors" + > + {release.title} ~p"/images/cover-not-found.png" <> "';"} + /> +
    +

    + {release.title} +

    +
    + {release.date} + + {country_label(release.country)} + + <.badge :if={release.catalog_number} variant="soft" size="xs"> + {release.catalog_number} + + + {ngettext("1 disc", "%{count} discs", Release.media_count(release))} +
    - -
    - <% end %> -
+
+ + +
<% end %> <%= if @loading && @search_query != "" do %>
- <.icon name="hero-arrow-path" class="h-8 w-8 animate-spin mx-auto text-gray-400" /> -

+ <.loading class="size-8 mx-auto text-zinc-400" /> +

<%= if @selected_release_group do %> - Loading releases... + {gettext("Loading releases...")} <% else %> - Searching... + {gettext("Searching...")} <% end %>

@@ -127,13 +115,13 @@
<.icon name="hero-magnifying-glass" - class="h-12 w-12 mx-auto text-gray-300 dark:text-gray-600" + class="h-12 w-12 mx-auto text-zinc-300 dark:text-zinc-600" /> -

- No release groups found for "{@search_query}" +

+ {gettext("No release groups found for \"%{query}\"", query: @search_query)}

-

- Try a different search term or check the spelling +

+ {gettext("Try a different search term or check the spelling")}

<% end %> diff --git a/lib/music_library_web/live/scrobble_live/show.ex b/lib/music_library_web/live/scrobble_live/show.ex index 06a0a363..ed3a3b1e 100644 --- a/lib/music_library_web/live/scrobble_live/show.ex +++ b/lib/music_library_web/live/scrobble_live/show.ex @@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.ScrobbleLive.Show do use MusicLibraryWeb, :live_view import(MusicLibraryWeb.Components.Release, only: [medium: 1, scrobble_button_label: 1]) + import MusicLibraryWeb.RecordComponents, only: [country_label: 1] alias MusicLibrary.ScrobbleActivity diff --git a/lib/music_library_web/live/scrobble_live/show.html.heex b/lib/music_library_web/live/scrobble_live/show.html.heex index 76c68e8d..e32d3eb3 100644 --- a/lib/music_library_web/live/scrobble_live/show.html.heex +++ b/lib/music_library_web/live/scrobble_live/show.html.heex @@ -1,108 +1,93 @@
-
-
-
-
+ <.alert + :if={not @can_scrobble} + color="warning" + title={gettext("Last.fm not connected")} + hide_close + > + {gettext( + "You need to connect your Last.fm account to scrobble. Please set up your Last.fm session key in the settings." + )} + -
-
- <.icon name="hero-exclamation-triangle" class="h-5 w-5 text-yellow-400" /> -
-

- {gettext( - "You need to connect your Last.fm account to scrobble. Please set up your Last.fm session key in the settings." - )} -

-
-
-
+
+ <.button variant="ghost" size="sm" navigate={~p"/scrobble"}> + <.icon name="hero-arrow-left" class="icon" aria-hidden="true" data-slot="icon" /> + {gettext("Back to search")} + +
-
-
-

- {@release.title} -

-

- - by {@release.artists |> Enum.map(& &1.name) |> Enum.join(", ")} - - - {@release.date} - -

-
-
- {"Cover -
-
-
-
- - {gettext("Release Date:")} - -
{@release.date} -
-
- - {gettext("Country:")} - -
{@release.country} -
-
- - {gettext("Barcode:")} - -
{@release.barcode} -
-
- - {gettext("Catalog Number:")} - -
{@release.catalog_number} -
-
-
-
-
-
- -
-
-

{gettext("Tracks")}

- - <.button - :if={@can_scrobble} - phx-click={ - if MapSet.size(@selected_tracks) > 0, - do: "scrobble_selected_tracks", - else: "scrobble_release" - } - size="sm" - > - {scrobble_button_label(@selected_tracks)} - -
- - <.medium - :for={medium <- @release.media} - can_scrobble?={@can_scrobble} - already_scrobbled={false} - medium={medium} - release_artists={@release.artists} - selected_tracks={@selected_tracks} - media_count={MusicBrainz.Release.media_count(@release)} - myself={nil} +
+
+ {"Cover ~p"/images/cover-not-found.png" <> "';"} />
+ +
+
+

+ {@release.artists |> Enum.map(& &1.name) |> Enum.join(", ")} +

+
+

+ {@release.title} +

+ +
+
+ <.dl_row :if={@release.date} label={gettext("Release Date")}> + {@release.date} + + <.dl_row :if={@release.country} label={gettext("Country")}> + {country_label(@release.country)} {@release.country} + + <.dl_row :if={@release.barcode} label={gettext("Barcode")}> + {@release.barcode} + + <.dl_row :if={@release.catalog_number} label={gettext("Catalog Number")}> + {@release.catalog_number} + + <.dl_row :if={@release.media != []} label={gettext("Media")}> + {ngettext("1 disc", "%{count} discs", MusicBrainz.Release.media_count(@release))} + +
+
+ +
+
+

{gettext("Tracks")}

+ + <.button + :if={@can_scrobble} + phx-click={ + if MapSet.size(@selected_tracks) > 0, + do: "scrobble_selected_tracks", + else: "scrobble_release" + } + size="sm" + > + {scrobble_button_label(@selected_tracks)} + +
+ + <.medium + :for={medium <- @release.media} + can_scrobble?={@can_scrobble} + already_scrobbled={false} + medium={medium} + release_artists={@release.artists} + selected_tracks={@selected_tracks} + media_count={MusicBrainz.Release.media_count(@release)} + myself={nil} + /> +
+
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 0e07d583..1ab7af81 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -682,6 +682,7 @@ msgid "Oban" msgstr "" #: lib/music_library_web/components/record_form.ex +#: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "Release Date" msgstr "" @@ -1423,6 +1424,7 @@ msgid "Release Groups" msgstr "" #: lib/music_library_web/live/scrobble_live/index.html.heex +#: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "1 disc" msgid_plural "%{count} discs" @@ -1434,26 +1436,6 @@ msgstr[1] "" msgid "Releases for \"%{title}\"" msgstr "" -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Barcode:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Catalog Number:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Country:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Release Date:" -msgstr "" - #: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "You need to connect your Last.fm account to scrobble. Please set up your Last.fm session key in the settings." @@ -1909,3 +1891,58 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Search for artist image online" msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Back" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Back to search" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Barcode" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Catalog Number" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Country" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Last.fm not connected" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Loading releases..." +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Media" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "No release groups found for \"%{query}\"" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Searching..." +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Try a different search term or check the spelling" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index ae1a5405..bbcaa896 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -682,6 +682,7 @@ msgid "Oban" msgstr "" #: lib/music_library_web/components/record_form.ex +#: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "Release Date" msgstr "" @@ -1423,6 +1424,7 @@ msgid "Release Groups" msgstr "" #: lib/music_library_web/live/scrobble_live/index.html.heex +#: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "1 disc" msgid_plural "%{count} discs" @@ -1434,26 +1436,6 @@ msgstr[1] "" msgid "Releases for \"%{title}\"" msgstr "" -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Barcode:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Catalog Number:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format -msgid "Country:" -msgstr "" - -#: lib/music_library_web/live/scrobble_live/show.html.heex -#, elixir-autogen, elixir-format, fuzzy -msgid "Release Date:" -msgstr "" - #: lib/music_library_web/live/scrobble_live/show.html.heex #, elixir-autogen, elixir-format msgid "You need to connect your Last.fm account to scrobble. Please set up your Last.fm session key in the settings." @@ -1909,3 +1891,58 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Search for artist image online" msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Back" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Back to search" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Barcode" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Catalog Number" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Country" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Last.fm not connected" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Loading releases..." +msgstr "" + +#: lib/music_library_web/live/scrobble_live/show.html.heex +#, elixir-autogen, elixir-format +msgid "Media" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "No release groups found for \"%{query}\"" +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format, fuzzy +msgid "Searching..." +msgstr "" + +#: lib/music_library_web/live/scrobble_live/index.html.heex +#, elixir-autogen, elixir-format +msgid "Try a different search term or check the spelling" +msgstr ""