diff --git a/lib/music_library_web/live/stats_live/index.ex b/lib/music_library_web/live/stats_live/index.ex index 0cbe483c..a1f86a33 100644 --- a/lib/music_library_web/live/stats_live/index.ex +++ b/lib/music_library_web/live/stats_live/index.ex @@ -34,4 +34,22 @@ defmodule MusicLibraryWeb.StatsLive.Index do nav_section: :stats )} end + + # The Tailwind build step requires all needed classes to be explicitly referenced + # in the source code, and not dynamically generated. This implies that one cannot + # (for example) interpolate a number in a class name. + defp stats_class(collection) do + case Enum.count(collection) do + 1 -> "grid-cols-1" + 2 -> "grid-cols-2" + 3 -> "grid-cols-3" + 4 -> "grid-cols-4" + 5 -> "grid-cols-5" + 6 -> "grid-cols-6" + 7 -> "grid-cols-7" + 8 -> "grid-cols-8" + 9 -> "grid-cols-9" + _other -> "" + end + end end diff --git a/lib/music_library_web/live/stats_live/index.html.heex b/lib/music_library_web/live/stats_live/index.html.heex index 7e3fb870..57743413 100644 --- a/lib/music_library_web/live/stats_live/index.html.heex +++ b/lib/music_library_web/live/stats_live/index.html.heex @@ -17,7 +17,10 @@

<%= gettext("Formats") %>

-
+
<%= Record.format_long_label(format) %> @@ -38,7 +41,10 @@

<%= gettext("Types") %>

-
+
<%= Record.type_long_label(type) %> diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 9c927325..2118af3c 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -302,7 +302,7 @@ msgstr "" msgid "Type" msgstr "" -#: lib/music_library_web/live/stats_live/index.html.heex:39 +#: lib/music_library_web/live/stats_live/index.html.heex:42 #, elixir-autogen, elixir-format msgid "Types" msgstr ""