mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
3bf590b67e
* dev: calendar view init * chore: new render logic * chore: implement calendar view * chore: calendar view * refactor: calendar payload * chore: remove active month logic from backend * chore: setup new store for calendar * refactor: issues fetching structure * chore: months dropdown * chore: modify request query params for calendar layout * refactor: remove console logs and add comments
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
import { DragDropContext, DropResult } from "@hello-pangea/dnd";
|
|
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { CalendarChart } from "components/issues";
|
|
// types
|
|
import { IIssueGroupedStructure } from "store/issue";
|
|
|
|
export const CalendarLayout: React.FC = observer(() => {
|
|
const { issue: issueStore } = useMobxStore();
|
|
|
|
// TODO: add drag and drop functionality
|
|
const onDragEnd = (result: DropResult) => {
|
|
if (!result) return;
|
|
|
|
// return if not dropped on the correct place
|
|
if (!result.destination) return;
|
|
|
|
// return if dropped on the same date
|
|
if (result.destination.droppableId === result.source.droppableId) return;
|
|
|
|
// issueKanBanViewStore?.handleDragDrop(result.source, result.destination);
|
|
};
|
|
|
|
const issues = issueStore.getIssues;
|
|
|
|
return (
|
|
<div className="h-full w-full pt-4 bg-custom-background-100 overflow-hidden">
|
|
<DragDropContext onDragEnd={onDragEnd}>
|
|
<CalendarChart issues={issues as IIssueGroupedStructure | null} />
|
|
</DragDropContext>
|
|
</div>
|
|
);
|
|
});
|