Display badge when an artist is touring
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
defmodule LastFm.Artist do
|
||||
@enforce_keys [:musicbrainz_id, :name]
|
||||
defstruct [:musicbrainz_id, :name, :bio, :image, :play_count]
|
||||
defstruct [:musicbrainz_id, :name, :bio, :image, :play_count, :on_tour]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
musicbrainz_id: String.t(),
|
||||
name: String.t(),
|
||||
bio: String.t(),
|
||||
image: String.t(),
|
||||
play_count: non_neg_integer()
|
||||
play_count: non_neg_integer(),
|
||||
on_tour: boolean()
|
||||
}
|
||||
|
||||
def from_api_response(api_response) do
|
||||
@@ -16,7 +17,8 @@ defmodule LastFm.Artist do
|
||||
name: api_response["name"],
|
||||
bio: api_response["bio"]["content"] || "",
|
||||
image: get_image(api_response),
|
||||
play_count: get_play_count(api_response)
|
||||
play_count: get_play_count(api_response),
|
||||
on_tour: api_response["ontour"] == "1"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<span class="sr-only">
|
||||
{gettext("Number of scrobbles")}
|
||||
</span>
|
||||
<.round_badge :if={artist_info.on_tour} text={gettext("On Tour")} />
|
||||
<.round_badge text={artist_info.play_count} />
|
||||
</span>
|
||||
</.async_result>
|
||||
|
||||
Reference in New Issue
Block a user