Files
DeepTutor/web/components/auth
Bingxi Zhao (Frank) 86ff120668 fix(profile): harden avatar fallback, admin ring in sidebar, dedupe auth-status fetch
Follow-up nits on the #573 profile/avatar work:
- UserAvatar: validate an icon marker's icon/color against the known sets and
  fall back to the deterministic avatar for unknown values. The backend
  _ICON_MARKER_RE accepts any [a-z0-9-] color, so a hand-set marker like
  "icon⭐bogus" previously rendered an invisible avatar
  (AVATAR_COLORS[unknown] === undefined).
- ProfileLink: pass role to UserAvatar so admins get the amber ring in the
  sidebar, matching the "amber ring at every size" intent.
- useAuthStatus: share one in-flight /api/v1/auth/status request across the
  hook's consumers (sidebar Admin/Logout/Profile links) so a page load makes a
  single call instead of one per consumer; cleared once settled so a later
  mount (after login/logout) refetches.

Verified: tsc, eslint, web node tests (142).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:11:48 +08:00
..