import React, { Component } from "react"; import PropTypes from "prop-types"; import configs from "../configs"; import PreviewDialog from "./PreviewDialog"; import StringInput from "../inputs/StringInput"; import BooleanInput from "../inputs/BooleanInput"; import FormField from "../inputs/FormField"; import { Trans, withTranslation } from "react-i18next"; /** * PublishDialog used to show the dialog when we are going to publish scene. * * @author Robert Long * @type {class component} */ export class PublishDialog extends Component<{t: Function}> { /** * Declairing propTypes for publishDialog component. * * @author Robert Long * @type {Object} */ static propTypes = { onCancel: PropTypes.func, screenshotUrl: PropTypes.string, onPublish: PropTypes.func, isPublished: PropTypes.bool, sceneUrl: PropTypes.string, initialSceneParams: PropTypes.object, t: PropTypes.func, }; //initializing state when object of class get invoked. constructor(props) { super(props); this.state = { name: "", ...props.initialSceneParams }; } //setting state when there is change in name. onChangeName = name => this.setState({ name }); //function to handle the confirmation of publishDialog onConfirm = () => { const publishState = { ...this.state } as any; publishState.name = publishState.name.trim(); (this.props as any).onPublish(publishState); }; // creating and rendering PreviewDialog view. render(){ const { onCancel, screenshotUrl } = this.props as any; const { name } = this.state as any; return ( { /* @ts-ignore */ } ); } } export default withTranslation()(PublishDialog);