'use strict'; import React from 'react'; import UserStore from '../../stores/user_store'; import UserActions from '../../actions/user_actions'; import Form from './form'; import Property from './property'; import InputFineUploader from './input_fineuploader'; import ApiUrls from '../../constants/api_urls'; import AppConstants from '../../constants/application_constants'; import AscribeSpinner from '../ascribe_spinner'; import { getLangText } from '../../utils/lang_utils'; import { mergeOptions } from '../../utils/general_utils'; import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils'; let RegisterPieceForm = React.createClass({ propTypes: { headerMessage: React.PropTypes.string, submitMessage: React.PropTypes.string, handleSuccess: React.PropTypes.func, isFineUploaderActive: React.PropTypes.bool, isFineUploaderEditable: React.PropTypes.bool, enableLocalHashing: React.PropTypes.bool, children: React.PropTypes.element, onLoggedOut: React.PropTypes.func, // For this form to work with SlideContainer, we sometimes have to disable it disabled: React.PropTypes.bool, location: React.PropTypes.object }, getDefaultProps() { return { headerMessage: getLangText('Register your work'), submitMessage: getLangText('Register work'), enableLocalHashing: true }; }, getInitialState(){ return mergeOptions( { isUploadReady: false }, UserStore.getState() ); }, componentDidMount() { UserStore.listen(this.onChange); UserActions.fetchCurrentUser(); }, componentWillUnmount() { UserStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, setIsUploadReady(isReady) { this.setState({ isUploadReady: isReady }); }, render() { let currentUser = this.state.currentUser; let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false; enableLocalHashing = enableLocalHashing && this.props.enableLocalHashing; return (
); } }); export default RegisterPieceForm;