2024-05-14 20:55:38 +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 { IssueListBlock } from "@/components/issues/board-views/list/block";
|
|
|
|
import { IssueListHeader } from "@/components/issues/board-views/list/header";
|
2023-08-11 11:48:33 +00:00
|
|
|
// mobx hook
|
2024-05-14 08:56:54 +00:00
|
|
|
import { useIssue } from "@/hooks/store";
|
|
|
|
// types
|
|
|
|
import { IIssueState, IIssue } from "@/types/issue";
|
2023-08-11 11:48:33 +00:00
|
|
|
|
2024-05-14 08:56:54 +00:00
|
|
|
type IssueListViewProps = {
|
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssueListView: FC<IssueListViewProps> = observer((props) => {
|
|
|
|
const { workspaceSlug, projectId } = props;
|
|
|
|
// store hooks
|
|
|
|
const { states, getFilteredIssuesByState } = useIssue();
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2024-05-14 08:56:54 +00:00
|
|
|
{states &&
|
|
|
|
states.length > 0 &&
|
|
|
|
states.map((_state: IIssueState) => (
|
2023-09-01 11:12:30 +00:00
|
|
|
<div key={_state.id} className="relative w-full">
|
2023-08-11 11:48:33 +00:00
|
|
|
<IssueListHeader state={_state} />
|
2024-05-14 08:56:54 +00:00
|
|
|
{getFilteredIssuesByState(_state.id) && getFilteredIssuesByState(_state.id).length > 0 ? (
|
2023-09-01 11:12:30 +00:00
|
|
|
<div className="divide-y divide-custom-border-200">
|
2024-05-14 08:56:54 +00:00
|
|
|
{getFilteredIssuesByState(_state.id).map((_issue: IIssue) => (
|
|
|
|
<IssueListBlock key={_issue.id} issue={_issue} workspaceSlug={workspaceSlug} projectId={projectId} />
|
2023-08-11 11:48:33 +00:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
) : (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="bg-custom-background-100 p-3 text-sm text-custom-text-400">No issues.</div>
|
2023-08-11 11:48:33 +00:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
});
|