import Box from '@mui/material/Box'; import type { CardProps } from '@mui/material/Card'; import Card from '@mui/material/Card'; import Divider from '@mui/material/Divider'; import Stack from '@mui/material/Stack'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import type { ChartOptions } from 'src/components/chart'; import { Chart, useChart } from 'src/components/chart'; import { fNumber } from 'src/utils/format-number'; // ---------------------------------------------------------------------- type Props = CardProps & { chart: { colors?: string[]; series: { label: string; percent: number; total: number; }[]; options?: ChartOptions; }; }; export function BookingCheckInWidgets({ chart, sx, ...other }: Props) { const theme = useTheme(); const smUp = useMediaQuery(theme.breakpoints.up('sm')); const chartColors = chart.colors ?? [ [theme.palette.primary.light, theme.palette.primary.main], [theme.palette.warning.light, theme.palette.warning.main], ]; const chartOptions = useChart({ chart: { sparkline: { enabled: true } }, stroke: { width: 0 }, fill: { type: 'gradient', gradient: { colorStops: [ { offset: 0, color: chartColors[0][0], opacity: 1 }, { offset: 100, color: chartColors[0][1], opacity: 1 }, ], }, }, plotOptions: { radialBar: { dataLabels: { name: { show: false }, value: { offsetY: 6, fontSize: theme.typography.subtitle2.fontSize as string, fontWeight: theme.typography.subtitle2.fontWeight, }, }, }, }, ...chart.options, }); return ( } sx={{ flexDirection: { xs: 'column', sm: 'row' } }} > {chart.series.map((item) => (
{fNumber(item.total)} {item.label}
))}
); }