From 330ef1d9e89f88bf78bdd742efc2c7316617d467 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Fri, 29 Aug 2025 18:13:46 +0300 Subject: [PATCH] Extract components to render counter stats --- .../components/stats_components.ex | 46 ++++++++++++++++++ .../live/stats_live/index.ex | 18 ------- .../live/stats_live/index.html.heex | 48 ++++--------------- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/music_library_web/components/stats_components.ex b/lib/music_library_web/components/stats_components.ex index cfeab600..ce097e49 100644 --- a/lib/music_library_web/components/stats_components.ex +++ b/lib/music_library_web/components/stats_components.ex @@ -70,6 +70,34 @@ defmodule MusicLibraryWeb.StatsComponents do """ end + attr :categories_with_counts, :list, required: true + attr :category_format_fn, :any, required: true + attr :category_path_fn, :any, required: true + + def counters_by_category(assigns) do + ~H""" + <%!-- TODO: replace with OSS version --%> +
+
+
+ {@category_format_fn.(category)} +
+
+ <.link + class="text-xl lg:text-2xl font-semibold hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200" + navigate={@category_path_fn.(category)} + > + {count} + +
+
+
+ """ + end + def refresh_lastfm_feed_button(assigns) do ~H"""