diff --git a/webclient/src/Classes.js b/webclient/src/Classes.js index 97dde37..d38b0ba 100644 --- a/webclient/src/Classes.js +++ b/webclient/src/Classes.js @@ -472,6 +472,7 @@ export function ClassDetail(props) { const [refreshCount, refreshClass] = useReducer(x => x + 1, 0); const [error, setError] = useState(false); const [loading, setLoading] = useState(false); + const [override, setOverride] = useState(false); const { token, user, refreshUser } = props; const { id } = useParams(); const userTraining = clazz && clazz.students.find(x => x.user == user.id); @@ -520,7 +521,8 @@ export function ClassDetail(props) { setLoading(false); }, [userTraining]); - // TODO: calculate yesterday and lock signups + const now = new Date().toISOString(); + const signupDisabled = clazz && clazz.datetime < now && !override; return ( @@ -631,9 +633,26 @@ export function ClassDetail(props) { ((clazz.max_students && clazz.student_count >= clazz.max_students) ?

The class is full.

: - + <> + {clazz.datetime < now && + <> +

This class has already ran.

+

+ setOverride(v.checked)} + /> +

+ + } + + + ) ) )