import { Droppable } from "@hello-pangea/dnd"; import { observer } from "mobx-react-lite"; // components import { CalendarIssueBlocks, ICalendarDate } from "components/issues"; // helpers import { renderFormattedPayloadDate } from "helpers/date-time.helper"; import { cn } from "helpers/common.helper"; // constants import { MONTHS_LIST } from "constants/calendar"; // types import { ICycleIssuesFilter } from "store/issue/cycle"; import { IModuleIssuesFilter } from "store/issue/module"; import { IProjectIssuesFilter } from "store/issue/project"; import { IProjectViewIssuesFilter } from "store/issue/project-views"; import { TGroupedIssues, TIssue, TIssueMap } from "@plane/types"; type Props = { issuesFilterStore: IProjectIssuesFilter | IModuleIssuesFilter | ICycleIssuesFilter | IProjectViewIssuesFilter; date: ICalendarDate; issues: TIssueMap | undefined; groupedIssueIds: TGroupedIssues; quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode; enableQuickIssueCreate?: boolean; disableIssueCreation?: boolean; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; addIssuesToView?: (issueIds: string[]) => Promise; viewId?: string; readOnly?: boolean; selectedDate: Date; setSelectedDate: (date: Date) => void; }; export const CalendarDayTile: React.FC = observer((props) => { const { issuesFilterStore, date, issues, groupedIssueIds, quickActions, enableQuickIssueCreate, disableIssueCreation, quickAddCallback, addIssuesToView, viewId, readOnly = false, selectedDate, setSelectedDate, } = props; const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month"; const formattedDatePayload = renderFormattedPayloadDate(date.date); if (!formattedDatePayload) return null; const issueIdList = groupedIssueIds ? groupedIssueIds[formattedDatePayload] : null; const totalIssues = issueIdList?.length ?? 0; const isToday = date.date.toDateString() === new Date().toDateString(); const isSelectedDate = date.date.toDateString() == selectedDate.toDateString(); return ( <>
{/* header */}
{date.date.getDate() === 1 && MONTHS_LIST[date.date.getMonth() + 1].shortTitle + " "} {isToday ? ( {date.date.getDate()} ) : ( <>{date.date.getDate()} )}
{/* content */}
{(provided, snapshot) => (
{provided.placeholder}
)}
{/* Mobile view content */}
setSelectedDate(date.date)} className={cn( "text-sm py-2.5 h-full w-full font-medium mx-auto flex flex-col justify-start items-center md:hidden cursor-pointer", { "bg-custom-background-100": date.date.getDay() !== 0 && date.date.getDay() !== 6, } )} >
{date.date.getDate()}
{totalIssues > 0 &&
}
); });