plane/web/layouts/settings-layout/project/layout.tsx
sriram veeraghanta 8d15b9e7de
chore: format all files in monorepo (#3054)
* chore: format all files in the project

* fix: removing @types/react from dependencies

* fix: adding prettier and eslint config

* chore: format files

* fix: upgrading turbo version

* chore: ignoring warnings and adding todos

* fix: updated the type of bubble menu item in the document editor

* chore: format files

---------

Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
2023-12-10 15:48:10 +05:30

50 lines
1.4 KiB
TypeScript

import { FC, ReactNode } from "react";
import { useRouter } from "next/router";
// components
import { ProjectSettingsSidebar } from "./sidebar";
import { useMobxStore } from "lib/mobx/store-provider";
import { EUserWorkspaceRoles } from "constants/workspace";
import { NotAuthorizedView } from "components/auth-screens";
import { observer } from "mobx-react-lite";
import { Button, LayersIcon } from "@plane/ui";
export interface IProjectSettingLayout {
children: ReactNode;
}
export const ProjectSettingLayout: FC<IProjectSettingLayout> = observer((props) => {
const { children } = props;
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const {
user: { currentProjectRole },
} = useMobxStore();
const restrictViewSettings = currentProjectRole && currentProjectRole <= EUserWorkspaceRoles.VIEWER;
return restrictViewSettings ? (
<NotAuthorizedView
type="project"
actionButton={
<Button
variant="primary"
size="md"
prependIcon={<LayersIcon />}
onClick={() => router.push(`/${workspaceSlug}/projects/${projectId}/issues`)}
>
Go to issues
</Button>
}
/>
) : (
<div className="flex h-full w-full gap-2 overflow-x-hidden overflow-y-scroll">
<div className="w-80 flex-shrink-0 overflow-y-hidden pt-8">
<ProjectSettingsSidebar />
</div>
{children}
</div>
);
});