This commit is contained in:
Mirai Kumiko 2025-06-18 09:13:59 +02:00
parent 3a57d74357
commit df548a4943
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
12 changed files with 137 additions and 179 deletions

View file

@ -18,33 +18,37 @@ defmodule NullaWeb.ActorHTML do
def format_registration_date(date) do
now = Date.utc_today()
formatted = Date.to_string(date) |> String.replace("-", "/")
diff_days = Date.diff(now, date)
cond do
diff_days == 0 ->
"#{formatted} (today)"
diff_days == 1 ->
"#{formatted} (1 day ago)"
diff_days < 30 ->
"#{formatted} (#{diff_days} days ago)"
diff_days < 365 ->
year_diff = now.year - date.year
month_diff = now.month - date.month
day_correction = if now.day < date.day, do: -1, else: 0
months = year_diff * 12 + month_diff + day_correction
if months == 1 do
"#{formatted} (1 month ago)"
else
"#{formatted} (#{months} months ago)"
end
true ->
year_diff = now.year - date.year
years = if {now.month, now.day} < {date.month, date.day}, do: year_diff - 1, else: year_diff
years =
if {now.month, now.day} < {date.month, date.day}, do: year_diff - 1, else: year_diff
if years == 1 do
"#{formatted} (1 year ago)"
else

View file

@ -19,7 +19,8 @@
<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">
<img
src={@actor.icon["url"]}}
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"
/>
<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">
@ -81,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={@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">