import { Dispatch, SetStateAction } from "react"; import { observer } from "mobx-react-lite"; // types import { TIssue, TIssueMap } from "@plane/types"; // components import { CalendarQuickAddIssueForm, CalendarIssueBlockRoot } from "@/components/issues"; // helpers import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; import { TRenderQuickActions } from "../list/list-view-types"; // types type Props = { date: Date; issues: TIssueMap | undefined; issueIdList: string[] | null; showAllIssues: boolean; setShowAllIssues?: Dispatch>; isMonthLayout: boolean; quickActions: TRenderQuickActions; isDragDisabled?: boolean; enableQuickIssueCreate?: boolean; disableIssueCreation?: boolean; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; addIssuesToView?: (issueIds: string[]) => Promise; viewId?: string; readOnly?: boolean; isMobileView?: boolean; }; export const CalendarIssueBlocks: React.FC = observer((props) => { const { date, issues, issueIdList, showAllIssues, setShowAllIssues, quickActions, isDragDisabled = false, enableQuickIssueCreate, disableIssueCreation, quickAddCallback, addIssuesToView, viewId, readOnly, isMonthLayout, isMobileView = false, } = props; const formattedDatePayload = renderFormattedPayloadDate(date); const totalIssues = issueIdList?.length ?? 0; if (!formattedDatePayload) return null; return ( <> {issueIdList?.slice(0, showAllIssues || !isMonthLayout ? issueIdList.length : 4).map((issueId) => (
))} {totalIssues > 4 && isMonthLayout && (
)} {enableQuickIssueCreate && !disableIssueCreation && !readOnly && (
setShowAllIssues && setShowAllIssues(true)} />
)} ); });