forked from github/plane
[WEB-1236] chore: add Create page
button to public/ private page empty state. (#4401)
This commit is contained in:
parent
6efa135e9e
commit
10efd8d1d9
@ -8,7 +8,7 @@ import { PageLoader } from "@/components/pages";
|
||||
// constants
|
||||
import { EmptyStateType } from "@/constants/empty-state";
|
||||
// hooks
|
||||
import { useProjectPages } from "@/hooks/store";
|
||||
import { useApplication, useProjectPages } from "@/hooks/store";
|
||||
// assets
|
||||
import AllFiltersImage from "public/empty-state/pages/all-filters.svg";
|
||||
import NameFilterImage from "public/empty-state/pages/name-filter.svg";
|
||||
@ -23,6 +23,7 @@ export const PagesListMainContent: React.FC<Props> = observer((props) => {
|
||||
const { children, pageType, projectId } = props;
|
||||
// store hooks
|
||||
const { loader, getCurrentProjectFilteredPageIds, getCurrentProjectPageIds, filters } = useProjectPages(projectId);
|
||||
const { commandPalette: commandPaletteStore } = useApplication();
|
||||
// derived values
|
||||
const pageIds = getCurrentProjectPageIds(pageType);
|
||||
const filteredPageIds = getCurrentProjectFilteredPageIds(pageType);
|
||||
@ -30,8 +31,24 @@ export const PagesListMainContent: React.FC<Props> = observer((props) => {
|
||||
if (loader === "init-loader") return <PageLoader />;
|
||||
// if no pages exist in the active page type
|
||||
if (pageIds?.length === 0) {
|
||||
if (pageType === "public") return <EmptyState type={EmptyStateType.PROJECT_PAGE_PUBLIC} />;
|
||||
if (pageType === "private") return <EmptyState type={EmptyStateType.PROJECT_PAGE_PRIVATE} />;
|
||||
if (pageType === "public")
|
||||
return (
|
||||
<EmptyState
|
||||
type={EmptyStateType.PROJECT_PAGE_PUBLIC}
|
||||
primaryButtonOnClick={() => {
|
||||
commandPaletteStore.toggleCreatePageModal(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
if (pageType === "private")
|
||||
return (
|
||||
<EmptyState
|
||||
type={EmptyStateType.PROJECT_PAGE_PRIVATE}
|
||||
primaryButtonOnClick={() => {
|
||||
commandPaletteStore.toggleCreatePageModal(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
if (pageType === "archived") return <EmptyState type={EmptyStateType.PROJECT_PAGE_ARCHIVED} />;
|
||||
}
|
||||
// if no pages match the filter criteria
|
||||
|
@ -500,12 +500,22 @@ const emptyStateDetails = {
|
||||
title: "No private pages yet",
|
||||
description: "Keep your private thoughts here. When you're ready to share, the team's just a click away.",
|
||||
path: "/empty-state/pages/private",
|
||||
primaryButton: {
|
||||
text: "Create your first page",
|
||||
},
|
||||
accessType: "project",
|
||||
access: EUserProjectRoles.MEMBER,
|
||||
},
|
||||
[EmptyStateType.PROJECT_PAGE_PUBLIC]: {
|
||||
key: EmptyStateType.PROJECT_PAGE_PUBLIC,
|
||||
title: "No public pages yet",
|
||||
description: "See pages shared with everyone in your project right here.",
|
||||
path: "/empty-state/pages/public",
|
||||
primaryButton: {
|
||||
text: "Create your first page",
|
||||
},
|
||||
accessType: "project",
|
||||
access: EUserProjectRoles.MEMBER,
|
||||
},
|
||||
[EmptyStateType.PROJECT_PAGE_ARCHIVED]: {
|
||||
key: EmptyStateType.PROJECT_PAGE_ARCHIVED,
|
||||
|
Loading…
Reference in New Issue
Block a user