Add default avatar and header

This commit is contained in:
Mirai Kumiko 2025-06-21 20:54:31 +02:00
parent 3a53113284
commit 124149129e
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
4 changed files with 19 additions and 3 deletions

View file

@ -9,6 +9,22 @@ defmodule NullaWeb.ActorHTML do
embed_templates "templates/actor/*"
def avatar(url) do
if url do
url
else
"/images/default-avatar.jpg"
end
end
def profile_header(url) do
if url do
url
else
"/images/default-header.jpg"
end
end
def format_birthdate(date) do
formatted = Date.to_string(date) |> String.replace("-", "/")

View file

@ -16,10 +16,10 @@
</div>
<div class="relative border border-gray-300 shadow-md mt-5 rounded-t-xl overflow-hidden">
<div class="relative w-full aspect-[3/1]">
<img src={@actor.image["url"]} class="w-full h-full object-cover" />
<img src={profile_header(@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">
<img
src={@actor.icon["url"]}
src={avatar(@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"
/>
@ -82,7 +82,7 @@
<%= for note <- @notes do %>
<div class="p-4 border-b border-gray-300">
<div class="flex items-start space-x-4">
<img src={@actor.icon["url"]} } class="rounded-full w-[58px] h-[58px]" />
<img src={avatar(@actor.icon["url"])} } class="rounded-full w-[58px] h-[58px]" />
<div class="flex-1">
<div class="flex justify-between items-start">
<div class="flex items-center space-x-2">