import { useNavigate } from "react-router-dom"; import { baseURL } from "../../api/axiosInstance"; import type { BaseNonAdminUser } from "../../utils/types"; import { useEffect } from "react"; import { useAuth } from "../../context/authContext"; interface ModalProps { title: string; users: BaseNonAdminUser[]; onClose: () => void; onFollowToggle: (targetUsername: string) => Promise; } const UserListModal = ({ title, users, onClose, onFollowToggle, }: ModalProps) => { const navigate = useNavigate(); const { user } = useAuth(); useEffect(() => { document.body.style.overflow = "hidden"; return () => { document.body.style.overflow = ""; }; }, []); return (

{title}

{users.length === 0 ? (

No users found.

) : ( users.map((u) => (
{ onClose(); navigate(`/users/${u.username}`); }} >
{u.profilePhoto ? ( ) : ( {u.fullName.charAt(0)} )}

{u.fullName}

@{u.username}

{user && ( )}
)) )}
); }; export default UserListModal;