import { useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; // contexts import { useProjectMyMembership, ProjectMemberProvider } from "contexts/project-member.context"; // hooks import useIssuesView from "hooks/use-issues-view"; // layouts import Container from "layouts/container"; import AppHeader from "layouts/app-layout/app-header"; import AppSidebar from "layouts/app-layout/app-sidebar"; import SettingsNavbar from "layouts/settings-navbar"; import { WorkspaceAuthorizationLayout } from "./workspace-authorization-wrapper"; // components import { NotAuthorizedView, JoinProject } from "components/auth-screens"; import { CommandPalette } from "components/command-palette"; // ui import { PrimaryButton, Spinner } from "components/ui"; // icons import { LayerDiagonalIcon } from "components/icons"; type Meta = { title?: string | null; description?: string | null; image?: string | null; url?: string | null; }; type Props = { meta?: Meta; children: React.ReactNode; noPadding?: boolean; noHeader?: boolean; bg?: "primary" | "secondary"; breadcrumbs?: JSX.Element; left?: JSX.Element; right?: JSX.Element; }; export const ProjectAuthorizationWrapper: React.FC = (props) => ( ); const ProjectAuthorizationWrapped: React.FC = ({ meta, children, noPadding = false, noHeader = false, bg = "primary", breadcrumbs, left, right, }) => { const [toggleSidebar, setToggleSidebar] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { issueView } = useIssuesView(); 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 ? (

No such project exist. Create one?

{ const e = new KeyboardEvent("keydown", { key: "p" }); document.dispatchEvent(e); }} > Create project
) : settingsLayout && (memberType?.isGuest || memberType?.isViewer) ? ( Go to issues } type="project" /> ) : (
{!noHeader && ( )}
{settingsLayout && (

Project Settings

This information will be displayed to every member of the project.

)} {children}
)}
); };