2023-09-01 11:12:30 +00:00
|
|
|
import { useEffect } from "react";
|
2023-08-11 11:48:33 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// components
|
|
|
|
import { IssueListHeader } from "components/issues/board-views/list/header";
|
|
|
|
import { IssueListBlock } from "components/issues/board-views/list/block";
|
|
|
|
// interfaces
|
2023-09-01 11:12:30 +00:00
|
|
|
import { IIssueState, IIssue } from "types/issue";
|
2023-08-11 11:48:33 +00:00
|
|
|
// mobx hook
|
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
2023-09-01 11:12:30 +00:00
|
|
|
// store
|
2023-08-11 11:48:33 +00:00
|
|
|
import { RootStore } from "store/root";
|
2023-09-01 11:12:30 +00:00
|
|
|
import { useRouter } from "next/router";
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
export const IssueListView = observer(() => {
|
2023-09-01 11:12:30 +00:00
|
|
|
const { issue: issueStore }: RootStore = useMobxStore();
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2023-09-01 11:12:30 +00:00
|
|
|
{issueStore?.states &&
|
|
|
|
issueStore?.states.length > 0 &&
|
|
|
|
issueStore?.states.map((_state: IIssueState) => (
|
|
|
|
<div key={_state.id} className="relative w-full">
|
2023-08-11 11:48:33 +00:00
|
|
|
<IssueListHeader state={_state} />
|
2023-09-01 11:12:30 +00:00
|
|
|
{issueStore.getFilteredIssuesByState(_state.id) &&
|
|
|
|
issueStore.getFilteredIssuesByState(_state.id).length > 0 ? (
|
|
|
|
<div className="divide-y divide-custom-border-200">
|
|
|
|
{issueStore.getFilteredIssuesByState(_state.id).map((_issue: IIssue) => (
|
|
|
|
<IssueListBlock key={_issue.id} issue={_issue} />
|
2023-08-11 11:48:33 +00:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
) : (
|
2023-09-01 11:12:30 +00:00
|
|
|
<div className="px-6 py-3.5 text-sm text-custom-text-200 bg-custom-background-100">
|
|
|
|
No Issues are available.
|
|
|
|
</div>
|
2023-08-11 11:48:33 +00:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
});
|