feat: disable email buttons instead hide them

This commit is contained in:
carla 2025-12-15 08:44:24 +01:00
parent 6c38d7455f
commit b0daf8f28c
3 changed files with 33 additions and 13 deletions

View file

@ -3,23 +3,29 @@
{gettext("Members")}
<:actions>
<.button
:if={Enum.any?(@members, &MapSet.member?(@selected_members, &1.id))}
class="secondary"
id="copy-emails-btn"
phx-hook="CopyToClipboard"
phx-click="copy_emails"
disabled={not Enum.any?(@members, &MapSet.member?(@selected_members, &1.id))}
aria-label={gettext("Copy email addresses of selected members")}
>
<.icon name="hero-clipboard-document" />
{gettext("Copy emails")} ({Enum.count(@members, &MapSet.member?(@selected_members, &1.id))})
{gettext("Copy email addresses")} ({Enum.count(
@members,
&MapSet.member?(@selected_members, &1.id)
)})
</.button>
<.button
:if={Enum.any?(@members, &MapSet.member?(@selected_members, &1.id))}
class="secondary"
id="open-email-btn"
href={
"mailto:?bcc=" <>
(MvWeb.MemberLive.Index.format_selected_member_emails(@members, @selected_members)
|> Enum.join(", ")
|> URI.encode())
}
disabled={not Enum.any?(@members, &MapSet.member?(@selected_members, &1.id))}
aria-label={gettext("Open email program with BCC recipients")}
>
<.icon name="hero-envelope" />