import { useState } from "react"; import { useRouter } from "next/router"; // react-beautiful-dnd import StrictModeDroppable from "components/dnd/StrictModeDroppable"; import { Draggable } from "react-beautiful-dnd"; // hooks import useIssuesProperties from "hooks/use-issue-properties"; // components import { BoardHeader, SingleBoardIssue } from "components/core"; // ui import { CustomMenu } from "components/ui"; // icons import { PlusIcon } from "@heroicons/react/24/outline"; // types import { IIssue, IProjectMember, NestedKeyOf, UserAuth } from "types"; type Props = { index: number; type?: "issue" | "cycle" | "module"; bgColor?: string; groupTitle: string; groupedByIssues: { [key: string]: IIssue[]; }; selectedGroup: NestedKeyOf | null; members: IProjectMember[] | undefined; addIssueToState: () => void; handleDeleteIssue: (issue: IIssue) => void; openIssuesListModal?: (() => void) | null; orderBy: NestedKeyOf | "manual" | null; userAuth: UserAuth; }; export const SingleBoard: React.FC = ({ index, type, bgColor, groupTitle, groupedByIssues, selectedGroup, members, addIssueToState, handleDeleteIssue, openIssuesListModal, orderBy, userAuth, }) => { // collapse/expand const [isCollapsed, setIsCollapsed] = useState(true); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const [properties] = useIssuesProperties(workspaceSlug as string, projectId as string); const createdBy = selectedGroup === "created_by" ? members?.find((m) => m.member.id === groupTitle)?.member.first_name ?? "loading..." : null; if (selectedGroup === "priority") groupTitle === "high" ? (bgColor = "#dc2626") : groupTitle === "medium" ? (bgColor = "#f97316") : groupTitle === "low" ? (bgColor = "#22c55e") : (bgColor = "#ff0000"); return ( {(provided, snapshot) => (
{(provided, snapshot) => (
{groupedByIssues[groupTitle].map((issue, index: number) => ( ))} {provided.placeholder} {type === "issue" ? ( ) : ( Add issue } className="mt-1" optionsPosition="left" noBorder > Create new {openIssuesListModal && ( Add an existing issue )} )}
)}
)}
); };