Set standard height as iframe default height, validate form

This commit is contained in:
manubo
2019-09-30 22:18:43 +02:00
parent a8156226c2
commit f3484d3bfa
4 changed files with 12 additions and 12 deletions

View File

@@ -1,7 +1,6 @@
import React, { Component } from "react"
import PropTypes from "prop-types"
import Select from "components/Select"
import TimeInputParser from "utils/TimeInputParser"
import { formatDate } from "utils"
import cn from "classnames"
import stopWatch from "images/icons/stopwatch-light.svg"
@@ -39,15 +38,18 @@ class Form extends Component {
isValid() {
const { changeset } = this.props
return ["assignment_id", "task_id"].map(prop => changeset[prop]).every(Boolean)
return (
["assignment_id", "task_id"].map(prop => changeset[prop]).every(Boolean) &&
(changeset.date === formatDate(new Date()) || changeset.seconds > 0)
)
}
get isTimerStartable() {
const {
changeset: { hours, date },
changeset: { seconds, date },
} = this.props
const duration = new TimeInputParser(hours).parseSeconds()
return date === formatDate(new Date()) && duration === 0
return date === formatDate(new Date()) && seconds === 0
}
buttonStyle() {