import UserInfo from "@/components/main/UserInfo";
import { IProjectRequest } from "@/types/types";
import Link from "next/link";
import React from "react";

function ProjectRequests({
  projectRequests,
}: {
  projectRequests: IProjectRequest[];
}) {
  return (
    <>
      {projectRequests
        ? projectRequests.map((item: IProjectRequest) => {
            return (
              <Link key={item?._id} href={`/users/${item?.user?.user_name}`}>
                <div
                  className={`flex p-2 rounded-3xl my-4 justify-between items-center w-full max-w-sm mx-auto md:max-w-md ${
                    item?.status === "accepted" ? "border border-[#0C8002]" : ""
                  }`}
                >
                  <UserInfo
                    first_name={item?.user?.first_name}
                    is_verified={item?.user?.verify_badge}
                    userId={item?.user?._id}
                    profile_image={item?.user?.profile_image}
                    user_level={item?.user?.user_level}
                    last_name={item?.user?.last_name}
                    user_name={item?.user?.user_name}
                  />
                </div>
              </Link>
            );
          })
        : ""}
    </>
  );
}

export default ProjectRequests;
