Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 60x 679x 23x 656x 2x 654x 60x | import React from "react";
import { Box, Stack, StackProps } from "@mui/material";
import { styled } from "@theme/v2/Provider";
import GiveText from "@shared/Text/GiveText";
import LoadingSpinner from "@components/Snipper/LoadingSpinner";
import { LockIcon } from "@phosphor-icons/react";
interface Props {
children: React.ReactElement | React.ReactElement[];
isLoading?: boolean;
sectionName: string;
notAuthorized: boolean;
wrapperProps?: StackProps;
}
export const GiveWithMissingPermissionModule = ({
children,
isLoading,
sectionName,
notAuthorized,
wrapperProps,
}: Props) => {
// If the consumer is not handling the loading
if (isLoading) {
return (
<LoadingSpinner
sx={{
height: "200px",
}}
/>
);
}
if (notAuthorized) {
return (
<Stack
alignItems="center"
textAlign="center"
marginTop="20%"
gap="20px"
{...wrapperProps}
>
<IconContainer>
<LockIcon size={24} />
</IconContainer>
<GiveText variant="bodyM" color="primary">
You don't have the right permission to access {sectionName}
</GiveText>
</Stack>
);
}
return <>{children}</>;
};
const IconContainer = styled(Box)(({ theme }) => ({
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "56px",
width: "56px",
borderRadius: "40px",
backgroundColor: theme.palette.primitive?.transparent["darken-5"],
}));
|