mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
43404bfcdf
* chore: issue store for kanban and calendar * chore: updated ui for kanba and swimlanes * chore: yarn.lock updated
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import React from "react";
|
|
// react beautiful dnd
|
|
import { DragDropContext } from "@hello-pangea/dnd";
|
|
// mobx
|
|
import { observer } from "mobx-react-lite";
|
|
// store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
import { RootStore } from "store/root";
|
|
import { KanBanSwimLanes } from "./swimlanes";
|
|
import { KanBan } from "./default";
|
|
|
|
export interface IKanBanLayout {
|
|
issues?: any;
|
|
handleIssues?: () => void;
|
|
handleDragDrop?: (result: any) => void;
|
|
}
|
|
|
|
export const KanBanLayout: React.FC<IKanBanLayout> = observer(({}) => {
|
|
const { issue: issueStore, issueFilter: issueFilterStore }: RootStore = useMobxStore();
|
|
const currentKanBanView: "swimlanes" | "default" = issueFilterStore?.userDisplayFilters?.sub_group_by
|
|
? "swimlanes"
|
|
: "default";
|
|
|
|
const issues = issueStore?.getIssues;
|
|
|
|
const onDragEnd = (result: any) => {
|
|
if (!result) return;
|
|
|
|
if (
|
|
result.destination &&
|
|
result.source &&
|
|
result.destination.droppableId === result.source.droppableId &&
|
|
result.destination.index === result.source.index
|
|
)
|
|
return;
|
|
|
|
console.log("result", result);
|
|
// issueKanBanViewStore?.handleDragDrop(result.source, result.destination);
|
|
};
|
|
|
|
return (
|
|
<div className={`relative min-w-full w-max min-h-full h-max bg-custom-background-90`}>
|
|
<DragDropContext onDragEnd={onDragEnd}>
|
|
{currentKanBanView === "default" ? <KanBan issues={issues} /> : <KanBanSwimLanes issues={issues} />}
|
|
</DragDropContext>
|
|
</div>
|
|
);
|
|
});
|