import { FC } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { Plus } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components import { PagesListItem } from "./list-item"; import { NewEmptyState } from "components/common/new-empty-state"; // ui import { Loader } from "@plane/ui"; // images import emptyPage from "public/empty-state/empty_page.png"; // types import { IPage } from "types"; // constants import { EUserWorkspaceRoles } from "constants/workspace"; type IPagesListView = { pages: IPage[]; }; export const PagesListView: FC = observer(({ pages }) => { // store const { user: { currentProjectRole }, commandPalette: { toggleCreatePageModal }, } = useMobxStore(); // router const router = useRouter(); const { workspaceSlug, projectId } = router.query; const canUserCreatePage = currentProjectRole && [EUserWorkspaceRoles.ADMIN, EUserWorkspaceRoles.MEMBER].includes(currentProjectRole); const emptyStatePrimaryButton = canUserCreatePage ? { primaryButton: { icon: , text: "Create your first page", onClick: () => toggleCreatePageModal(true), }, } : {}; return ( <> {pages && workspaceSlug && projectId ? (
{pages.length > 0 ? (
    {pages.map((page) => ( ))}
) : ( )}
) : ( )} ); });