Rename Import -> Add, and avoid surfacing MusicBrainz where unneeded

This commit is contained in:
Claudio Ortolina
2025-03-07 15:10:22 +00:00
parent 27ea8a5b62
commit 91a1141441
9 changed files with 50 additions and 54 deletions
+4 -4
View File
@@ -8,7 +8,7 @@
- [Collection](#collection) - [Collection](#collection)
- [Edit a record in the collection](#edit-a-record-in-the-collection) - [Edit a record in the collection](#edit-a-record-in-the-collection)
- [View a record's details in the collection](#view-a-records-details-in-the-collection) - [View a record's details in the collection](#view-a-records-details-in-the-collection)
- [Importing a record in the wishlist](#importing-a-record-in-the-wishlist) - [Adding a record in the wishlist](#importing-a-record-in-the-wishlist)
- [Setup](#setup) - [Setup](#setup)
- [Environment configuration](#environment-configuration) - [Environment configuration](#environment-configuration)
- [Running the application](#running-the-application) - [Running the application](#running-the-application)
@@ -19,7 +19,7 @@
## Features ## Features
- Import records from MusicBrainz, with optional override of specific pieces of data - Add records from MusicBrainz, with optional override of specific pieces of data
- Manage a collection and a wishlist of records, with ways to quickly search - Manage a collection and a wishlist of records, with ways to quickly search
and filter based on records' metadata and filter based on records' metadata
- Integration with Last.fm (display latest scrobbles, and where possible - Integration with Last.fm (display latest scrobbles, and where possible
@@ -46,9 +46,9 @@
![View a record's details in the collection](.github/screenshots/collection-record-details.png) ![View a record's details in the collection](.github/screenshots/collection-record-details.png)
### Importing a record in the wishlist ### Adding a record in the wishlist
![Importing a record in the wishlist](.github/screenshots/wishlist-import-record.png) ![Adding a record in the wishlist](.github/screenshots/wishlist-import-record.png)
## Setup ## Setup
@@ -50,10 +50,10 @@ defmodule MusicLibraryWeb.BarcodeScannerComponent do
<div class="mt-4 flex justify-center"> <div class="mt-4 flex justify-center">
<.button <.button
disabled={length(@scan_results) == 0} disabled={length(@scan_results) == 0}
phx-disable-with={gettext("Importing...")} phx-disable-with={gettext("Adding...")}
phx-click={JS.push("import_releases", target: "#barcode-scanner")} phx-click={JS.push("import_releases", target: "#barcode-scanner")}
> >
{gettext("Import releases")} {gettext("Add releases")}
</.button> </.button>
</div> </div>
</div> </div>
@@ -24,8 +24,8 @@ defmodule MusicLibraryWeb.ImportComponent do
name={:mb_query} name={:mb_query}
field={@form[:mb_query]} field={@form[:mb_query]}
type="text" type="text"
label={gettext("Search for a record on MusicBrainz")} label={gettext("Search for a record")}
prompt={gettext("Search for records")} prompt={gettext("Search for a record")}
phx-debounce="500" phx-debounce="500"
autocorrect="off" autocorrect="off"
autocapitalize="none" autocapitalize="none"
@@ -41,7 +41,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
end end
socket socket
|> assign(:page_title, gettext("Import from MusicBrainz · Collection")) |> assign(:page_title, gettext("Add new Record · Collection"))
|> assign(:record, nil) |> assign(:record, nil)
end end
@@ -15,7 +15,7 @@
patch={~p"/collection/import"} patch={~p"/collection/import"}
> >
<.icon name="hero-plus" class="h-4 w-4 mr-2" aria-hidden="true" data-slot="icon" /> <.icon name="hero-plus" class="h-4 w-4 mr-2" aria-hidden="true" data-slot="icon" />
{gettext("Import")} {gettext("Add")}
</.link> </.link>
<.link <.link
class={[ class={[
@@ -46,7 +46,7 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
end end
socket socket
|> assign(:page_title, gettext("Import from MusicBrainz · Wishlist")) |> assign(:page_title, gettext("Add new Record · Wishlist"))
|> assign(:record, nil) |> assign(:record, nil)
end end
@@ -14,7 +14,7 @@
patch={~p"/wishlist/import"} patch={~p"/wishlist/import"}
> >
<.icon name="hero-plus" class="h-4 w-4 mr-2" aria-hidden="true" data-slot="icon" /> <.icon name="hero-plus" class="h-4 w-4 mr-2" aria-hidden="true" data-slot="icon" />
{gettext("Import")} {gettext("Add")}
</.link> </.link>
</div> </div>
</header> </header>
@@ -65,7 +65,7 @@
record={@record} record={@record}
patch={back_path(@record_list_params)} patch={back_path(@record_list_params)}
initial_query="" initial_query=""
icon_name="hero-star" icon_name="hero-plus"
/> />
</.modal> </.modal>
+32 -36
View File
@@ -95,12 +95,6 @@ msgstr ""
msgid "Hang in there while we get back on track" msgid "Hang in there while we get back on track"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex:18
#: lib/music_library_web/live/wishlist_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "Import"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex:231 #: lib/music_library_web/live/collection_live/show.html.heex:231
#: lib/music_library_web/live/wishlist_live/show.html.heex:243 #: lib/music_library_web/live/wishlist_live/show.html.heex:243
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@@ -213,16 +207,6 @@ msgstr ""
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: lib/music_library_web/components/import_component.ex:27
#, elixir-autogen, elixir-format
msgid "Search for a record on MusicBrainz"
msgstr ""
#: lib/music_library_web/components/import_component.ex:28
#, elixir-autogen, elixir-format
msgid "Search for records"
msgstr ""
#: lib/music_library_web/components/record_components.ex:140 #: lib/music_library_web/components/record_components.ex:140
#: lib/music_library_web/live/collection_live/show.ex:140 #: lib/music_library_web/live/collection_live/show.ex:140
#: lib/music_library_web/live/wishlist_live/show.ex:143 #: lib/music_library_web/live/wishlist_live/show.ex:143
@@ -400,16 +384,6 @@ msgstr ""
msgid "Details" msgid "Details"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "Import from MusicBrainz · Collection"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex:49
#, elixir-autogen, elixir-format
msgid "Import from MusicBrainz · Wishlist"
msgstr ""
#: lib/music_library_web/components/layouts/root.html.heex:59 #: lib/music_library_web/components/layouts/root.html.heex:59
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Made by" msgid "Made by"
@@ -626,21 +600,11 @@ msgstr ""
msgid "Open camera" msgid "Open camera"
msgstr "" msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:56
#, elixir-autogen, elixir-format
msgid "Import releases"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:187 #: lib/music_library_web/components/barcode_scanner_component.ex:187
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Failed to search release for barcode %{number}" msgid "Failed to search release for barcode %{number}"
msgstr "" msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:53
#, elixir-autogen, elixir-format
msgid "Importing..."
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:200 #: lib/music_library_web/components/barcode_scanner_component.ex:200
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Records imported successfully" msgid "Records imported successfully"
@@ -695,3 +659,35 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Some records could not be imported: %{summary}" msgid "Some records could not be imported: %{summary}"
msgstr "" msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex:18
#: lib/music_library_web/live/wishlist_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "Add"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "Add new Record · Collection"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex:49
#, elixir-autogen, elixir-format
msgid "Add new Record · Wishlist"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:56
#, elixir-autogen, elixir-format
msgid "Add releases"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex:53
#, elixir-autogen, elixir-format
msgid "Adding..."
msgstr ""
#: lib/music_library_web/components/import_component.ex:27
#: lib/music_library_web/components/import_component.ex:28
#, elixir-autogen, elixir-format
msgid "Search for a record"
msgstr ""
@@ -229,12 +229,12 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
end end
end end
describe "Importing a new record" do describe "Adding a new record" do
test "it shows the import modal", %{conn: conn} do test "it shows the import modal", %{conn: conn} do
conn conn
|> visit(~p"/collection") |> visit(~p"/collection")
|> click_link("Import") |> click_link("Add")
|> assert_has("label", text: "Search for a record on MusicBrainz") |> assert_has("label", text: "Search for a record")
|> assert_has("div", text: "No results") |> assert_has("div", text: "No results")
|> assert_path(~p"/collection/import") |> assert_path(~p"/collection/import")
end end
@@ -269,7 +269,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
session = session =
conn conn
|> visit(~p"/collection/import") |> visit(~p"/collection/import")
|> fill_in("Search for a record on MusicBrainz", with: "Marillion Marbles") |> fill_in("Search for a record", with: "Marillion Marbles")
for release_group_search_result <- release_group_search_results do for release_group_search_result <- release_group_search_results do
result = ReleaseGroupSearchResult.from_api_response(release_group_search_result) result = ReleaseGroupSearchResult.from_api_response(release_group_search_result)
@@ -386,7 +386,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> trigger_hook("#barcode-scanner", "barcode_scanned", %{"number" => barcode}) |> trigger_hook("#barcode-scanner", "barcode_scanned", %{"number" => barcode})
|> assert_has("h2", text: "Marbles") |> assert_has("h2", text: "Marbles")
|> assert_has("span", text: "New") |> assert_has("span", text: "New")
|> click_button("Import releases") |> click_button("Add releases")
[record] = MusicLibrary.Repo.all(MusicLibrary.Records.Record) [record] = MusicLibrary.Repo.all(MusicLibrary.Records.Record)