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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | import { Text } from "@common/Text";
import ChoroplethMap from "@components/ChoroplethMap";
import { CustomProgressbar } from "@components/CustomProgressbar";
import { Box, Grid, Skeleton } from "@mui/material";
import { useDashboardContext } from "../Provider/DashboardContext";
import { CustomerPeopleIcon } from "@assets/rebrandIcons";
import Figure from "@common/Figure";
import { palette } from "@palette";
import FadeUpWrapper from "@components/animation/FadeUpWrapper";
import { useThemeContext } from "@components/EnterpriseSettings/Branding/Provider/CustomThemeProvider";
function BottomSection() {
const { isLoading, data, start_date, end_date } = useDashboardContext();
const isNotEmpty = data?.top10Locations && data?.top10Locations?.length > 0;
const { gradient } = useThemeContext();
return (
<Grid mb={10} container spacing={2}>
<Grid item xs={12} md={8}>
<Title label="Customers" />
<ChoroplethMap
isLoading={isLoading}
start_date={start_date}
end_date={end_date}
data={data?.customersPerState}
/>
</Grid>
<Grid item xs={12} md={4}>
<FadeUpWrapper
containerProps={{
minWidth: "100%",
}}
delay={420}
customStyle={{
height: "418px",
}}
>
<>
<Title label="Top 10 Locations" />
{isLoading ? (
<>
{Array(10)
.fill(null)
.map((c, idx) => (
<Box
key={idx}
mb="30px"
width="100%"
justifyContent="space-between"
display="flex"
>
<Skeleton
variant="rectangular"
height="9px"
width="166px"
sx={{ borderRadius: "100px" }}
/>
<Skeleton
key={idx}
variant="rectangular"
height="9px"
width="32px"
sx={{ borderRadius: "12px" }}
/>
</Box>
))}
</>
) : (
<>
{isNotEmpty ? (
<>
{data?.top10Locations.map((c) => {
return <LabelValueComponent key={c.label} {...c} />;
})}
</>
) : (
<Box
width="100%"
justifyContent="center"
display="flex"
height="100%"
flexDirection="column"
alignItems="center"
>
<Box
display="flex"
alignItems="center"
justifyContent="center"
flexDirection="column"
>
<CustomerPeopleIcon gradient width={32} height={32} />
<Figure
color={gradient}
value="You do not have any customers yet"
fontSize={12}
fontWeight="book"
/>
</Box>
</Box>
)}
</>
)}
</>
</FadeUpWrapper>
</Grid>
</Grid>
);
}
export default BottomSection;
const LabelValueComponent = ({
label,
value,
rate,
}: {
label: string;
value: number | string;
rate: number;
}) => {
return (
<Box mb="12px">
<Box
width="100%"
alignItems="center"
justifyContent="space-between"
display="flex"
mb="8px"
>
<Text fontSize="14px" color={palette.neutral[80]} fontWeight="book">
{label}
</Text>
<Text color={palette.neutral[950]} fontWeight="book" fontSize="12px">
{value}
</Text>
</Box>
<CustomProgressbar targetProgress={Math.abs(rate)} />
</Box>
);
};
const Title = ({ label }: { label: string }) => (
<Text fontSize="18px" mb="16px" fontWeight="book" color={palette.neutral[80]}>
{label}
</Text>
);
|