forked from github/plane
4aad35e007
* refactor: store and helper setup for quick-add * refactor: kanban quick add with optimistic issue create * refactor: added function definition * refactor: list quick add with optimistic issue create * refactor: spreadsheet quick add with optimistic issue create * refactor: calender quick add with optimistic issue create * refactor: gantt quick add with optimistic issue create * refactor: input component and pre-loading data logic * style: calender quick-add height and content shift * feat: sub-group quick-add issue * feat: displaying loading state when issue is being created * fix: setting string null to null
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { CalendarDayTile } from "components/issues";
|
|
// helpers
|
|
import { renderDateFormat } from "helpers/date-time.helper";
|
|
// types
|
|
import { ICalendarDate, ICalendarWeek } from "./types";
|
|
import { IIssueGroupedStructure } from "store/issue";
|
|
import { IIssue } from "types";
|
|
|
|
type Props = {
|
|
issues: IIssueGroupedStructure | null;
|
|
week: ICalendarWeek | undefined;
|
|
quickActions: (issue: IIssue) => React.ReactNode;
|
|
enableQuickIssueCreate?: boolean;
|
|
};
|
|
|
|
export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
|
const { issues, week, quickActions, enableQuickIssueCreate } = props;
|
|
|
|
const { issueFilter: issueFilterStore } = useMobxStore();
|
|
|
|
const calendarLayout = issueFilterStore.userDisplayFilters.calendar?.layout ?? "month";
|
|
const showWeekends = issueFilterStore.userDisplayFilters.calendar?.show_weekends ?? false;
|
|
|
|
if (!week) return null;
|
|
|
|
return (
|
|
<div
|
|
className={`grid divide-x-[0.5px] divide-custom-border-200 ${showWeekends ? "grid-cols-7" : "grid-cols-5"} ${
|
|
calendarLayout === "month" ? "" : "h-full"
|
|
}`}
|
|
>
|
|
{Object.values(week).map((date: ICalendarDate) => {
|
|
if (!showWeekends && (date.date.getDay() === 0 || date.date.getDay() === 6)) return null;
|
|
|
|
return (
|
|
<CalendarDayTile
|
|
key={renderDateFormat(date.date)}
|
|
date={date}
|
|
issues={issues}
|
|
quickActions={quickActions}
|
|
enableQuickIssueCreate={enableQuickIssueCreate}
|
|
/>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
});
|