chore: pages content update, empty state for recent pages (#637)

This commit is contained in:
Aaryan Khandelwal 2023-03-31 02:51:39 +05:30 committed by GitHub
parent 0c94b494ed
commit 65ddcb6d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 14 deletions

View File

@ -112,13 +112,13 @@ export const SingleList: React.FC<Props> = ({
<div className="flex items-center gap-x-3"> <div className="flex items-center gap-x-3">
{selectedGroup !== null && selectedGroup === "state" ? ( {selectedGroup !== null && selectedGroup === "state" ? (
<span> <span>
{currentState && getStateGroupIcon(currentState.group, "20", "20", bgColor)} {currentState && getStateGroupIcon(currentState.group, "16", "16", bgColor)}
</span> </span>
) : ( ) : (
"" ""
)} )}
{selectedGroup !== null ? ( {selectedGroup !== null ? (
<h2 className="text-xl font-semibold capitalize leading-6 text-gray-800"> <h2 className="text-base font-semibold capitalize leading-6 text-gray-800">
{getGroupTitle()} {getGroupTitle()}
</h2> </h2>
) : ( ) : (
@ -142,9 +142,9 @@ export const SingleList: React.FC<Props> = ({
) : ( ) : (
<CustomMenu <CustomMenu
customButton={ customButton={
<span className="flex items-center"> <div className="flex items-center cursor-pointer">
<PlusIcon className="h-4 w-4" /> <PlusIcon className="h-4 w-4" />
</span> </div>
} }
optionsPosition="right" optionsPosition="right"
noBorder noBorder

View File

@ -63,6 +63,8 @@ export const CreateUpdatePageModal: React.FC<Props> = ({ isOpen, handleClose, da
); );
onClose(); onClose();
router.push(`/${workspaceSlug}/projects/${projectId}/pages/${res.id}`);
setToastAlert({ setToastAlert({
type: "success", type: "success",
title: "Success!", title: "Success!",

View File

@ -9,7 +9,9 @@ import pagesService from "services/pages.service";
// components // components
import { PagesView } from "components/pages"; import { PagesView } from "components/pages";
// ui // ui
import { Loader } from "components/ui"; import { EmptyState, Loader } from "components/ui";
// images
import emptyPage from "public/empty-state/empty-page.svg";
// helpers // helpers
import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper"; import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper";
// types // types
@ -29,10 +31,12 @@ export const RecentPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
: null : null
); );
const isEmpty = pages && Object.keys(pages).every((key) => pages[key].length === 0);
return ( return (
<> <>
{pages ? ( {pages ? (
Object.keys(pages).length > 0 ? ( Object.keys(pages).length > 0 && !isEmpty ? (
<div className="mt-4 space-y-4"> <div className="mt-4 space-y-4">
{Object.keys(pages).map((key) => { {Object.keys(pages).map((key) => {
if (pages[key].length === 0) return null; if (pages[key].length === 0) return null;
@ -48,7 +52,14 @@ export const RecentPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
})} })}
</div> </div>
) : ( ) : (
<p className="mt-4 text-center">No issues found</p> <div className="mt-4">
<EmptyState
type="page"
title="Create New Page"
description="Create and document issues effortlessly in one place with Plane Notes, AI-powered for ease."
imgURL={emptyPage}
/>
</div>
) )
) : ( ) : (
<Loader className="mt-8 space-y-4"> <Loader className="mt-8 space-y-4">

View File

@ -210,8 +210,7 @@ export const PagesView: React.FC<Props> = ({ pages, viewType }) => {
<EmptyState <EmptyState
type="page" type="page"
title="Create New Page" title="Create New Page"
description="Sprint more effectively with Cycles by confining your project description="Create and document issues effortlessly in one place with Plane Notes, AI-powered for ease."
to a fixed amount of time. Create new cycle now."
imgURL={emptyPage} imgURL={emptyPage}
/> />
) )

View File

@ -27,7 +27,7 @@ import { RecentPagesList, CreateUpdatePageModal, TPagesListProps } from "compone
import { Input, PrimaryButton } from "components/ui"; import { Input, PrimaryButton } from "components/ui";
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
// icons // icons
import { ListBulletIcon, RectangleGroupIcon } from "@heroicons/react/20/solid"; import { ListBulletIcon, RectangleGroupIcon, Squares2X2Icon } from "@heroicons/react/20/solid";
// types // types
import { IPage, TPageViewProps, UserAuth } from "types"; import { IPage, TPageViewProps, UserAuth } from "types";
// fetch-keys // fetch-keys
@ -115,6 +115,7 @@ const ProjectPages: NextPage<UserAuth> = (props) => {
title: "Success!", title: "Success!",
message: "Page created successfully.", message: "Page created successfully.",
}); });
router.push(`/${workspaceSlug}/projects/${projectId}/pages/${res.id}`);
reset(); reset();
mutate(RECENT_PAGES_LIST(projectId as string)); mutate(RECENT_PAGES_LIST(projectId as string));
@ -222,7 +223,7 @@ const ProjectPages: NextPage<UserAuth> = (props) => {
> >
<ListBulletIcon className="h-4 w-4" /> <ListBulletIcon className="h-4 w-4" />
</button> </button>
{/* <button <button
type="button" type="button"
className={`grid h-7 w-7 place-items-center rounded p-1 outline-none duration-300 hover:bg-gray-200 ${ className={`grid h-7 w-7 place-items-center rounded p-1 outline-none duration-300 hover:bg-gray-200 ${
viewType === "detailed" ? "bg-gray-200" : "" viewType === "detailed" ? "bg-gray-200" : ""
@ -230,8 +231,8 @@ const ProjectPages: NextPage<UserAuth> = (props) => {
onClick={() => setViewType("detailed")} onClick={() => setViewType("detailed")}
> >
<Squares2X2Icon className="h-4 w-4" /> <Squares2X2Icon className="h-4 w-4" />
</button> */} </button>
<button {/* <button
type="button" type="button"
className={`grid h-7 w-7 place-items-center rounded p-1 outline-none duration-300 hover:bg-gray-200 ${ className={`grid h-7 w-7 place-items-center rounded p-1 outline-none duration-300 hover:bg-gray-200 ${
viewType === "masonry" ? "bg-gray-200" : "" viewType === "masonry" ? "bg-gray-200" : ""
@ -239,7 +240,7 @@ const ProjectPages: NextPage<UserAuth> = (props) => {
onClick={() => setViewType("masonry")} onClick={() => setViewType("masonry")}
> >
<RectangleGroupIcon className="h-4 w-4" /> <RectangleGroupIcon className="h-4 w-4" />
</button> </button> */}
</div> </div>
</Tab.List> </Tab.List>
<Tab.Panels> <Tab.Panels>