import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // components import { AssigneesList } from "components/ui/avatar"; // icons import { CalendarDaysIcon } from "@heroicons/react/24/outline"; // helpers import { renderShortNumericDateFormat, findHowManyDaysLeft } from "helpers/date-time.helper"; import { addSpaceIfCamelCase } from "helpers/string.helper"; // types import { IIssue, Properties } from "types"; // constants import { getPriorityIcon } from "constants/global"; type Props = { type?: string; issue: IIssue; properties: Properties; editIssue?: () => void; handleDeleteIssue?: () => void; removeIssue?: () => void; }; export const IssueListItem: React.FC = (props) => { // const { type, issue, properties, editIssue, handleDeleteIssue, removeIssue } = props; const { issue, properties } = props; // router const router = useRouter(); const { workspaceSlug } = router.query; return (
{properties?.key && ( {issue.project_detail?.identifier}-{issue.sequence_id} )} {issue.name}
{properties.priority && (
{getPriorityIcon(issue.priority)}
Priority
{issue.priority ?? "None"}
)} {properties.state && (
{addSpaceIfCamelCase(issue?.state_detail.name)}
State
{issue?.state_detail.name}
)} {properties.due_date && (
{issue.target_date ? renderShortNumericDateFormat(issue.target_date) : "N/A"}
Due date
{renderShortNumericDateFormat(issue.target_date ?? "")}
{issue.target_date && (issue.target_date < new Date().toISOString() ? `Due date has passed by ${findHowManyDaysLeft(issue.target_date)} days` : findHowManyDaysLeft(issue.target_date) <= 3 ? `Due date is in ${findHowManyDaysLeft(issue.target_date)} days` : "Due date")}
)} {properties.sub_issue_count && (
{issue?.sub_issues_count} {issue?.sub_issues_count === 1 ? "sub-issue" : "sub-issues"}
)} {properties.assignee && (
)}
); };