plane/web/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx

46 lines
1.3 KiB
TypeScript
Raw Normal View History

import React, { Fragment } from "react";
import { observer } from "mobx-react-lite";
import { useRouter } from "next/router";
import useSWR from "swr";
// mobx store
// components
import {
ArchivedIssueListLayout,
ArchivedIssueAppliedFiltersRoot,
IssuePeekOverview,
2024-03-19 14:38:35 +00:00
} from "@/components/issues";
import { EIssuesStoreType } from "@/constants/issue";
// ui
2024-03-19 14:38:35 +00:00
import { useIssues } from "@/hooks/store";
export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
// router
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
// hooks
const { issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED);
useSWR(
workspaceSlug && projectId ? `ARCHIVED_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null,
async () => {
if (workspaceSlug && projectId) {
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString());
}
},
{ revalidateIfStale: false, revalidateOnFocus: false }
);
if (!workspaceSlug || !projectId) return <></>;
return (
<>
<ArchivedIssueAppliedFiltersRoot />
<Fragment>
<div className="relative h-full w-full overflow-auto">
<ArchivedIssueListLayout />
</div>
<IssuePeekOverview is_archived />
</Fragment>
</>
);
});