1- import {
2- faCaretDown ,
3- faCaretUp ,
4- faCrown ,
5- faGraduationCap ,
6- } from '@fortawesome/free-solid-svg-icons' ;
1+ import { faCaretDown , faCaretUp , faCrown } from '@fortawesome/free-solid-svg-icons' ;
72import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
83import { IconsComponent } from 'app/components/Leaderboard/IconElement' ;
94import * as styles from 'app/styles/Leaderboard.module.css' ;
@@ -115,7 +110,7 @@ export class LeaderboardElement extends React.Component<
115110 const ratingArray : number [ ] = [ ] ;
116111 const labelArray : string [ ] = [ ] ;
117112 player . rating . forEach ( ( element ) => {
118- ratingArray . push ( element . rating ) ;
113+ ratingArray . push ( Math . round ( ( element . rating + Number . EPSILON ) * 100 ) / 100 ) ;
119114 const dateobj = new Date ( element . validFrom ) ;
120115 labelArray . push ( dateobj . toLocaleDateString ( 'en-GB' ) . substr ( 0 , 5 ) ) ;
121116 } ) ;
@@ -249,63 +244,50 @@ export class LeaderboardElement extends React.Component<
249244 } }
250245 >
251246 < div style = { { display : 'flex' } } >
252- < div
253- className = { classnames ( 'text-light' , styles [ 'leader-score_title' ] ) }
254- style = { {
255- display : 'block' ,
256- fontSize : '16px' ,
257- whiteSpace : 'nowrap' ,
258- } }
259- title = { player . username }
260- >
261- < span style = { { fontFamily : 'Lato' } } > { `${ player . username . substr ( 0 , 15 ) } ${
262- player . username . length > 15 ? '...' : ''
263- } `} </ span >
264- </ div >
265- < div className = { classnames ( styles [ 'leader-flag' ] ) } >
266- < ReactCountryFlag
267- code = { player . country === 'null' ? player . country : 'USA' }
268- svg
269- alt = { player . country }
270- />
247+ < div className = "col-auto" >
248+ < div
249+ className = { classnames ( 'text-light' , styles [ 'leader-score_title' ] ) }
250+ style = { {
251+ display : 'block' ,
252+ fontSize : '16px' ,
253+ whiteSpace : 'nowrap' ,
254+ } }
255+ title = { player . username }
256+ >
257+ < span style = { { fontFamily : 'Lato' } } > { `${ player . username . substr ( 0 , 15 ) } ${
258+ player . username . length > 15 ? '...' : ''
259+ } `} </ span >
260+ </ div >
261+ < div className = { classnames ( styles [ 'leader-flag' ] , 'mt-2' ) } >
262+ < ReactCountryFlag
263+ code = { player . country === 'null' ? player . country : 'IN' }
264+ svg
265+ alt = { player . country }
266+ />
267+ </ div >
271268 </ div >
272269 </ div >
273- < div
274- className = { classnames ( styles [ 'leader-score_title' ] ) }
275- style = { {
276- color : 'gray' ,
277- display : 'block' ,
278- fontSize : '26px' ,
279- marginTop : '5px' ,
280- } }
281- >
282- { player . rating [ player . rating . length - 1 ] . rating } { ' ' }
283- { player . type === 'Student' ? (
284- < FontAwesomeIcon
285- style = { { fontSize : 18 , display : 'inline' } }
286- icon = { faGraduationCap }
287- title = { 'Student Participant' }
288- />
289- ) : null }
290- </ div >
291270 </ div >
292271 </ div >
293272 </ div >
294273
295274 < div className = { classnames ( styles [ 'player-info-2' ] ) } >
296275 { ! ( isPlayAgainstDisabled || currentUsername === player . username ) ? (
297- < div
298- style = { { fontSize : '0.55em' , cursor : 'pointer' } }
299- onClick = { async ( e ) => {
300- // hello
301- await updatePlayerId2 ( player . userId ) ;
302- await updateRequest ( Request . MANUAL ) ;
303- e . stopPropagation ( ) ;
304- } }
305- title = { `Start match` }
306- >
276+ < div style = { { fontSize : '0.55em' , cursor : 'pointer' } } title = { `Start match` } >
307277 { this . state . onHover ? (
308- < img src = "assets/img/fight.png" width = { 15 } height = { 15 } />
278+ < img
279+ src = "assets/img/fight.png"
280+ width = { 30 }
281+ height = { 30 }
282+ className = "mr-3"
283+ onClickCapture = { async ( e ) => {
284+ // hello
285+ e . stopPropagation ( ) ;
286+ await updatePlayerId2 ( player . userId ) ;
287+ await updateRequest ( Request . MANUAL ) ;
288+ this . props . getTimer ( ) ;
289+ } }
290+ />
309291 ) : null }
310292 </ div >
311293 ) : null }
@@ -323,38 +305,27 @@ export class LeaderboardElement extends React.Component<
323305 >
324306 { this . state . isModelOpen ? (
325307 < div
326- style = { { marginLeft : '-2% !important' , right : '0px !important ' } }
327- onClick = { ( event ) => {
328- event . stopPropagation ( ) ;
329- } }
330- >
331- < Chart
332- options = { this . state . optionsPie }
333- series = { [ player . ties , player . wins , player . losses ] }
334- type = "donut"
335- width = "380"
336- />
337- </ div >
338- ) : null }
339-
340- { this . state . isModelOpen ? (
341- < div
308+ className = "row justify-content-center"
342309 onClick = { ( event ) => {
343310 event . stopPropagation ( ) ;
344311 } }
345- style = { { transform : 'scaleX(0.7) translate(50px)' , marginLeft : '-20% !important' } }
346- className = { classnames (
347- styles [ 'apexcharts-canvas' ] ,
348- styles [ 'apexcharts-zoomable' ] ,
349- styles [ 'hovering-zoom' ] ,
350- ) }
351312 >
352- < Chart
353- options = { this . state . optionsLine }
354- series = { [ this . state . series ] }
355- type = "line"
356- width = "500"
357- />
313+ < div className = { classnames ( styles . chart_div , 'col col-lg-5' ) } >
314+ < Chart
315+ options = { this . state . optionsPie }
316+ series = { [ player . ties , player . wins , player . losses ] }
317+ type = "donut"
318+ width = "380"
319+ />
320+ </ div >
321+ < div className = { classnames ( styles . chart_div , 'col-lg-5' ) } >
322+ < Chart
323+ options = { this . state . optionsLine }
324+ series = { [ this . state . series ] }
325+ type = "line"
326+ width = "500"
327+ />
328+ </ div >
358329 </ div >
359330 ) : null }
360331 </ div >
0 commit comments