diff --git a/client/cryps.css b/client/cryps.css index 3fa56ad2..e95eb617 100644 --- a/client/cryps.css +++ b/client/cryps.css @@ -377,47 +377,22 @@ header { box-shadow: inset -0.5em 0 0 0 forestgreen; } -progress { - /* Dimensions */ - width: 100%; - height: .25em; +.timer-container { + display: flex; + flex: 1 1 100%; + height: 0.25em; - /* Reset the apperance */ - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - - /* Get rid of the default border in Firefox/Opera. */ - border: none; - - /* For Firefox/IE10+ */ - background-color: transparent; - - /* For IE10+, color of the progress bar */ - color: forestgreen; - - margin: 0.5em 0; + border: none; + margin: 0.5em 0; } -progress::-webkit-progress-bar { - background-color: forestgreen; -} +.timer { + background: whitesmoke; + transition-property: all; + transition-duration: 0.5s; + transition-delay: 0; + transition-timing-function: ease; -.progress-container { - width: 100%; - background-color: transparent; - position: fixed; - top: 0; - left: 0; - height: .25em; - display: block; -} - -.progress-bar { - background-color: forestgreen; - width: 50%; - display: block; - height: inherit; } .instance-ui-btn { diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index 87c28153..5b84db3e 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -78,18 +78,6 @@ function GamePanel(props) { ); - const timerPct = (Date.parse(game.phase_start) + 1000 * 60 * 60) - Date.now(); - console.log(Date.now(), Date.parse(game.phase_start)); - console.log(timerPct); - - const timer = ( - - ); - function findCryp(id) { const team = game.players.find(t => t.cryps.find(c => c.id === id)); if (team) return team.cryps.find(c => c.id === id); @@ -97,9 +85,23 @@ function GamePanel(props) { } const otherTeams = game.players.filter(t => t.id !== account.id); - const playerTeam = game.players.find(t => t.id === account.id); + const zero = Date.parse(game.phase_end) - (1000 * 60); + const now = Date.now(); + const end = Date.parse(game.phase_end); + const timerPct = ((now - zero) / (end - zero) * 100); + const timerStyles = { + width: `${timerPct < 100 && !resolution ? timerPct : 0}%`, + background: playerTeam.ready ? 'forestgreen' : 'whitesmoke', + }; + + const timer = ( +