mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-30 15:16:39 +08:00
123 lines
3.3 KiB
JavaScript
123 lines
3.3 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
|
|
// material-ui
|
|
import { useTheme, styled } from '@mui/material/styles';
|
|
import { Box, Grid, Typography } from '@mui/material';
|
|
|
|
// third-party
|
|
import Chart from 'react-apexcharts';
|
|
|
|
// project imports
|
|
import MainCard from 'ui-component/cards/MainCard';
|
|
import SkeletonTotalOrderCard from 'ui-component/cards/Skeleton/EarningCard';
|
|
|
|
const CardWrapper = styled(MainCard)(({ theme }) => ({
|
|
backgroundColor: theme.palette.primary.dark,
|
|
color: '#fff',
|
|
overflow: 'hidden',
|
|
position: 'relative',
|
|
'&>div': {
|
|
position: 'relative',
|
|
zIndex: 5
|
|
},
|
|
'&:after': {
|
|
content: '""',
|
|
position: 'absolute',
|
|
width: 210,
|
|
height: 210,
|
|
background: theme.palette.primary[800],
|
|
borderRadius: '50%',
|
|
zIndex: 1,
|
|
top: -85,
|
|
right: -95,
|
|
[theme.breakpoints.down('sm')]: {
|
|
top: -105,
|
|
right: -140
|
|
}
|
|
},
|
|
'&:before': {
|
|
content: '""',
|
|
position: 'absolute',
|
|
zIndex: 1,
|
|
width: 210,
|
|
height: 210,
|
|
background: theme.palette.primary[800],
|
|
borderRadius: '50%',
|
|
top: -125,
|
|
right: -15,
|
|
opacity: 0.5,
|
|
[theme.breakpoints.down('sm')]: {
|
|
top: -155,
|
|
right: -70
|
|
}
|
|
}
|
|
}));
|
|
|
|
// ==============================|| DASHBOARD - TOTAL ORDER LINE CHART CARD ||============================== //
|
|
|
|
const StatisticalLineChartCard = ({ isLoading, title, chartData, todayValue }) => {
|
|
const theme = useTheme();
|
|
|
|
return (
|
|
<>
|
|
{isLoading ? (
|
|
<SkeletonTotalOrderCard />
|
|
) : (
|
|
<CardWrapper border={false} content={false}>
|
|
<Box sx={{ p: 2.25 }}>
|
|
<Grid>
|
|
<Grid item sx={{ mb: 0.75 }}>
|
|
<Grid container alignItems="center">
|
|
<Grid item xs={6}>
|
|
<Grid container alignItems="center">
|
|
<Grid item>
|
|
<Typography sx={{ fontSize: '2.125rem', fontWeight: 500, mr: 1, mt: 1.75, mb: 0.75 }}>
|
|
{todayValue || '0'}
|
|
</Typography>
|
|
</Grid>
|
|
<Grid item></Grid>
|
|
<Grid item xs={12}>
|
|
<Typography
|
|
sx={{
|
|
fontSize: '1rem',
|
|
fontWeight: 500,
|
|
color: theme.palette.primary[200]
|
|
}}
|
|
>
|
|
{title}
|
|
</Typography>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
<Grid item xs={6}>
|
|
{chartData ? (
|
|
<Chart {...chartData} />
|
|
) : (
|
|
<Typography
|
|
sx={{
|
|
fontSize: '1rem',
|
|
fontWeight: 500,
|
|
color: theme.palette.primary[200]
|
|
}}
|
|
>
|
|
无数据
|
|
</Typography>
|
|
)}
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</Box>
|
|
</CardWrapper>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
StatisticalLineChartCard.propTypes = {
|
|
isLoading: PropTypes.bool,
|
|
title: PropTypes.string
|
|
};
|
|
|
|
export default StatisticalLineChartCard;
|