Add missing propTypes for eslint
This commit is contained in:
parent
141b0e6bfa
commit
2beb4d725f
18 changed files with 63 additions and 7 deletions
|
@ -1,7 +1,13 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Badge = (props) => (
|
||||
<span className={'badge badge--' + props.slug}>{props.title}</span>
|
||||
);
|
||||
|
||||
Badge.propTypes = {
|
||||
title: PropTypes.string.isRequired,
|
||||
slug: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Badge;
|
||||
|
|
|
@ -48,6 +48,7 @@ class ColumnHeader extends React.PureComponent {
|
|||
activeItem: PropTypes.string,
|
||||
activeSubItem: PropTypes.string,
|
||||
lists: ImmutablePropTypes.list,
|
||||
siteTitle: PropTypes.string,
|
||||
};
|
||||
|
||||
state = {
|
||||
|
|
|
@ -48,6 +48,7 @@ class GabSocialMount extends React.PureComponent {
|
|||
|
||||
static propTypes = {
|
||||
showIntroduction: PropTypes.bool,
|
||||
me: PropTypes.string,
|
||||
};
|
||||
|
||||
render () {
|
||||
|
|
|
@ -35,6 +35,8 @@ class ActionBar extends React.PureComponent {
|
|||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
size: PropTypes.number,
|
||||
onOpenHotkeys: PropTypes.func.isRequired,
|
||||
onClickLogOut: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
handleHotkeyClick = () => {
|
||||
|
|
|
@ -44,6 +44,9 @@ class Create extends React.PureComponent {
|
|||
intl: PropTypes.object.isRequired,
|
||||
onTitleChange: PropTypes.func.isRequired,
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
reset: PropTypes.func.isRequired,
|
||||
onDescriptionChange: PropTypes.func.isRequired,
|
||||
onCoverImageChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
|
|
|
@ -50,6 +50,9 @@ class Edit extends React.PureComponent {
|
|||
intl: PropTypes.object.isRequired,
|
||||
onTitleChange: PropTypes.func.isRequired,
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
onDescriptionChange: PropTypes.func.isRequired,
|
||||
onCoverImageChange: PropTypes.func.isRequired,
|
||||
setUp: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
componentWillMount(nextProps) {
|
||||
|
|
|
@ -53,6 +53,12 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
|
|||
this.props.dispatch(expandRemovedAccounts(this.props.params.id));
|
||||
}, 300, { leading: true });
|
||||
|
||||
handleOnActionClick = (group, id) => {
|
||||
return () => {
|
||||
this.props.dispatch(removeRemovedAccount(group.get('id'), id));
|
||||
};
|
||||
}
|
||||
|
||||
render () {
|
||||
const { accountIds, hasMore, group, intl } = this.props;
|
||||
|
||||
|
@ -76,7 +82,7 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
|
|||
key={id}
|
||||
id={id}
|
||||
actionIcon='remove'
|
||||
onActionClick={() => this.props.dispatch(removeRemovedAccount(group.get('id'), id))}
|
||||
onActionClick={this.handleOnActionClick(group, id)}
|
||||
actionTitle={intl.formatMessage(messages.remove)}
|
||||
/>))}
|
||||
</ScrollableList>
|
||||
|
|
|
@ -27,16 +27,20 @@ class Header extends ImmutablePureComponent {
|
|||
router: PropTypes.object,
|
||||
};
|
||||
|
||||
toggle = () => {
|
||||
const { group, relationships, toggleMembership } = this.props;
|
||||
toggleMembership(group, relationships);
|
||||
}
|
||||
|
||||
getActionButton() {
|
||||
const { group, relationships, toggleMembership, intl } = this.props;
|
||||
const toggle = () => toggleMembership(group, relationships);
|
||||
const { group, relationships, intl } = this.props;
|
||||
|
||||
if (!relationships) {
|
||||
return '';
|
||||
} else if (!relationships.get('member')) {
|
||||
return <Button className='logo-button' text={intl.formatMessage(messages.join)} onClick={toggle} />;
|
||||
return <Button className='logo-button' text={intl.formatMessage(messages.join)} onClick={this.toggle} />;
|
||||
} else if (relationships.get('member')) {
|
||||
return <Button className='logo-button' text={intl.formatMessage(messages.leave, { name: group.get('title') })} onClick={toggle} />;
|
||||
return <Button className='logo-button' text={intl.formatMessage(messages.leave, { name: group.get('title') })} onClick={this.toggle} />;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
@ -28,6 +28,7 @@ class HomeTimeline extends React.PureComponent {
|
|||
intl: PropTypes.object.isRequired,
|
||||
hasUnread: PropTypes.bool,
|
||||
isPartial: PropTypes.bool,
|
||||
siteTitle: PropTypes.string,
|
||||
};
|
||||
|
||||
handleLoadMore = maxId => {
|
||||
|
|
|
@ -42,6 +42,7 @@ class CommunityTimeline extends React.PureComponent {
|
|||
hasUnread: PropTypes.bool,
|
||||
onlyMedia: PropTypes.bool,
|
||||
timelineId: PropTypes.string,
|
||||
siteTitle: PropTypes.string,
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
|
|
|
@ -67,6 +67,7 @@ class ActionBar extends React.PureComponent {
|
|||
onEmbed: PropTypes.func,
|
||||
intl: PropTypes.object.isRequired,
|
||||
onOpenUnauthorizedModal: PropTypes.func.isRequired,
|
||||
me: PropTypes.string,
|
||||
};
|
||||
|
||||
handleReplyClick = () => {
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default
|
||||
class ExplanationBox extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||
explanation: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||
dismissable: PropTypes.bool,
|
||||
};
|
||||
|
||||
render() {
|
||||
const { title, explanation, dismissable } = this.props;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { invitesEnabled } from 'gabsocial/initial_state';
|
||||
|
@ -61,7 +62,9 @@ const LinkFooter = ({ onOpenHotkeys, account, onClickLogOut }) => (
|
|||
);
|
||||
|
||||
LinkFooter.propTypes = {
|
||||
withHotkeys: PropTypes.bool,
|
||||
account: ImmutablePropTypes.map,
|
||||
onOpenHotkeys: PropTypes.func.isRequired,
|
||||
onClickLogOut: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React from 'react';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import Icon from 'gabsocial/components/icon';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
@ -9,6 +10,10 @@ const mapStateToProps = state => ({
|
|||
export default @connect(mapStateToProps)
|
||||
class PromoPanel extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
promoItems: ImmutablePropTypes.list,
|
||||
}
|
||||
|
||||
render() {
|
||||
const { promoItems } = this.props;
|
||||
if (!promoItems) return null;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
|
||||
|
@ -33,4 +34,9 @@ const SignUpPanel = ({ siteTitle, me }) => {
|
|||
);
|
||||
};
|
||||
|
||||
SignUpPanel.propTypes = {
|
||||
siteTitle: PropTypes.string,
|
||||
me: PropTypes.string,
|
||||
};
|
||||
|
||||
export default injectIntl(connect(mapStateToProps)(SignUpPanel));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { Link, NavLink, withRouter } from 'react-router-dom';
|
||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
import { throttle } from 'lodash';
|
||||
|
@ -20,6 +21,8 @@ class TabsBar extends React.PureComponent {
|
|||
history: PropTypes.object.isRequired,
|
||||
onOpenCompose: PropTypes.func,
|
||||
onOpenSidebar: PropTypes.func.isRequired,
|
||||
logo: PropTypes.string,
|
||||
account: ImmutablePropTypes.map,
|
||||
}
|
||||
|
||||
state = {
|
||||
|
|
|
@ -256,6 +256,8 @@ class UI extends React.PureComponent {
|
|||
location: PropTypes.object,
|
||||
intl: PropTypes.object.isRequired,
|
||||
dropdownMenuIsOpen: PropTypes.bool,
|
||||
me: PropTypes.string,
|
||||
streamingUrl: PropTypes.string,
|
||||
};
|
||||
|
||||
state = {
|
||||
|
|
|
@ -22,6 +22,7 @@ class WrappedRoute extends React.Component {
|
|||
componentParams: PropTypes.object,
|
||||
layout: PropTypes.object,
|
||||
publicRoute: PropTypes.bool,
|
||||
me: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -74,7 +75,7 @@ class WrappedRoute extends React.Component {
|
|||
const { component: Component, content, publicRoute, me, ...rest } = this.props;
|
||||
|
||||
if (!publicRoute && me === false) {
|
||||
const actualUrl = encodeURIComponent(this.props.computedMatch.url);
|
||||
const actualUrl = encodeURIComponent(this.props.computedMatch.url); // eslint-disable-line react/prop-types
|
||||
return <Redirect to={`/auth/sign_in?redirect_uri=${actualUrl}`} />;
|
||||
// return <Route path={this.props.path} component={() => {
|
||||
// window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`;
|
||||
|
|
Loading…
Reference in a new issue