import { useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // contexts import { useProjectMyMembership, ProjectMemberProvider } from "contexts/project-member.context"; // layouts import AppHeader from "layouts/app-layout-legacy/app-header"; import AppSidebar from "layouts/app-layout-legacy/app-sidebar"; // components import { NotAuthorizedView, JoinProject } from "components/auth-screens"; import { CommandPalette } from "components/command-palette"; // ui import { Button, Spinner } from "@plane/ui"; import { EmptyState } from "components/common"; // icons import { LayerDiagonalIcon } from "components/icons"; // images import emptyProject from "public/empty-state/project.svg"; type Props = { children: React.ReactNode; noHeader?: boolean; bg?: "primary" | "secondary"; breadcrumbs?: JSX.Element; left?: JSX.Element; right?: JSX.Element; }; export const ProjectAuthorizationWrapper: React.FC = (props) => ( ); const ProjectAuthorizationWrapped: React.FC = ({ children, noHeader = false, bg = "primary", breadcrumbs, left, right, }) => { const [toggleSidebar, setToggleSidebar] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { loading, error, memberRole: memberType } = useProjectMyMembership(); const settingsLayout = router.pathname.includes("/settings"); return ( <>
{loading ? (

Loading your project...

) : error?.status === 401 || error?.status === 403 ? ( ) : error?.status === 404 ? (
{ const e = new KeyboardEvent("keydown", { key: "p", }); document.dispatchEvent(e); }, }} />
) : settingsLayout && (memberType?.isGuest || memberType?.isViewer) ? ( } type="project" /> ) : (
{children}
)}
); };