@@ -11,6 +11,7 @@ import DashboardIcon from "@material-ui/icons/Dashboard";
11
11
import AssessmentIcon from '@material-ui/icons/Assessment' ;
12
12
import clsx from 'clsx' ;
13
13
import * as React from 'react' ;
14
+ import { Box , CircularProgress , CircularProgressProps , Typography } from "@material-ui/core" ;
14
15
15
16
const drawerWidth = 240 ;
16
17
@@ -48,15 +49,41 @@ const useStyles = makeStyles((theme) => ({
48
49
width : theme . spacing ( 9 ) ,
49
50
} ,
50
51
} ,
52
+ concurrencyBackground : {
53
+ backgroundColor : theme . palette . secondary . main ,
54
+ } ,
51
55
} ) ) ;
52
56
53
57
function ListItemLink ( props ) {
54
58
return < ListItem button component = "a" { ...props } /> ;
55
59
}
56
60
61
+ function CircularProgressWithLabel ( props : CircularProgressProps & { value : number } ) {
62
+ return (
63
+ < Box position = "relative" display = "inline-flex" >
64
+ < CircularProgress variant = "determinate" size = { 80 } { ...props } />
65
+ < Box
66
+ top = { 0 }
67
+ left = { 0 }
68
+ bottom = { 0 }
69
+ right = { 0 }
70
+ position = "absolute"
71
+ display = "flex"
72
+ alignItems = "center"
73
+ justifyContent = "center"
74
+ >
75
+ < Typography variant = "h4" component = "div" color = "textSecondary" > { `${ Math . round (
76
+ props . value ,
77
+ ) } %`} </ Typography >
78
+ </ Box >
79
+ </ Box >
80
+ ) ;
81
+ }
82
+
57
83
export default function NavBar ( props ) {
58
84
const classes = useStyles ( ) ;
59
- const open = props . open ;
85
+ const { open, maxSession, sessionCount} = props ;
86
+ const currentLoad = Math . min ( ( ( sessionCount / maxSession ) * 100 ) , 100 ) ;
60
87
61
88
return (
62
89
< Drawer
@@ -88,8 +115,34 @@ export default function NavBar(props) {
88
115
</ ListItemLink >
89
116
</ div >
90
117
</ List >
91
- { /*<Divider/>*/ }
92
- { /*<List>{secondaryListItems}</List>*/ }
118
+ < Box flexGrow = { 1 } />
119
+ < Box
120
+ p = { 2 }
121
+ m = { 2 }
122
+ className = { classes . concurrencyBackground }
123
+ >
124
+ < Typography
125
+ align = "center"
126
+ gutterBottom
127
+ variant = "h4"
128
+ >
129
+ Concurrency
130
+ </ Typography >
131
+ < Box
132
+ display = "flex"
133
+ justifyContent = "center"
134
+ mt = { 2 }
135
+ mb = { 2 }
136
+ >
137
+ < CircularProgressWithLabel value = { currentLoad } />
138
+ </ Box >
139
+ < Typography
140
+ align = "center"
141
+ variant = "h4"
142
+ >
143
+ { sessionCount } / { maxSession }
144
+ </ Typography >
145
+ </ Box >
93
146
</ Drawer >
94
147
) ;
95
148
}
0 commit comments