11// component
22import { Outlet } from "react-router" ;
3+ import { useSearchParams } from "next/navigation" ;
34import useSWR from "swr" ;
45import { AppHeader } from "@/components/core/app-header" ;
56import { ContentWrapper } from "@/components/core/content-wrapper" ;
@@ -8,12 +9,22 @@ import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";
89// local components
910import type { Route } from "./+types/layout" ;
1011import { PageDetailsHeader } from "./header" ;
12+ import type { TPageNavigationTabs } from "@plane/types" ;
13+
14+ const getPageType = ( pageType ?: string | null ) : TPageNavigationTabs => {
15+ if ( pageType === "private" ) return "private" ;
16+ if ( pageType === "archived" ) return "archived" ;
17+ return "public" ;
18+ } ;
1119
1220export default function ProjectPageDetailsLayout ( { params } : Route . ComponentProps ) {
1321 const { workspaceSlug, projectId } = params ;
1422 const { fetchPagesList } = usePageStore ( EPageStoreType . PROJECT ) ;
23+ const searchParams = useSearchParams ( ) ;
24+ const type = searchParams . get ( "type" ) ;
25+ const pageType = getPageType ( type ) ;
1526 // fetching pages list
16- useSWR ( `PROJECT_PAGES_${ projectId } ` , ( ) => fetchPagesList ( workspaceSlug , projectId , "public" ) ) ;
27+ useSWR ( `PROJECT_PAGES_${ projectId } ` , ( ) => fetchPagesList ( workspaceSlug , projectId , pageType ) ) ;
1728 return (
1829 < >
1930 < AppHeader header = { < PageDetailsHeader /> } />
0 commit comments