-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58910e8
commit 0aedbee
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
import { PhaseRaw } from "csgogsi-socket"; | ||
|
||
interface IProps { | ||
phase: PhaseRaw | null | ||
} | ||
|
||
export default class Pause extends React.Component<IProps> { | ||
render() { | ||
const { phase } = this.props; | ||
return ( | ||
<div id={`pause`} className={phase && phase.phase === "paused" ? 'show' : ''}> | ||
PAUSE | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
import { Map, PhaseRaw } from "csgogsi-socket"; | ||
|
||
function stringToClock(time: string | number, pad = true) { | ||
if (typeof time === "string") { | ||
time = parseFloat(time); | ||
} | ||
const countdown = Math.abs(Math.ceil(time)); | ||
const minutes = Math.floor(countdown / 60); | ||
const seconds = countdown - minutes * 60; | ||
if (pad && seconds < 10) { | ||
return `${minutes}:0${seconds}`; | ||
} | ||
return `${minutes}:${seconds}`; | ||
} | ||
|
||
interface IProps { | ||
phase: PhaseRaw | null, | ||
map: Map | ||
} | ||
|
||
export default class Timeout extends React.Component<IProps> { | ||
render() { | ||
const { phase, map } = this.props; | ||
const time = phase && Math.abs(Math.ceil(parseFloat(phase.phase_ends_in))); | ||
const team = phase && phase.phase === "timeout_t" ? map.team_t : map.team_ct; | ||
|
||
return ( | ||
<div id={`timeout`} className={`${time && time > 2 && phase && (phase.phase === "timeout_t" || phase.phase === "timeout_ct") ? 'show' : ''} ${phase && (phase.phase === "timeout_t" || phase.phase === "timeout_ct") ? phase.phase.substr(8): ''}`}> | ||
{ team.name } TIMEOUT | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters