added proptypes

This commit is contained in:
bill bittner 2018-01-12 15:02:42 -08:00
parent def4e03707
commit 9af50ed130
13 changed files with 105 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
import { connect } from 'react-redux';
@ -67,4 +68,9 @@ const mapStateToProps = state => {
};
};
ChannelSelector.propTypes = {
loggedInChannelName: PropTypes.string,
publishInChannel : PropTypes.bool,
};
export default connect(mapStateToProps, null)(ChannelSelector);

View file

@ -1,5 +1,5 @@
import React from 'react';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
class Preview extends React.Component {
constructor (props) {
@ -40,4 +40,10 @@ class Preview extends React.Component {
}
};
Preview.propTypes = {
file : PropTypes.object.isRequired,
thumbnail : PropTypes.string.isRequired,
dimPreview: PropTypes.bool.isRequired,
};
export default Preview;

View file

@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
function UrlMiddle ({publishInChannel, loggedInChannelName, loggedInChannelShortId}) {
if (publishInChannel) {
@ -13,4 +14,10 @@ function UrlMiddle ({publishInChannel, loggedInChannelName, loggedInChannelShort
);
}
UrlMiddle.propTypes = {
publishInChannel : PropTypes.bool.isRequired,
loggedInChannelName : PropTypes.string.isRequired,
loggedInChannelShortId: PropTypes.string.isRequired,
};
export default UrlMiddle;

View file

@ -1,6 +1,7 @@
import React from 'react';
import { setPublishInChannel } from '../actions/index';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
class AnonymousOrChannelSelect extends React.Component {
constructor (props) {
@ -45,4 +46,9 @@ const mapDispatchToProps = dispatch => {
};
}
AnonymousOrChannelSelect.propTypes = {
publishInChannel : PropTypes.bool.isRequired,
onPublishInChannelChange: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(AnonymousOrChannelSelect);

View file

@ -4,6 +4,7 @@ import {updateLoggedInChannel} from '../actions/index';
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
import { setUserCookies } from '../utils/cookies.js';
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
import PropTypes from 'prop-types';
class ChannelCreateForm extends React.Component {
constructor (props) {
@ -170,4 +171,8 @@ const mapDispatchToProps = dispatch => {
};
};
ChannelCreateForm.propTypes = {
onChannelLogin: PropTypes.func.isRequired,
};
export default connect(null, mapDispatchToProps)(ChannelCreateForm);

View file

@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { updateLoggedInChannel } from '../actions/index';
import { setUserCookies } from '../utils/cookies.js';
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
import PropTypes from 'prop-types';
class ChannelLoginForm extends React.Component {
constructor (props) {
@ -82,4 +83,8 @@ const mapDispatchToProps = dispatch => {
};
};
ChannelLoginForm.propTypes = {
onChannelLogin: PropTypes.func.isRequired,
};
export default connect(null, mapDispatchToProps)(ChannelLoginForm);

View file

@ -1,9 +1,9 @@
import React from 'react';
// import PropTypes from 'prop-types';
import { selectFile, updateError } from '../actions';
import { connect } from 'react-redux';
import Preview from '../components/Preview.jsx';
import { validateFile } from '../utils/file.js';
import PropTypes from 'prop-types';
class Dropzone extends React.Component {
constructor (props) {
@ -12,7 +12,7 @@ class Dropzone extends React.Component {
dragOver : false,
mouseOver : false,
dimPreview: false,
}
};
this.handleDrop = this.handleDrop.bind(this);
this.handleDragOver = this.handleDragOver.bind(this);
this.handleDragEnd = this.handleDragEnd.bind(this);
@ -157,6 +157,13 @@ const mapDispatchToProps = dispatch => {
dispatch(updateError('file', value));
},
};
}
};
Dropzone.propTypes = {
file : PropTypes.object,
thumbnail : PropTypes.string.isRequired,
fileError : PropTypes.string,
onFileError: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(Dropzone);

View file

@ -9,6 +9,7 @@ import AnonymousOrChannelSelect from './AnonymousOrChannelSelect.jsx';
import { connect } from 'react-redux';
import { getCookie } from '../utils/cookies.js';
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
import PropTypes from 'prop-types';
const LOAD_START = 'LOAD_START';
const LOADING = 'LOADING';
@ -230,4 +231,24 @@ const mapDispatchToProps = dispatch => {
};
};
PublishForm.propTypes = {
file : PropTypes.object.isRequired,
claim : PropTypes.string.isRequired,
title : PropTypes.string.isRequired,
thumbnail : PropTypes.string.isRequired,
description : PropTypes.string.isRequired,
license : PropTypes.string.isRequired,
nsfw : PropTypes.bool.isRequired,
loggedInChannel : PropTypes.object.isRequired,
publishInChannel : PropTypes.bool.isRequired,
fileError : PropTypes.string,
urlError : PropTypes.string,
publishRequestError : PropTypes.string,
onFileSelect : PropTypes.func.isRequired,
onFileClear : PropTypes.func.isRequired,
onChannelLogin : PropTypes.func.isRequired,
onPublishStatusChange: PropTypes.func.isRequired,
onPublishRequestError: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(PublishForm);

View file

@ -1,6 +1,7 @@
import React from 'react';
import { connect } from 'react-redux';
import { updateMetadata } from '../actions/index';
import PropTypes from 'prop-types';
/*
const textarea = document.getElementById('publish-description');
@ -101,4 +102,11 @@ const mapDispatchToProps = dispatch => {
};
};
MetadataInputs.propTypes = {
description : PropTypes.string.isRequired,
license : PropTypes.string.isRequired,
nsfw : PropTypes.bool.isRequired,
onMetadataChange: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(MetadataInputs);

View file

@ -1,6 +1,7 @@
import React from 'react';
import { connect } from 'react-redux';
import { updateMetadata } from '../actions/index';
import PropTypes from 'prop-types';
class ThumbnailInput extends React.Component {
constructor (props) {
@ -83,4 +84,9 @@ const mapDispatchToProps = dispatch => {
};
};
ThumbnailInput.propTypes = {
thumbnail : PropTypes.string.isRequired,
onThumbnailChange: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(ThumbnailInput);

View file

@ -1,6 +1,7 @@
import React from 'react';
import {updateMetadata} from '../actions/index';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
class TitleInput extends React.Component {
constructor (props) {
@ -34,4 +35,9 @@ const mapDispatchToProps = dispatch => {
};
}
TitleInput.propTypes = {
title : PropTypes.string.isRequired,
onMetadataChange: PropTypes.func.isRequired,
};
export default connect(mapStateToProps, mapDispatchToProps)(TitleInput);

View file

@ -3,6 +3,7 @@ import Dropzone from './Dropzone.jsx';
import PublishForm from './PublishForm.jsx';
import PublishStatus from '../components/PublishStatus.jsx';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
class PublishTool extends React.Component {
render () {
@ -31,4 +32,10 @@ const mapStateToProps = state => {
};
};
PublishTool.propTypes = {
file : PropTypes.object,
status : PropTypes.string,
message: PropTypes.string,
};
export default connect(mapStateToProps, null)(PublishTool);

View file

@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { makeGetRequest } from '../utils/xhr.js';
import UrlMiddle from '../components/PublishUrlMiddle.jsx';
import {updateError} from '../actions';
import PropTypes from 'prop-types';
class UrlChooser extends React.Component {
constructor (props) {
@ -101,6 +102,15 @@ const mapDispatchToProps = dispatch => {
dispatch(updateError('url', value));
},
};
}
};
UrlChooser.propTypes = {
fileName : PropTypes.string.isRequired,
loggedInChannelName : PropTypes.string.isRequired,
loggedInChannelShortId: PropTypes.string.isRequired,
publishInChannel : PropTypes.bool.isRequired,
claim : PropTypes.string.isRequired,
urlError : PropTypes.string,
};
export default connect(mapStateToProps, mapDispatchToProps)(UrlChooser);