{gettext("Records")}

<%!-- TODO: replace with OSS version --%>
<.album_preview record={@latest_record} title={gettext("Latest purchase")} class="col-span-3 sm:col-span-2" /> <.counter title={gettext("Collection")} count={@collection_count} path={~p"/collection"} /> <.counter title={gettext("Wishlist")} count={@wishlist_count} path={~p"/wishlist"} /> <.counter title={gettext("Scrobbles")} count={to_compact(@scrobble_count)} tooltip={@scrobble_count} />

{gettext("Formats")}

<.counters_by_category categories_with_counts={@collection_count_by_format} category_format_fn={&format_label/1} category_path_fn={fn format -> ~p"/collection?query=format:#{format}" end} />

{gettext("Types")}

<.counters_by_category categories_with_counts={@collection_count_by_type} category_format_fn={&type_label/1} category_path_fn={fn type -> ~p"/collection?query=type:#{type}" end} />

{gettext("Scrobble activity")}

<.refresh_lastfm_feed_button />
<.tabs id="scrobble-activity" class="mt-4"> <.tabs_list active_tab={@scrobble_activity_mode} variant="segmented" class="w-48"> <:tab name="albums" phx-click={JS.push("set_scrobble_activity_mode", value: %{mode: "albums"})} > {gettext("Albums")} <:tab name="tracks" phx-click={JS.push("set_scrobble_activity_mode", value: %{mode: "tracks"})} > {gettext("Tracks")} <.tabs_panel name="albums" active={@scrobble_activity_mode == "albums"}> <.tabs_panel name="tracks" active={@scrobble_activity_mode == "tracks"}>

{gettext("On This day")}

<.form :let={f} for={to_form(%{"current_date" => @current_date})} phx-change="set_current_date" > <.date_picker size="xs" field={f[:current_date]}> <:outer_suffix> <.button size="xs" type="button" phx-click={ JS.push("set_current_date", value: %{"current_date" => Date.utc_today()}) } > Today
<.records_on_this_day current_date={@current_date} records={@streams.records_on_this_day} record_show_path={fn record -> ~p"/collection/#{record}" end} />

{gettext("Top %{n} Artists", %{n: length(@records_by_artist)})}

<.vertical_bar_chart data={@records_by_artist} width={600} height={26 * length(@records_by_artist)} color_class="fill-red-500" label_fn={fn datum -> datum.name end} value_fn={fn datum -> datum.count end} datum_click={ fn datum -> JS.navigate(~p"/artists/#{datum.id}") end } class="w-full" />

{gettext("Top %{n} Genres", %{n: length(@records_by_genre)})}

<.vertical_bar_chart data={@records_by_genre} width={600} height={26 * length(@records_by_genre)} color_class="fill-zinc-500" label_fn={fn {genre, _count} -> genre end} value_fn={fn {_genre, count} -> count end} datum_click={ fn {genre, _count} -> JS.navigate(~p"/collection?#{%{query: ~s(genre:"#{genre}")}}") end } class="w-full" />