plane/apps/app/components/pages/my-pages-list.tsx
Aaryan Khandelwal 5d67029b5a
feat: pages (#533)
* style: page details

* style: page blocks design

* chore: pages list end points

* feat: add blocks, push blocks to issues

* feat: page labels, color options

* feat: added labels to pages

* fix: update page mutation
2023-03-25 23:39:46 +05:30

35 lines
870 B
TypeScript

import { useRouter } from "next/router";
import useSWR from "swr";
// services
import pagesService from "services/pages.service";
// components
import { PagesView } from "components/pages";
// types
import { TPageViewProps } from "types";
// fetch-keys
import { MY_PAGES_LIST } from "constants/fetch-keys";
type Props = {
viewType: TPageViewProps;
};
export const MyPagesList: React.FC<Props> = ({ viewType }) => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { data: pages } = useSWR(
workspaceSlug && projectId ? MY_PAGES_LIST(projectId as string) : null,
workspaceSlug && projectId
? () => pagesService.getMyPages(workspaceSlug as string, projectId as string)
: null
);
return (
<div className="mt-4 space-y-4">
<PagesView pages={pages} viewType={viewType} />
</div>
);
};