2022-02-12 02:28:27 -05:00
|
|
|
defmodule CanneryWeb.Components.InviteCard do
|
|
|
|
@moduledoc """
|
|
|
|
Display card for an invite
|
|
|
|
"""
|
|
|
|
|
|
|
|
use CanneryWeb, :component
|
|
|
|
alias CanneryWeb.Endpoint
|
|
|
|
|
|
|
|
def invite_card(assigns) do
|
|
|
|
~H"""
|
2022-02-15 18:13:33 -05:00
|
|
|
<div class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4
|
2022-02-12 02:28:27 -05:00
|
|
|
border border-gray-400 rounded-lg shadow-lg hover:shadow-md">
|
|
|
|
<h1 class="title text-xl">
|
|
|
|
<%= @invite.name %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<%= if @invite.disabled_at |> is_nil() do %>
|
|
|
|
<h2 class="title text-md">
|
|
|
|
<%= gettext("Uses Left:") %>
|
|
|
|
<%= @invite.uses_left || "Unlimited" %>
|
|
|
|
</h2>
|
|
|
|
<% else %>
|
|
|
|
<h2 class="title text-md">
|
|
|
|
<%= gettext("Invite Disabled") %>
|
|
|
|
</h2>
|
|
|
|
<% end %>
|
|
|
|
|
2022-02-15 19:50:48 -05:00
|
|
|
<div class="flex flex-row justify-center items-center space-x-4">
|
|
|
|
<code id={"code-#{@invite.id}"} class="text-xs px-4 py-2 rounded-lg text-gray-100 bg-primary-800"><%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %>
|
|
|
|
</code>
|
|
|
|
|
|
|
|
<%= if @code_actions do %>
|
|
|
|
<%= render_slot(@code_actions) %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2022-02-12 02:28:27 -05:00
|
|
|
|
|
|
|
<%= if @inner_block do %>
|
|
|
|
<div class="flex space-x-4 justify-center items-center">
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|