plane/web/components/pages/list/block.tsx
Aaryan Khandelwal c2e293cf3b
[WEB-1310] chore: page title can be blank (#4486)
* chore: page title can be blank

* chore: handle undefined page name in the helper function
2024-05-17 12:56:44 +05:30

38 lines
1.0 KiB
TypeScript

import { FC, useRef } from "react";
import { observer } from "mobx-react";
// components
import { ListItem } from "@/components/core/list";
import { BlockItemAction } from "@/components/pages/list";
// helpers
import { getPageName } from "@/helpers/page.helper";
// hooks
import { usePage } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
type TPageListBlock = {
workspaceSlug: string;
projectId: string;
pageId: string;
};
export const PageListBlock: FC<TPageListBlock> = observer((props) => {
const { workspaceSlug, projectId, pageId } = props;
// refs
const parentRef = useRef(null);
// hooks
const { name } = usePage(pageId);
const { isMobile } = usePlatformOS();
return (
<ListItem
title={getPageName(name)}
itemLink={`/${workspaceSlug}/projects/${projectId}/pages/${pageId}`}
actionableItems={
<BlockItemAction workspaceSlug={workspaceSlug} projectId={projectId} pageId={pageId} parentRef={parentRef} />
}
isMobile={isMobile}
parentRef={parentRef}
/>
);
});