2023-08-11 11:48:33 +00:00
|
|
|
"use client";
|
|
|
|
|
2024-05-14 08:56:54 +00:00
|
|
|
import { FC } from "react";
|
2023-08-11 11:48:33 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// components
|
2024-03-19 14:38:35 +00:00
|
|
|
import { IssueKanBanBlock } from "@/components/issues/board-views/kanban/block";
|
|
|
|
import { IssueKanBanHeader } from "@/components/issues/board-views/kanban/header";
|
2023-09-01 11:51:52 +00:00
|
|
|
// ui
|
2024-03-19 14:38:35 +00:00
|
|
|
import { Icon } from "@/components/ui";
|
2023-08-11 11:48:33 +00:00
|
|
|
// mobx hook
|
2024-05-14 08:56:54 +00:00
|
|
|
import { useIssue } from "@/hooks/store";
|
|
|
|
// interfaces
|
|
|
|
import { IIssueState, IIssue } from "@/types/issue";
|
|
|
|
|
|
|
|
type IssueKanbanViewProps = {
|
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
|
|
|
};
|
2023-08-11 11:48:33 +00:00
|
|
|
|
2024-05-14 08:56:54 +00:00
|
|
|
export const IssueKanbanView: FC<IssueKanbanViewProps> = observer((props) => {
|
|
|
|
const { workspaceSlug, projectId } = props;
|
|
|
|
// store hooks
|
|
|
|
const { states, getFilteredIssuesByState } = useIssue();
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
return (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="relative flex h-full w-full gap-3 overflow-hidden overflow-x-auto">
|
2024-05-14 08:56:54 +00:00
|
|
|
{states &&
|
|
|
|
states.length > 0 &&
|
|
|
|
states.map((_state: IIssueState) => (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div key={_state.id} className="relative flex h-full w-[340px] flex-shrink-0 flex-col">
|
2023-08-11 11:48:33 +00:00
|
|
|
<div className="flex-shrink-0">
|
2023-12-05 11:56:57 +00:00
|
|
|
<IssueKanBanHeader state={_state} />
|
2023-08-11 11:48:33 +00:00
|
|
|
</div>
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="hide-vertical-scrollbar h-full w-full overflow-hidden overflow-y-auto">
|
2024-05-14 08:56:54 +00:00
|
|
|
{getFilteredIssuesByState(_state.id) && getFilteredIssuesByState(_state.id).length > 0 ? (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="space-y-3 px-2 pb-2">
|
2024-05-14 08:56:54 +00:00
|
|
|
{getFilteredIssuesByState(_state.id).map((_issue: IIssue) => (
|
|
|
|
<IssueKanBanBlock
|
|
|
|
key={_issue.id}
|
|
|
|
issue={_issue}
|
|
|
|
workspaceSlug={workspaceSlug}
|
|
|
|
projectId={projectId}
|
|
|
|
params={{}}
|
|
|
|
/>
|
2023-08-11 11:48:33 +00:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
) : (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="flex items-center justify-center gap-2 pt-10 text-center text-sm font-medium text-custom-text-200">
|
2023-09-01 11:51:52 +00:00
|
|
|
<Icon iconName="stack" />
|
|
|
|
No issues in this state
|
2023-08-11 11:48:33 +00:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|