import React, { useState } from "react"; // react-beautiful-dnd import { Draggable } from "react-beautiful-dnd"; // component import StrictModeDroppable from "components/dnd/StrictModeDroppable"; import { SingleCalendarIssue } from "./single-issue"; // icons import { PlusSmallIcon } from "@heroicons/react/24/outline"; // helper import { formatDate } from "helpers/calendar.helper"; // types import { ICurrentUserResponse, IIssue } from "types"; type Props = { handleEditIssue: (issue: IIssue) => void; handleDeleteIssue: (issue: IIssue) => void; index: number; date: { date: string; issues: IIssue[]; }; addIssueToDate: (date: string) => void; isMonthlyView: boolean; showWeekEnds: boolean; user: ICurrentUserResponse | undefined; isNotAllowed: boolean; }; export const SingleCalendarDate: React.FC = ({ handleEditIssue, handleDeleteIssue, date, index, addIssueToDate, isMonthlyView, showWeekEnds, user, isNotAllowed, }) => { const [showAllIssues, setShowAllIssues] = useState(false); const totalIssues = date.issues.length; return ( {(provided) => (
{isMonthlyView && {formatDate(new Date(date.date), "d")}} {totalIssues > 0 && date.issues.slice(0, showAllIssues ? totalIssues : 4).map((issue: IIssue, index) => ( {(provided, snapshot) => ( )} ))} {totalIssues > 4 && ( )}
{provided.placeholder}
)}
); };