import React, { useState } from "react"; // Next imports import Link from "next/link"; // React beautiful dnd import { Draggable } from "react-beautiful-dnd"; import StrictModeDroppable from "components/dnd/StrictModeDroppable"; // common import { addSpaceIfCamelCase, renderShortNumericDateFormat } from "constants/common"; // types import { IIssue, Properties, NestedKeyOf } from "types"; // icons import { ArrowsPointingInIcon, ArrowsPointingOutIcon, CalendarDaysIcon, EllipsisHorizontalIcon, PencilIcon, PlusIcon, } from "@heroicons/react/24/outline"; import Image from "next/image"; type Props = { selectedGroup: NestedKeyOf | null; groupTitle: string; groupedByIssues: any; index: number; setIsIssueOpen: React.Dispatch>; properties: Properties; setPreloadedData: React.Dispatch< React.SetStateAction< | (Partial & { actionType: "createIssue" | "edit" | "delete"; }) | undefined > >; bgColor?: string; stateId?: string; }; const SingleBoard: React.FC = ({ selectedGroup, groupTitle, groupedByIssues, index, setIsIssueOpen, properties, setPreloadedData, bgColor = "#0f2b16", stateId, }) => { // Collapse/Expand const [show, setState] = useState(true); // Edit state name const [showInput, setInput] = useState(false); if (selectedGroup === "priority") groupTitle === "high" ? (bgColor = "#dc2626") : groupTitle === "medium" ? (bgColor = "#f97316") : groupTitle === "low" ? (bgColor = "#22c55e") : (bgColor = "#ff0000"); return ( {(provided, snapshot) => (
{showInput ? null : (
{ // setInput(true); }} >

{groupTitle === null || groupTitle === "null" ? "None" : addSpaceIfCamelCase(groupTitle)}

{groupedByIssues[groupTitle].length}
)}
{/* */}
{(provided, snapshot) => (
{groupedByIssues[groupTitle].map((childIssue: any, index: number) => ( {(provided, snapshot) => (
{Object.keys(properties).map( (key) => properties[key as keyof Properties] && !Array.isArray(childIssue[key as keyof IIssue]) && (
{key === "target_date" ? ( <> {" "} {childIssue.target_date ? renderShortNumericDateFormat(childIssue.target_date) : "N/A"} ) : ( "" )} {key === "name" && ( {childIssue.name} )} {key === "state" && ( <>{addSpaceIfCamelCase(childIssue["state_detail"].name)} )} {key === "priority" && <>{childIssue.priority}} {key === "description" && <>{childIssue.description}} {key === "assignee" ? (
{childIssue?.assignee_details?.length > 0 ? ( childIssue?.assignee_details?.map( (assignee: any, index: number) => (
{assignee.avatar && assignee.avatar !== "" ? (
{assignee.name}
) : (
{assignee.first_name.charAt(0)}
)}
) ) ) : ( None )}
) : null}
) )}
{/*
*/}
)}
))} {provided.placeholder}
)}
)}
); }; export default SingleBoard;