Extract counter stat component
This commit is contained in:
@@ -39,4 +39,28 @@ defmodule MusicLibraryWeb.StatsLive.DataComponents do
|
|||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attr :title, :string, required: true
|
||||||
|
attr :count, :integer, required: true
|
||||||
|
attr :path, :string, required: true
|
||||||
|
|
||||||
|
def counter(assigns) do
|
||||||
|
~H"""
|
||||||
|
<div class="overflow-hidden rounded-md bg-white dark:bg-zinc-700 px-4 pb-3 pt-5 shadow sm:px-6 sm:pt-6">
|
||||||
|
<dt>
|
||||||
|
<p class="truncate text-sm font-medium text-gray-500 dark:text-gray-400">
|
||||||
|
<%= @title %>
|
||||||
|
</p>
|
||||||
|
</dt>
|
||||||
|
<dd class="flex items-baseline mt-1 pb-6 sm:pb-7">
|
||||||
|
<a
|
||||||
|
href={@path}
|
||||||
|
class="text-2xl font-semibold text-gray-900 hover:text-gray-500 dark:text-gray-300 dark:hover:text-gray-200"
|
||||||
|
>
|
||||||
|
<%= @count %>
|
||||||
|
</a>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
"""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,36 +32,8 @@
|
|||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-hidden rounded-md bg-white dark:bg-zinc-700 px-4 pb-3 pt-5 shadow sm:px-6 sm:pt-6">
|
<.counter title={gettext("Total collection")} count={@collection_count} path={~p"/records"} />
|
||||||
<dt>
|
<.counter title={gettext("Total wishlist")} count={@wishlist_count} path={~p"/wishlist"} />
|
||||||
<p class="truncate text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
<%= gettext("Total collection") %>
|
|
||||||
</p>
|
|
||||||
</dt>
|
|
||||||
<dd class="flex items-baseline mt-1 pb-6 sm:pb-7">
|
|
||||||
<a
|
|
||||||
href={~p"/records"}
|
|
||||||
class="text-2xl font-semibold text-gray-900 hover:text-gray-500 dark:text-gray-300 dark:hover:text-gray-200"
|
|
||||||
>
|
|
||||||
<%= @collection_count %>
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div class="overflow-hidden rounded-md bg-white dark:bg-zinc-700 px-4 pb-3 pt-5 shadow sm:px-6 sm:pt-6">
|
|
||||||
<dt>
|
|
||||||
<p class="truncate text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
<%= gettext("Total wishlist") %>
|
|
||||||
</p>
|
|
||||||
</dt>
|
|
||||||
<dd class="flex items-baseline mt-1 pb-6 sm:pb-7">
|
|
||||||
<a
|
|
||||||
href={~p"/wishlist"}
|
|
||||||
class="text-2xl font-semibold text-gray-900 hover:text-gray-500 dark:text-gray-300 dark:hover:text-gray-200"
|
|
||||||
>
|
|
||||||
<%= @wishlist_count %>
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ msgstr ""
|
|||||||
msgid "Format"
|
msgid "Format"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:70
|
#: lib/music_library_web/live/stats_live/index.html.heex:42
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Formats"
|
msgid "Formats"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -287,12 +287,12 @@ msgstr ""
|
|||||||
msgid "The application has been updated, please reload."
|
msgid "The application has been updated, please reload."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:38
|
#: lib/music_library_web/live/stats_live/index.html.heex:35
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Total collection"
|
msgid "Total collection"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:53
|
#: lib/music_library_web/live/stats_live/index.html.heex:36
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Total wishlist"
|
msgid "Total wishlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -302,7 +302,7 @@ msgstr ""
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:74
|
#: lib/music_library_web/live/stats_live/index.html.heex:46
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Types"
|
msgid "Types"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user