Skip to content

Commit 55d6b93

Browse files
committed
Enhance dashboard layout
UI adjustments
1 parent 900447b commit 55d6b93

File tree

19 files changed

+335
-53
lines changed

19 files changed

+335
-53
lines changed

src/Dashboard/Dashboard.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import BasePageContainer from '../_common/BasePageContainer'
66
import BasePageToolbar from '../_common/BasePageToolbar'
77

88
import DashboardActions from './DashboardActions'
9+
import SubscriptionsHistory from './SubscriptionsHistory'
910
import KeyNumbers from './KeyNumbers'
10-
import Subscriptions from './Subscriptions'
11+
import SubscriptionsRecent from './SubscriptionsRecent'
12+
import SubscriptionsBreakdown from './SubscriptionsBreakdown'
1113

1214
const Dashboard = () => {
1315
return (
@@ -18,9 +20,11 @@ const Dashboard = () => {
1820
></BasePageToolbar>
1921
<Grid container spacing={3}>
2022
<Grid item xs={12}>
21-
<Subscriptions />
23+
<SubscriptionsHistory />
2224
</Grid>
2325
<KeyNumbers />
26+
<SubscriptionsRecent />
27+
<SubscriptionsBreakdown />
2428
</Grid>
2529
</BasePageContainer>
2630
)

src/Dashboard/Revenue/Revenue.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Dashboard/Revenue/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Dashboard/Sales/Sales.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Dashboard/Sales/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Dashboard/Subscriptions/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import {
4+
makeStyles,
5+
Grid,
6+
Card,
7+
CardHeader,
8+
CardContent,
9+
IconButton,
10+
} from '@material-ui/core'
11+
import { BarChart as IconBarChart, MoreVert as IconMoreVert } from '@material-ui/icons'
12+
import { Bar } from 'react-chartjs-2'
13+
14+
import { chart } from './data'
15+
16+
const SubscriptionsBreakdown = props => {
17+
const classes = useStyles()
18+
19+
return (
20+
<Grid item xs={12} sm={12} md={6} className={classes.card}>
21+
<Card>
22+
<CardHeader
23+
className={classes.cardHeader}
24+
avatar={<IconBarChart className={classes.headerIcon} />}
25+
action={
26+
<IconButton aria-label="settings" size="small">
27+
<IconMoreVert />
28+
</IconButton>
29+
}
30+
title="Subscriptions Breakdown"
31+
/>
32+
<CardContent className={classes.cardContent}>
33+
<div className={classes.chartContainer}>
34+
<div className={classes.chart}>
35+
<Bar data={chart.data} options={chart.options} />
36+
</div>
37+
</div>
38+
</CardContent>
39+
</Card>
40+
</Grid>
41+
)
42+
}
43+
44+
SubscriptionsBreakdown.propTypes = {}
45+
46+
const useStyles = makeStyles(theme => ({
47+
card: {
48+
height: '100%',
49+
},
50+
cardHeader: {
51+
borderBottom: '1px solid',
52+
borderBottomColor: theme.palette.divider,
53+
},
54+
cardBody: {
55+
overflow: 'hidden',
56+
},
57+
headerTitleBox: {},
58+
headerActionsBox: {
59+
textAlign: 'right',
60+
},
61+
headerIcon: {
62+
color: theme.palette.primary.main,
63+
verticalAlign: 'sub',
64+
marginRight: '.3em',
65+
},
66+
chartBox: {
67+
borderRight: '1px solid',
68+
borderRightColor: theme.palette.divider,
69+
},
70+
chartContainer: {
71+
width: '100%',
72+
position: 'relative',
73+
paddingBottom: '25%',
74+
minHeight: 240,
75+
},
76+
chart: {
77+
position: 'absolute',
78+
width: '100%',
79+
height: '100%',
80+
top: 0,
81+
left: 0,
82+
},
83+
cardContent: {
84+
height: '100%',
85+
'&:last-child': {
86+
paddingBottom: 'default',
87+
},
88+
},
89+
ratingBox: {
90+
display: 'flex',
91+
flexDirection: 'column',
92+
justifyContent: 'space-between',
93+
},
94+
ratingItemValueBox: {
95+
textAlign: 'right',
96+
fontSize: '0.7em',
97+
},
98+
ratingItemValue: {
99+
display: 'inline-block',
100+
},
101+
ratingItemRatio: {
102+
marginLeft: 4,
103+
display: 'inline-block',
104+
width: '3em',
105+
// fontSize: '1em',
106+
},
107+
}))
108+
109+
export default SubscriptionsBreakdown
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import theme from '../../_theme'
2+
3+
export const chart = {
4+
data: {
5+
datasets: [
6+
{
7+
backgroundColor: theme.palette.secondary.main,
8+
borderColor: theme.palette.secondary.main,
9+
borderWidth: 2,
10+
label: 'Customers',
11+
fill: false,
12+
data: [1545, 540, 749, 310, 56],
13+
yAxisID: 'y1',
14+
},
15+
{
16+
backgroundColor: 'rgba(136, 151, 170, 0.1)',
17+
borderColor: '#8897aa',
18+
borderDash: [5, 5],
19+
borderWidth: 1,
20+
data: [23686, 30820, 59622, 146465, 78160],
21+
label: 'Total Monthly Revenue, $',
22+
yAxisID: 'y2',
23+
},
24+
],
25+
labels: ['Trial', 'Starter', 'Pro', 'Silver', 'Gold'],
26+
},
27+
options: {
28+
scales: {
29+
xAxes: [
30+
{
31+
gridLines: { display: false },
32+
ticks: { fontColor: '#aaa', autoSkipPadding: 50 },
33+
},
34+
],
35+
yAxes: [
36+
{
37+
id: 'y1',
38+
gridLines: { display: false },
39+
ticks: { fontColor: '#aaa', maxTicksLimit: 5 },
40+
},
41+
{
42+
position: 'right',
43+
id: 'y2',
44+
gridLines: { display: false },
45+
ticks: { fontColor: '#aaa', maxTicksLimit: 5 },
46+
},
47+
],
48+
},
49+
tooltips: {
50+
mode: 'index',
51+
intersect: false,
52+
},
53+
hover: {
54+
mode: 'index',
55+
intersect: false,
56+
},
57+
responsive: true,
58+
maintainAspectRatio: false,
59+
},
60+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './SubscriptionsBreakdown'

0 commit comments

Comments
 (0)