'use strict'; import React from 'react'; import Router from 'react-router'; import { getLangText } from '../../utils/lang_utils'; let Link = Router.Link; let FileDragAndDropDialog = React.createClass({ propTypes: { hasFiles: React.PropTypes.bool, multipleFiles: React.PropTypes.bool, onClick: React.PropTypes.func, enableLocalHashing: React.PropTypes.bool }, mixins: [Router.State], render() { const queryParams = this.getQuery(); if(this.props.hasFiles) { return null; } else { if(this.props.enableLocalHashing && !queryParams.method) { let queryParamsHash = Object.assign({}, queryParams); queryParamsHash.method = 'hash'; let queryParamsUpload = Object.assign({}, queryParams); queryParamsUpload.method = 'upload'; return (

{getLangText('Would you rather')}

{getLangText('Hash your work')} or {getLangText('Upload and hash your work')}
); } else { if(this.props.multipleFiles) { return ( {getLangText('Click or drag to add files')} ); } else { let dialog = queryParams.method === 'hash' ? getLangText('choose a file to hash') : getLangText('choose a file to upload'); return (

{getLangText('Drag a file here')}

{getLangText('or')}

{dialog}
); } } } } }); export default FileDragAndDropDialog;