// react import React, { useState } from "react"; // swr import useSWR from "swr"; // services import workspaceService from "lib/services/workspace.service"; // hooks import useUser from "lib/hooks/useUser"; // components import SingleIssue from "components/common/board-view/single-issue"; // headless ui import { Menu, Transition } from "@headlessui/react"; // ui import { CustomMenu } from "ui"; // icons import { PlusIcon } from "@heroicons/react/24/outline"; // types import { IIssue, IWorkspaceMember, NestedKeyOf, Properties } from "types"; // fetch-keys import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; // common import { addSpaceIfCamelCase, classNames } from "constants/common"; type Props = { properties: Properties; groupedByIssues: { [key: string]: IIssue[]; }; selectedGroup: NestedKeyOf | null; groupTitle: string; createdBy: string | null; bgColor?: string; openCreateIssueModal: (issue?: IIssue, actionType?: "create" | "edit" | "delete") => void; openIssuesListModal: () => void; removeIssueFromCycle: (bridgeId: string) => void; partialUpdateIssue: (formData: Partial, issueId: string) => void; handleDeleteIssue: React.Dispatch>; setPreloadedData: React.Dispatch< React.SetStateAction< | (Partial & { actionType: "createIssue" | "edit" | "delete"; }) | undefined > >; stateId: string | null; }; const SingleCycleBoard: React.FC = ({ properties, groupedByIssues, selectedGroup, groupTitle, createdBy, bgColor, openCreateIssueModal, openIssuesListModal, removeIssueFromCycle, partialUpdateIssue, handleDeleteIssue, setPreloadedData, stateId, }) => { // Collapse/Expand const [show, setState] = useState(true); const { activeWorkspace } = useUser(); if (selectedGroup === "priority") groupTitle === "high" ? (bgColor = "#dc2626") : groupTitle === "medium" ? (bgColor = "#f97316") : groupTitle === "low" ? (bgColor = "#22c55e") : (bgColor = "#ff0000"); const { data: people } = useSWR( activeWorkspace ? WORKSPACE_MEMBERS : null, activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null ); return (

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

{groupedByIssues[groupTitle].length}
{ openCreateIssueModal(); if (selectedGroup !== null) { setPreloadedData({ state: stateId !== null ? stateId : undefined, [selectedGroup]: groupTitle, actionType: "createIssue", }); } }} > Create new openIssuesListModal()}> Add an existing issue
{groupedByIssues[groupTitle].map((childIssue, index: number) => { const assignees = [ ...(childIssue?.assignees_list ?? []), ...(childIssue?.assignees ?? []), ]?.map((assignee) => { const tempPerson = people?.find((p) => p.member.id === assignee)?.member; return { avatar: tempPerson?.avatar, first_name: tempPerson?.first_name, email: tempPerson?.email, }; }); return ( ); })} Add issue } className="mt-1" optionsPosition="left" withoutBorder > { openCreateIssueModal(); if (selectedGroup !== null) { setPreloadedData({ state: stateId !== null ? stateId : undefined, [selectedGroup]: groupTitle, actionType: "createIssue", }); } }} > Create new openIssuesListModal()}> Add an existing issue
); }; export default SingleCycleBoard;