Display included releases count in records grid

This commit is contained in:
Claudio Ortolina
2025-03-04 09:50:06 +00:00
parent bcfe2a7f3c
commit aacba5606b
2 changed files with 32 additions and 18 deletions
@@ -234,11 +234,25 @@ defmodule MusicLibraryWeb.RecordComponents do
>
<li :for={{id, record} <- @records} id={id} class="relative">
<div class="group overflow-hidden rounded-lg bg-zinc-100 focus-within:ring-2 focus-within:ring-zinc-500 focus-within:ring-offset-2 focus-within:ring-offset-zinc-100">
<img
alt={record.title}
src={~p"/covers/#{record.id}?vsn=#{record.cover_hash}"}
class="pointer-events-none aspect-square object-cover group-hover:opacity-75"
/>
<div class="relative">
<img
alt={record.title}
src={~p"/covers/#{record.id}?vsn=#{record.cover_hash}"}
class="pointer-events-none aspect-square object-cover group-hover:opacity-75"
/>
<span
:if={Records.Record.included_release_groups_count(record) > 0}
class={[
"absolute right-0 bottom-0 rounded-br-lg rounded-tl-lg px-2",
"text-sm font-medium",
"bg-zinc-50 dark:bg-zinc-500/10",
"text-zinc-700 dark:text-zinc-400",
"border-1 border-zinc-600/20 dark:border-zinc-500/20"
]}
>
{Records.Record.included_release_groups_count(record)}
</span>
</div>
<button
type="button"
class="absolute inset-0 focus:outline-hidden"