mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
7507cb0a0f
* fix: pages list mutation between projects * fix: page tab logic * chore: remove pageType from the project pages store * chore: rename computed helper functions
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
import useSWR from "swr";
|
|
import { TPageNavigationTabs } from "@plane/types";
|
|
// components
|
|
import { PagesListHeaderRoot, PagesListMainContent } from "@/components/pages";
|
|
// hooks
|
|
import { useProjectPages } from "@/hooks/store";
|
|
|
|
type TPageView = {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
pageType: TPageNavigationTabs;
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
export const PagesListView: React.FC<TPageView> = observer((props) => {
|
|
const { workspaceSlug, projectId, pageType, children } = props;
|
|
// store hooks
|
|
const { getAllPages } = useProjectPages(projectId);
|
|
// fetching pages list
|
|
useSWR(projectId ? `PROJECT_PAGES_${projectId}` : null, projectId ? () => getAllPages(pageType) : null);
|
|
|
|
// pages loader
|
|
return (
|
|
<div className="relative w-full h-full overflow-hidden flex flex-col">
|
|
{/* tab header */}
|
|
<PagesListHeaderRoot pageType={pageType} projectId={projectId} workspaceSlug={workspaceSlug} />
|
|
<PagesListMainContent pageType={pageType} projectId={projectId}>
|
|
{children}
|
|
</PagesListMainContent>
|
|
</div>
|
|
);
|
|
});
|