mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
5b0066140f
* 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>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { ProfileNavbar, ProfileSidebar } from "components/profile";
|
|
|
|
type Props = {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
showProfileIssuesFilter?: boolean;
|
|
};
|
|
|
|
const AUTHORIZED_ROLES = [20, 15, 10];
|
|
|
|
export const ProfileAuthWrapper: React.FC<Props> = observer((props) => {
|
|
const { children, className, showProfileIssuesFilter } = props;
|
|
|
|
const {
|
|
user: { currentWorkspaceRole },
|
|
} = useMobxStore();
|
|
|
|
if (!currentWorkspaceRole) return null;
|
|
|
|
const isAuthorized = AUTHORIZED_ROLES.includes(currentWorkspaceRole);
|
|
|
|
return (
|
|
<div className="h-full w-full md:flex md:flex-row-reverse md:overflow-hidden">
|
|
<ProfileSidebar />
|
|
<div className="flex w-full flex-col md:h-full md:overflow-hidden">
|
|
<ProfileNavbar isAuthorized={isAuthorized} showProfileIssuesFilter={showProfileIssuesFilter} />
|
|
{isAuthorized ? (
|
|
<div className={`w-full overflow-hidden md:h-full ${className}`}>{children}</div>
|
|
) : (
|
|
<div className="grid h-full w-full place-items-center text-custom-text-200">
|
|
You do not have the permission to access this page.
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|