Show tooltip with raw count
This commit is contained in:
@@ -49,6 +49,7 @@ defmodule MusicLibraryWeb.StatsComponents do
|
|||||||
attr :title, :string, required: true
|
attr :title, :string, required: true
|
||||||
attr :count, :integer, required: true
|
attr :count, :integer, required: true
|
||||||
attr :path, :string, required: false, default: nil
|
attr :path, :string, required: false, default: nil
|
||||||
|
attr :tooltip, :any, required: false, default: nil
|
||||||
|
|
||||||
def counter(assigns) do
|
def counter(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
@@ -58,7 +59,7 @@ defmodule MusicLibraryWeb.StatsComponents do
|
|||||||
{@title}
|
{@title}
|
||||||
</p>
|
</p>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1">
|
<dd :if={!@tooltip} class="mt-1">
|
||||||
<.link
|
<.link
|
||||||
:if={@path}
|
:if={@path}
|
||||||
navigate={@path}
|
navigate={@path}
|
||||||
@@ -68,11 +69,28 @@ defmodule MusicLibraryWeb.StatsComponents do
|
|||||||
</.link>
|
</.link>
|
||||||
<p
|
<p
|
||||||
:if={!@path}
|
:if={!@path}
|
||||||
class="block text-2xl sm:text-3xl font-semibold text-center text-zinc-900 dark:text-zinc-300"
|
class="block cursor-default text-2xl sm:text-3xl font-semibold text-center text-zinc-900 dark:text-zinc-300"
|
||||||
>
|
>
|
||||||
{@count}
|
{@count}
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd :if={@tooltip} class="mt-1">
|
||||||
|
<.tooltip value={@tooltip}>
|
||||||
|
<.link
|
||||||
|
:if={@path}
|
||||||
|
navigate={@path}
|
||||||
|
class="block text-2xl sm:text-3xl font-semibold text-center text-zinc-900 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200"
|
||||||
|
>
|
||||||
|
{@count}
|
||||||
|
</.link>
|
||||||
|
<p
|
||||||
|
:if={!@path}
|
||||||
|
class="block cursor-default text-2xl sm:text-3xl font-semibold text-center text-zinc-900 dark:text-zinc-300"
|
||||||
|
>
|
||||||
|
{@count}
|
||||||
|
</p>
|
||||||
|
</.tooltip>
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,11 @@
|
|||||||
path={~p"/collection"}
|
path={~p"/collection"}
|
||||||
/>
|
/>
|
||||||
<.counter title={gettext("Total wishlist")} count={@wishlist_count} path={~p"/wishlist"} />
|
<.counter title={gettext("Total wishlist")} count={@wishlist_count} path={~p"/wishlist"} />
|
||||||
<.counter title={gettext("Total scrobbles")} count={to_compact(@scrobble_count)} />
|
<.counter
|
||||||
|
title={gettext("Total scrobbles")}
|
||||||
|
count={to_compact(@scrobble_count)}
|
||||||
|
tooltip={@scrobble_count}
|
||||||
|
/>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user