Ignore:
Timestamp:
01/26/26 19:03:37 (6 months ago)
Author:
Filip Gavrilovski <filipgavrilovski28@…>
Branches:
main
Children:
d47e225
Parents:
3727852
Message:

add support for profile pictures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/Nav.tsx

    r3727852 r484dc3f  
    11import { Link } from "react-router-dom";
    2 import axiosInstance from "./api/axiosInstance";
     2import axiosInstance, { baseURL } from "./api/axiosInstance";
    33import Logo from "./assets/logo-finkwave.png";
    44import { useAuth } from "./context/authContext";
     
    2929                                                        <div className="flex items-center space-x-3">
    3030                                                                <div className="flex items-center space-x-2 bg-slate-700 rounded-lg px-3 py-2">
    31                                                                         <div className="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center">
    32                                                                                 <span className="text-white text-sm font-semibold">
    33                                                                                         {user.username.charAt(0).toUpperCase()}
    34                                                                                 </span>
    35                                                                         </div>
     31                                                                        {user.profilePhoto ? (
     32                                                                                <img
     33                                                                                        src={`${baseURL}/${user.profilePhoto}`}
     34                                                                                        alt={`${user.username}'s profile`}
     35                                                                                        className="w-8 h-8 rounded-full object-cover"
     36                                                                                />
     37                                                                        ) : (
     38                                                                                <div className="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center">
     39                                                                                        <span className="text-white text-sm font-semibold">
     40                                                                                                {user.username.charAt(0).toUpperCase()}
     41                                                                                        </span>
     42                                                                                </div>
     43                                                                        )}
     44
    3645                                                                        <div className="text-white">
    3746                                                                                <p className="text-sm font-medium">{user.username}</p>
     
    4251                                                                </div>
    4352                                                                <button
    44                                                                         onClick={(e: React.MouseEvent<HTMLButtonElement>) =>
    45                                                                                 handleLogout(e)
    46                                                                         }
     53                                                                        onClick={handleLogout}
    4754                                                                        className="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg text-sm
    4855                                    font-medium transition-colors duration-200 flex items-center space-x-1 cursor-pointer"
Note: See TracChangeset for help on using the changeset viewer.