larxius commited on
Commit
9789e10
·
verified ·
1 Parent(s): b9188fa

Update frontend/src/pages/Profile.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/pages/Profile.jsx +5 -4
frontend/src/pages/Profile.jsx CHANGED
@@ -1,5 +1,6 @@
1
  import React, { useState, useEffect, useRef } from 'react';
2
  import { useAuth } from '../components/AuthContext';
 
3
  import { toast } from 'react-hot-toast';
4
 
5
  export const Profile = () => {
@@ -418,13 +419,13 @@ export const Profile = () => {
418
  </div>
419
 
420
  <div className="flex flex-col items-center text-center mt-2 mb-6">
421
- <div className="w-20 h-20 rounded-full bg-primary-container/50 flex items-center justify-center mb-4">
422
- <span className="text-primary text-3xl font-bold uppercase">
423
- {profile.email ? profile.email.charAt(0) : '?'}
424
  </span>
425
  </div>
426
  <h2 className="font-bold text-on-surface m-0 text-xl">
427
- {profile.first_name || profile.last_name ? `${profile.first_name || ''} ${profile.last_name || ''}`.trim() : profile.email.split('@')[0]}
428
  </h2>
429
  <div className="mt-2 inline-flex items-center px-3 py-1 rounded-full bg-primary-container/30 text-primary font-semibold uppercase tracking-wider text-xs border border-primary/20">
430
  {(profile.role || 'user').replace(/_/g, ' ')}
 
1
  import React, { useState, useEffect, useRef } from 'react';
2
  import { useAuth } from '../components/AuthContext';
3
+ import { getInitials } from '../components/Layout';
4
  import { toast } from 'react-hot-toast';
5
 
6
  export const Profile = () => {
 
419
  </div>
420
 
421
  <div className="flex flex-col items-center text-center mt-2 mb-6">
422
+ <div className="w-20 h-20 rounded-full bg-primary-container/50 border-2 border-primary/20 flex items-center justify-center mb-4 shadow-sm">
423
+ <span className="text-primary text-3xl font-bold uppercase tracking-wider">
424
+ {getInitials(profile)}
425
  </span>
426
  </div>
427
  <h2 className="font-bold text-on-surface m-0 text-xl">
428
+ {profile.first_name || profile.last_name ? `${profile.first_name || ''} ${profile.last_name || ''}`.trim() : (profile.name || profile.email.split('@')[0])}
429
  </h2>
430
  <div className="mt-2 inline-flex items-center px-3 py-1 rounded-full bg-primary-container/30 text-primary font-semibold uppercase tracking-wider text-xs border border-primary/20">
431
  {(profile.role || 'user').replace(/_/g, ' ')}