diff --git a/front/src/routes/scene/SceneCard.jsx b/front/src/routes/scene/SceneCard.jsx index 8bd4830dee..5ac5e07e41 100644 --- a/front/src/routes/scene/SceneCard.jsx +++ b/front/src/routes/scene/SceneCard.jsx @@ -1,34 +1,49 @@ import { Text } from 'preact-i18n'; import { Component } from 'preact'; import { Link } from 'preact-router/match'; +import cx from 'classnames'; import style from './style.css'; class SceneCard extends Component { - startScene = () => { - this.props.startScene(this.props.scene.selector); + startScene = async () => { + try { + await this.setState({ saving: true }); + await this.props.httpClient.post(`/api/v1/scene/${this.props.scene.selector}/start`); + } catch (e) {} + // make sure the loader is displayed at least 200ms + setTimeout(() => this.setState({ saving: false }), 200); }; - render(props, {}) { + render(props, { saving }) { return (
-
-
- -
-

{props.scene.name}

-
{props.scene.description}
-
-