mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
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
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { CalendarHeader, CalendarWeekDays, CalendarWeekHeader } from "components/issues";
|
|
// ui
|
|
import { Spinner } from "@plane/ui";
|
|
// types
|
|
import { ICalendarWeek } from "./types";
|
|
import { IIssueGroupedStructure } from "store/issue";
|
|
import { IIssue } from "types";
|
|
|
|
type Props = {
|
|
issues: IIssueGroupedStructure | null;
|
|
layout: "month" | "week" | undefined;
|
|
showWeekends: boolean;
|
|
quickActions: (issue: IIssue) => React.ReactNode;
|
|
};
|
|
|
|
export const CalendarChart: React.FC<Props> = observer((props) => {
|
|
const { issues, layout, showWeekends, quickActions } = props;
|
|
|
|
const { calendar: calendarStore } = useMobxStore();
|
|
|
|
const calendarPayload = calendarStore.calendarPayload;
|
|
|
|
const allWeeksOfActiveMonth = calendarStore.allWeeksOfActiveMonth;
|
|
|
|
if (!calendarPayload)
|
|
return (
|
|
<div className="h-full w-full grid place-items-center">
|
|
<Spinner />
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<div className="h-full w-full flex flex-col overflow-hidden">
|
|
<CalendarHeader />
|
|
<CalendarWeekHeader isLoading={!issues} showWeekends={showWeekends} />
|
|
<div className="h-full w-full overflow-y-auto">
|
|
{layout === "month" && (
|
|
<div className="h-full w-full grid grid-cols-1 divide-y-[0.5px] divide-custom-border-200">
|
|
{allWeeksOfActiveMonth &&
|
|
Object.values(allWeeksOfActiveMonth).map((week: ICalendarWeek, weekIndex) => (
|
|
<CalendarWeekDays
|
|
key={weekIndex}
|
|
week={week}
|
|
issues={issues}
|
|
enableQuickIssueCreate
|
|
quickActions={quickActions}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
{layout === "week" && (
|
|
<CalendarWeekDays
|
|
week={calendarStore.allDaysOfActiveWeek}
|
|
issues={issues}
|
|
enableQuickIssueCreate
|
|
quickActions={quickActions}
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
});
|