feat(header): afficher la photo de profil a la place des initiales (#6)
CD — Déploiement / deploy (push) Successful in 20s

/auth/me renvoie desormais has_avatar et avatar_updated_at (LEFT JOIN
user_avatars). Le header affiche l'avatar avec un cache-buster sur
updated_at, et retombe sur les initiales en cas d'absence ou d'echec.

Le profil rafraichit la session apres ajout/retrait de l'avatar pour que
le header se mette a jour immediatement.

---------

Co-authored-by: xEsiah <[email protected]>
Reviewed-on: #6
Reviewed-by: Esiah <[email protected]>
Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #6.
This commit is contained in:
Gitea Actions
2026-10-16 11:44:34 +00:00
committed by Esiah
co-authored by Esiah
parent 284646562b
commit c5df5c05f1
4 changed files with 24 additions and 4 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
import { useState } from "react";
import { NavLink, Outlet } from "react-router-dom";
import { Button, cn } from "../ui/index.js";
import { api } from "../lib/api.js";
import { useSession } from "../lib/session.js";
import {
ActivityIcon,
@@ -127,10 +128,20 @@ export const AppShell = () => {
</p>
</div>
<span
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border bg-surface text-xs font-semibold text-foreground"
className="relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-surface text-xs font-semibold text-foreground"
aria-hidden="true"
>
{initials(user.first_name, user.last_name)}
{user.has_avatar ? (
<img
src={`${api.avatarUrl(user.id)}?v=${encodeURIComponent(user.avatar_updated_at ?? "")}`}
alt=""
className="absolute inset-0 h-full w-full object-cover"
onError={(event) => {
event.currentTarget.style.display = "none";
}}
/>
) : null}
</span>
<Button
variant="secondary"