2023-11-03 14:50:05 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useRouter } from "next/router";
|
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// mobx store
|
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
|
|
// components
|
|
|
|
import { ArchivedIssueListLayout, ArchivedIssueAppliedFiltersRoot } from "components/issues";
|
|
|
|
|
|
|
|
export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
|
|
|
|
const router = useRouter();
|
2023-12-16 19:05:53 +00:00
|
|
|
const { workspaceSlug, projectId } = router.query;
|
2023-11-03 14:50:05 +00:00
|
|
|
|
2023-11-27 08:45:33 +00:00
|
|
|
const {
|
|
|
|
projectArchivedIssues: { getIssues, fetchIssues },
|
|
|
|
projectArchivedIssuesFilter: { fetchFilters },
|
|
|
|
} = useMobxStore();
|
2023-11-03 14:50:05 +00:00
|
|
|
|
|
|
|
useSWR(workspaceSlug && projectId ? `ARCHIVED_FILTERS_AND_ISSUES_${projectId.toString()}` : null, async () => {
|
|
|
|
if (workspaceSlug && projectId) {
|
2023-12-16 19:05:53 +00:00
|
|
|
await fetchFilters(workspaceSlug.toString(), projectId.toString());
|
|
|
|
await fetchIssues(workspaceSlug.toString(), projectId.toString(), getIssues ? "mutation" : "init-loader");
|
2023-11-03 14:50:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
2023-11-03 14:50:05 +00:00
|
|
|
<ArchivedIssueAppliedFiltersRoot />
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="h-full w-full overflow-auto">
|
2023-11-03 14:50:05 +00:00
|
|
|
<ArchivedIssueListLayout />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|