2023-02-26 00:47:51 -05:00
|
|
|
defmodule MemexWeb.Components.UserCard do
|
2022-02-25 21:52:17 -05:00
|
|
|
@moduledoc """
|
|
|
|
Display card for a user
|
|
|
|
"""
|
|
|
|
|
2023-02-26 00:47:51 -05:00
|
|
|
use MemexWeb, :component
|
|
|
|
alias Memex.Accounts.User
|
2023-02-26 00:37:17 -05:00
|
|
|
|
|
|
|
attr :user, User, required: true
|
|
|
|
slot(:inner_block, required: true)
|
2022-02-25 21:52:17 -05:00
|
|
|
|
|
|
|
def user_card(assigns) do
|
|
|
|
~H"""
|
|
|
|
<div
|
|
|
|
id={"user-#{@user.id}"}
|
|
|
|
class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center text-center
|
2023-02-04 09:16:51 -05:00
|
|
|
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
|
|
|
|
transition-all duration-300 ease-in-out"
|
2022-02-25 21:52:17 -05:00
|
|
|
>
|
|
|
|
<h1 class="px-4 py-2 rounded-lg title text-xl break-all">
|
|
|
|
<%= @user.email %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<h3 class="px-4 py-2 rounded-lg title text-lg">
|
2022-05-05 21:44:42 -04:00
|
|
|
<p>
|
2023-01-26 00:28:34 -05:00
|
|
|
<%= if @user.confirmed_at do %>
|
|
|
|
<%= gettext(
|
|
|
|
"User was confirmed at%{confirmed_datetime}",
|
|
|
|
confirmed_datetime: ""
|
|
|
|
) %>
|
|
|
|
<.datetime datetime={@user.confirmed_at} />
|
2022-05-05 21:44:42 -04:00
|
|
|
<% else %>
|
2023-01-26 00:28:34 -05:00
|
|
|
<%= gettext("Email unconfirmed") %>
|
2022-05-05 21:44:42 -04:00
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2023-01-26 00:28:34 -05:00
|
|
|
<%= gettext(
|
|
|
|
"User registered on%{registered_datetime}",
|
|
|
|
registered_datetime: ""
|
|
|
|
) %>
|
|
|
|
<.datetime datetime={@user.inserted_at} />
|
2022-05-05 21:44:42 -04:00
|
|
|
</p>
|
2022-02-25 21:52:17 -05:00
|
|
|
</h3>
|
|
|
|
|
2023-02-04 09:16:51 -05:00
|
|
|
<div :if={@inner_block} class="px-4 py-2 flex space-x-4 justify-center items-center">
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</div>
|
2022-02-25 21:52:17 -05:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|