Add user avatar upload to account settings and nav bar

- Add `uploadAvatarAction` and `removeAvatarAction` server actions;
  store files under `DATA_DIR/avatars/{userId}.{ext}` via Bun.write
- Add `GET /api/avatars/[userId]` route that scans the avatar dir with
  Bun.Glob and serves with immutable Cache-Control (cache-busted via
  query param)
- Refactor AccountSection with hover overlay, AnimatePresence fade,
  and file input; click avatar to upload (no image) or remove (has image)
- Replace NavBar user initial badge with Avatar + DropdownMenu showing
  name, email, settings link, and sign-out
- Thread `userEmail` and `userImage` props through AuthenticatedShell
  → NavBar and SettingsPage → AccountSection
This commit is contained in:
2026-03-08 11:02:33 -04:00
parent 02466e94f9
commit 84c4356a9f
7 changed files with 340 additions and 46 deletions
+1
View File
@@ -177,6 +177,7 @@ export default async function SettingsPage() {
user={{
name: session.user.name,
email: session.user.email,
image: session.user.image || undefined,
createdAt: session.user.createdAt.toISOString(),
role: session.user.role ?? undefined,
}}