2023-10-18 13:47:02 +00:00
|
|
|
import { FC, ReactNode } from "react";
|
|
|
|
// components
|
|
|
|
import { ProjectSettingsSidebar } from "./sidebar";
|
2023-12-04 14:33:23 +00:00
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
|
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
|
|
|
import { NotAuthorizedView } from "components/auth-screens";
|
|
|
|
import { observer } from "mobx-react-lite";
|
2023-10-18 13:47:02 +00:00
|
|
|
|
|
|
|
export interface IProjectSettingLayout {
|
|
|
|
children: ReactNode;
|
|
|
|
}
|
|
|
|
|
2023-12-04 14:33:23 +00:00
|
|
|
export const ProjectSettingLayout: FC<IProjectSettingLayout> = observer((props) => {
|
2023-10-25 10:18:57 +00:00
|
|
|
const { children } = props;
|
2023-10-18 13:47:02 +00:00
|
|
|
|
2023-12-04 14:33:23 +00:00
|
|
|
const {
|
|
|
|
user: { currentProjectRole },
|
|
|
|
} = useMobxStore();
|
|
|
|
|
|
|
|
const restrictViewSettings = currentProjectRole && currentProjectRole <= EUserWorkspaceRoles.VIEWER;
|
|
|
|
|
|
|
|
return restrictViewSettings ? (
|
|
|
|
<NotAuthorizedView type="project" />
|
|
|
|
) : (
|
2023-10-25 10:18:57 +00:00
|
|
|
<div className="flex gap-2 h-full w-full overflow-x-hidden overflow-y-scroll">
|
|
|
|
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
|
|
|
|
<ProjectSettingsSidebar />
|
|
|
|
</div>
|
|
|
|
{children}
|
|
|
|
</div>
|
2023-10-18 13:47:02 +00:00
|
|
|
);
|
2023-12-04 14:33:23 +00:00
|
|
|
});
|