import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // ui // icons import { CalendarDaysIcon, CheckIcon, PencilIcon, PlusIcon, TrashIcon, ClipboardDocumentListIcon, } from "@heroicons/react/24/outline"; // types // ui import { Button } from "components/ui"; // hooks import useProjectMembers from "hooks/use-project-members"; // helpers import { renderShortNumericDateFormat } from "helpers/date-time.helper"; // types import type { IProject } from "types"; export type ProjectCardProps = { workspaceSlug: string; project: IProject; setToJoinProject: (id: string | null) => void; setDeleteProject: (id: string | null) => void; }; export const ProjectCard: React.FC = (props) => { const { workspaceSlug, project, setToJoinProject, setDeleteProject } = props; // router const router = useRouter(); // fetching project members information const { members, isMember, canDelete, canEdit } = useProjectMembers(workspaceSlug, project.id); if (!members) { return (
); } return ( <>
{project.icon && ( {String.fromCodePoint(parseInt(project.icon))} )} {project.name} {project.identifier}
{isMember ? (
{canEdit && ( )} {canDelete && ( )}
) : null}

{project.description}

{!isMember ? ( ) : (
Member
)}
{renderShortNumericDateFormat(project.created_at)}
); };