mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
061be85a5d
* fix: GET request changes * fix: filtering changes * feat: cycles and modules archive. * chore: disable fetching of cycle/ module details when clicked on the card in archives page. * chore: remove copy link button from archived modules/ cycles. * fix: archived cycle and module loading fliker issue. * chore: add validation to only archive completed cycles. * chore: add validation to only archive completed or cancelled module. * chore: archived issues/ cycles/ modules empty state update. --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
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,
|
|
ProjectArchivedEmptyState,
|
|
IssuePeekOverview,
|
|
} from "@/components/issues";
|
|
import { ListLayoutLoader } from "@/components/ui";
|
|
import { EIssuesStoreType } from "@/constants/issue";
|
|
// ui
|
|
import { useIssues } from "@/hooks/store";
|
|
|
|
export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
|
|
// router
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
// hooks
|
|
const { issues, 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());
|
|
await issues?.fetchIssues(
|
|
workspaceSlug.toString(),
|
|
projectId.toString(),
|
|
issues?.groupedIssueIds ? "mutation" : "init-loader"
|
|
);
|
|
}
|
|
},
|
|
{ revalidateIfStale: false, revalidateOnFocus: false }
|
|
);
|
|
|
|
if (issues?.loader === "init-loader" || !issues?.groupedIssueIds) {
|
|
return <ListLayoutLoader />;
|
|
}
|
|
|
|
if (!workspaceSlug || !projectId) return <></>;
|
|
return (
|
|
<>
|
|
<ArchivedIssueAppliedFiltersRoot />
|
|
{issues?.groupedIssueIds?.length === 0 ? (
|
|
<div className="relative h-full w-full overflow-y-auto">
|
|
<ProjectArchivedEmptyState />
|
|
</div>
|
|
) : (
|
|
<Fragment>
|
|
<div className="relative h-full w-full overflow-auto">
|
|
<ArchivedIssueListLayout />
|
|
</div>
|
|
<IssuePeekOverview is_archived />
|
|
</Fragment>
|
|
)}
|
|
</>
|
|
);
|
|
});
|