plane/web/components/pages/list/root.tsx
Aaryan Khandelwal 7507cb0a0f
[WEB-994] fix: pages list mutation between projects (#4179)
* fix: pages list mutation between projects

* fix: page tab logic

* chore: remove pageType from the project pages store

* chore: rename computed helper functions
2024-04-15 12:50:22 +05:30

32 lines
1000 B
TypeScript

import { FC } from "react";
import { observer } from "mobx-react";
// types
import { TPageNavigationTabs } from "@plane/types";
// hooks
import { useProjectPages } from "@/hooks/store";
// components
import { PageListBlock } from "./";
type TPagesListRoot = {
pageType: TPageNavigationTabs;
projectId: string;
workspaceSlug: string;
};
export const PagesListRoot: FC<TPagesListRoot> = observer((props) => {
const { pageType, projectId, workspaceSlug } = props;
// store hooks
const { getCurrentProjectFilteredPageIds } = useProjectPages(projectId);
// derived values
const filteredPageIds = getCurrentProjectFilteredPageIds(pageType);
if (!filteredPageIds) return <></>;
return (
<div className="relative w-full h-full overflow-hidden overflow-y-auto divide-y-[0.5px] divide-custom-border-200">
{filteredPageIds.map((pageId) => (
<PageListBlock key={pageId} workspaceSlug={workspaceSlug} projectId={projectId} pageId={pageId} />
))}
</div>
);
});