mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-25 07:36:39 +02:00
- Bug fix: include twoFactorEnabled in login response so ProfilePage shows correct 2FA status after login (not always "Aktivieren") - Bug fix: restructure 2FA enable/disable handlers to separate API call from state updates, preventing false error messages on success - New: avatar field in User model (Base64 data-URL in PostgreSQL TEXT) - New: UserAvatar component with initials fallback - New: client-side image resize to 200x200px before upload - New: avatar upload/remove on ProfilePage with preview - New: avatar display + "Zum Profil" hint in sidebar - Increase JSON body size limit to 1mb for avatar uploads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
852 B
TypeScript
40 lines
852 B
TypeScript
import styles from './UserAvatar.module.css';
|
|
|
|
interface UserAvatarProps {
|
|
firstName: string;
|
|
lastName: string;
|
|
avatar?: string | null;
|
|
size?: number;
|
|
className?: string;
|
|
}
|
|
|
|
export function UserAvatar({
|
|
firstName,
|
|
lastName,
|
|
avatar,
|
|
size = 36,
|
|
className,
|
|
}: UserAvatarProps) {
|
|
const initials = `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase();
|
|
|
|
if (avatar) {
|
|
return (
|
|
<img
|
|
src={avatar}
|
|
alt={`${firstName} ${lastName}`}
|
|
className={`${styles.avatar} ${className ?? ''}`}
|
|
style={{ width: size, height: size }}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={`${styles.avatar} ${styles.initials} ${className ?? ''}`}
|
|
style={{ width: size, height: size, fontSize: size * 0.4 }}
|
|
aria-label={`${firstName} ${lastName}`}
|
|
>
|
|
{initials}
|
|
</div>
|
|
);
|
|
}
|