{"size": 1082, "ext": "js", "max_stars_repo_path": "src/Components/Conversation/index.js", "max_stars_repo_name": "christopherfulldev/chambrabook_client", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Components/Conversation/index.js", "max_issues_repo_name": "christopherfulldev/chambrabook_client", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Components/Conversation/index.js", "max_forks_repo_name": "christopherfulldev/chambrabook_client", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.9142857143, "max_line_length": 90, "alphanum_fraction": 0.5591497227}
import "./index.css";

import { useState, useEffect} from "react";

const CoonversationComponent = ({conversation, currentUser}) => {
    const [user, setUser] = useState(null);
    const PUBLIC_FILES = process.env.REACT_APP_PUBLIC_FOLDER;

    useEffect(async () => {
        const friendId = conversation.members.find((member) => member !== currentUser._id)
        try {
            await APIconnection.getConversationsBetweenUsers();
            return setUser(response.data);
        } catch (error) {
            throw new Error("Error, Try again");
        }
    }, [currentUser, conversation]);

    return (
        <div className="conversation">
            <img
                className="conversationImg"
                src={
                user?.profilePicture
                    ? PUBLIC_FILES + user.profilePicture
                    : PUBLIC_FILES + "person/noAvatar.png"
                }
                alt=""
            />
            <span className="conversationName">{user?.username}</span>
        </div>
    );
};

export default ConversationComponent;