defmodule LokalWeb.Components.InviteCard do @moduledoc """ Display card for an invite """ use LokalWeb, :component alias LokalWeb.Endpoint def invite_card(assigns) do assigns = assigns |> assign_new(:code_actions, fn -> [] end) ~H"""

<%= @invite.name %>

<%= if @invite.disabled_at |> is_nil() do %>

<%= if @invite.uses_left do %> <%= gettext( "Uses Left: %{uses_left}", uses_left: @invite.uses_left ) %> <% else %> <%= gettext("Uses Left: Unlimited") %> <% end %>

<% else %>

<%= gettext("Invite Disabled") %>

<% end %> <.qr_code content={Routes.user_registration_url(Endpoint, :new, invite: @invite.token)} filename={@invite.name} />
<%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %> <%= render_slot(@code_actions) %>
<%= render_slot(@inner_block) %>
""" end end