// React import React, { useState } from "react"; // next import Link from "next/link"; import useSWR from "swr"; import _ from "lodash"; import useUser from "lib/hooks/useUser"; // Services import projectService from "lib/services/project.service"; // icons import { CalendarDaysIcon, CheckIcon, EyeIcon, MinusIcon, PencilIcon, PlusIcon, TrashIcon, } from "@heroicons/react/24/outline"; import { renderShortNumericDateFormat } from "constants/common"; const ProjectMemberInvitations = ({ project, slug, invitationsRespond, handleInvitation, setDeleteProject, }: any) => { const { user } = useUser(); const { data: members } = useSWR("PROJECT_MEMBERS", () => projectService.projectMembers(slug, project.id) ); const isMember = _.filter(members, (item: any) => item.member.id === (user as any).id).length === 1; const [selected, setSelected] = useState(false); return ( <>
{!isMember ? ( { setSelected(e.target.checked); handleInvitation( project, invitationsRespond.includes(project.id) ? "withdraw" : "accepted" ); }} type="checkbox" /> ) : null} {project.name} ({project.identifier})
{isMember ? (
) : null}

{project.description}

{!isMember ? ( ) : ( Member )} View
{renderShortNumericDateFormat(project.created_at)}
); }; export default ProjectMemberInvitations;