Add actor/show.html.heex

This commit is contained in:
Mirai Kumiko 2025-06-17 12:56:08 +02:00
parent 894866ca03
commit 10756907dc
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278

View file

@ -16,10 +16,10 @@
</div> </div>
<div class="relative border border-gray-300 shadow-md mt-5 rounded-t-xl overflow-hidden"> <div class="relative border border-gray-300 shadow-md mt-5 rounded-t-xl overflow-hidden">
<div class="relative w-full aspect-[3/1]"> <div class="relative w-full aspect-[3/1]">
<img src={"/files/#{@user.banner}"} class="w-full h-full object-cover" /> <img src={@actor.image["url"]} class="w-full h-full object-cover" />
<div class="absolute inset-0 flex items-end justify-between px-4 pb-2 pointer-events-none"> <div class="absolute inset-0 flex items-end justify-between px-4 pb-2 pointer-events-none">
<img <img
src={"/files/#{@user.avatar}"} src={@actor.icon["url"]}}
class="translate-y-1/2 rounded-full border-4 border-white w-[8.33vw] h-[8.33vw] min-w-[80px] min-h-[80px] max-w-[160px] max-h-[160px] pointer-events-auto" class="translate-y-1/2 rounded-full border-4 border-white w-[8.33vw] h-[8.33vw] min-w-[80px] min-h-[80px] max-w-[160px] max-h-[160px] pointer-events-auto"
/> />
<button class="px-8 py-2 rounded-full text-sm font-semibold border transition bg-black text-white border-black hover:bg-gray-900 pointer-events-auto"> <button class="px-8 py-2 rounded-full text-sm font-semibold border transition bg-black text-white border-black hover:bg-gray-900 pointer-events-auto">
@ -28,33 +28,33 @@
</div> </div>
</div> </div>
<div class="mt-[4.5vw] px-4 flex flex-col"> <div class="mt-[4.5vw] px-4 flex flex-col">
<span class="text-xl font-bold">{@user.realname}</span> <span class="text-xl font-bold">{@actor.name}</span>
<span class="text-gray-500">@{@user.username}@{@domain}</span> <span class="text-gray-500">@{@actor.preferredUsername}@{@actor.domain}</span>
<div class="text-sm pt-2"> <div class="text-sm pt-2">
<p>{@user.bio}</p> <p>{@actor.summary}</p>
</div> </div>
<dl class="mt-2 text-sm text-gray-700 grid grid-cols-[auto,1fr] gap-x-2 gap-y-1 items-center"> <dl class="mt-2 text-sm text-gray-700 grid grid-cols-[auto,1fr] gap-x-2 gap-y-1 items-center">
<%= if @user.location do %> <%= if @actor.vcard_Address do %>
<dt class="flex items-center gap-2"> <dt class="flex items-center gap-2">
<.icon name="hero-map-pin" class="mt-0.5 h-5 w-5 flex-none" /> <.icon name="hero-map-pin" class="mt-0.5 h-5 w-5 flex-none" />
</dt> </dt>
<dd>{@user.location}</dd> <dd>{@actor.vcard_Address}</dd>
<% end %> <% end %>
<%= if @user.birthday do %> <%= if @actor.vcard_bday do %>
<dt class="flex items-center gap-2"> <dt class="flex items-center gap-2">
<.icon name="hero-cake" class="mt-0.5 h-5 w-5 flex-none" /> <.icon name="hero-cake" class="mt-0.5 h-5 w-5 flex-none" />
</dt> </dt>
<dd>{format_birthdate(@user.birthday)}</dd> <dd>{format_birthdate(@actor.vcard_bday)}</dd>
<% end %> <% end %>
<dt class="flex items-center gap-2"> <dt class="flex items-center gap-2">
<.icon name="hero-calendar" class="mt-0.5 h-5 w-5 flex-none" /> <.icon name="hero-calendar" class="mt-0.5 h-5 w-5 flex-none" />
</dt> </dt>
<dd>{format_registration_date(@user.inserted_at)}</dd> <dd>{format_registration_date(@actor.published)}</dd>
</dl> </dl>
<%= if @user.fields do %> <%= if @actor.attachment do %>
<dl class="mt-5 grid grid-cols-[max-content,1fr] gap-x-5 gap-y-2 items-center"> <dl class="mt-5 grid grid-cols-[max-content,1fr] gap-x-5 gap-y-2 items-center">
<%= for {key, value} <- @user.fields do %> <%= for %{"type" => "PropertyValue", "name" => name, "value" => value} <- @actor.attachment do %>
<dt>{key}</dt> <dt>{name}</dt>
<dd> <dd>
<%= if Regex.match?(~r{://}, value) do %> <%= if Regex.match?(~r{://}, value) do %>
<a href={value} class="text-[#1D9BF0]">{Regex.replace(~r{^\w+://}, value, "")}</a> <a href={value} class="text-[#1D9BF0]">{Regex.replace(~r{^\w+://}, value, "")}</a>
@ -66,30 +66,30 @@
</dl> </dl>
<% end %> <% end %>
<div class="flex mt-5 gap-3"> <div class="flex mt-5 gap-3">
<a href={~p"/@#{@user.username}"}>{length(@notes)} Posts</a> <a href={~p"/@#{@actor.preferredUsername}"}>{length(@notes)} Posts</a>
<a href={~p"/@#{@user.username}/following"}>{@following} Following</a> <a href={~p"/@#{@actor.preferredUsername}/following"}>{@following} Following</a>
<a href={~p"/@#{@user.username}/followers"}>{@followers} Followers</a> <a href={~p"/@#{@actor.preferredUsername}/followers"}>{@followers} Followers</a>
</div> </div>
</div> </div>
<div class="flex justify-between px-20 py-2 mt-5 border-y border-gray-300"> <div class="flex justify-between px-20 py-2 mt-5 border-y border-gray-300">
<a href={~p"/@#{@user.username}/featured"}>Featured</a> <a href={~p"/@#{@actor.preferredUsername}/featured"}>Featured</a>
<a href={~p"/@#{@user.username}"}>Posts</a> <a href={~p"/@#{@actor.preferredUsername}"}>Posts</a>
<a href={~p"/@#{@user.username}/with_replies"}>Posts and replies</a> <a href={~p"/@#{@actor.preferredUsername}/with_replies"}>Posts and replies</a>
<a href={~p"/@#{@user.username}/media"}>Media</a> <a href={~p"/@#{@actor.preferredUsername}/media"}>Media</a>
</div> </div>
<div> <div>
<%= for note <- @notes do %> <%= for note <- @notes do %>
<div class="p-4 border-b border-gray-300"> <div class="p-4 border-b border-gray-300">
<div class="flex items-start space-x-4"> <div class="flex items-start space-x-4">
<img src={"/files/#{@user.avatar}"} class="rounded-full w-[58px] h-[58px]" /> <img src={@actor.icon["url"]}} class="rounded-full w-[58px] h-[58px]" />
<div class="flex-1"> <div class="flex-1">
<div class="flex justify-between items-start"> <div class="flex justify-between items-start">
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<span class="font-semibold text-gray-900 text-sm"> <span class="font-semibold text-gray-900 text-sm">
{@user.realname} {@actor.name}
</span> </span>
<span class="text-gray-500 text-sm"> <span class="text-gray-500 text-sm">
@{@user.username}@{@domain} @{@actor.preferredUsername}@{@actor.domain}
</span> </span>
</div> </div>
<div class="flex items-center space-x-2 text-sm text-gray-500"> <div class="flex items-center space-x-2 text-sm text-gray-500">