mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
a2cdbd52dc
* add empty state if no pages are available. * set access to private in create page modal when the modal is open form private tab.
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 { isAnyPageAvailable, getAllPages } = useProjectPages();
|
|
// 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 */}
|
|
{isAnyPageAvailable && (
|
|
<PagesListHeaderRoot pageType={pageType} projectId={projectId} workspaceSlug={workspaceSlug} />
|
|
)}
|
|
<PagesListMainContent pageType={pageType}>{children}</PagesListMainContent>
|
|
</div>
|
|
);
|
|
});
|