...
 
Commits (2)
......@@ -10,5 +10,5 @@ your browser. Don't reload the page or you'll loose the data.
Based on [ReactJS](https://reactjs.org), [Redux](https://redux.js.org) and
[Material UI](https://material-ui.com).
Favicon from [PomPrint](https://openclipart.org/detail/167032/trilby-hat) on
Logo by [PomPrint](https://openclipart.org/detail/167032/trilby-hat) from
OpenClipArt.
......@@ -49,10 +49,11 @@ class TimerLimitEdit extends Component {
handleChange = (e) => {
let maxTime;
let value = e.target.value ? parseInt(e.target.value, 10) : 0;
if (e.target.name === "minutes") {
maxTime = parseInt(e.target.value, 10) * 60 + this.getSeconds();
maxTime = value * 60 + this.getSeconds();
} else if (e.target.name === "seconds") {
maxTime = this.getMinutes() * 60 + parseInt(e.target.value, 10);
maxTime = this.getMinutes() * 60 + value;
}
if (maxTime < 0) {
maxTime = 0;
......@@ -70,6 +71,8 @@ class TimerLimitEdit extends Component {
render() {
const { classes } = this.props;
const minutes = String(this.getMinutes());
const seconds = String(this.getSeconds()).padStart(2, "0");
return (
<div>
<Typography align="center" className={classes.buttonField}>
......@@ -78,8 +81,9 @@ class TimerLimitEdit extends Component {
size="small"
>
<Icon style={{marginRight: "0.3em"}}>alarm</Icon>
{` ${this.getMinutes()}:${String(this.getSeconds()).padStart(2, "0")} `}
max
{ (minutes === "0" && seconds === "00") ? "sans limite" :
` ${minutes}:${seconds} max`
}
</Button>
</Typography>
<Modal
......@@ -105,7 +109,7 @@ class TimerLimitEdit extends Component {
InputLabelProps={{
shrink: true,
}}
value={this.getMinutes()}
value={minutes}
onChange={this.handleChange}
/>
<TextField
......@@ -120,7 +124,7 @@ class TimerLimitEdit extends Component {
inputProps={{
step: 10,
}}
value={String(this.getSeconds()).padStart(2, "0")}
value={seconds}
onChange={this.handleChange}
/>
</div>
......