Updates for missing vars in components

This commit is contained in:
mgabdev 2020-01-27 14:46:42 -05:00
parent a2b5d72e08
commit 6c8eea5160
15 changed files with 49 additions and 37 deletions

View File

@ -64,9 +64,7 @@ class Account extends ImmutablePureComponent {
render() { render() {
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, displayOnly } = this.props; const { account, intl, hidden, onActionClick, actionIcon, actionTitle, displayOnly } = this.props;
if (!account) { if (!account) return null;
return <div />;
}
if (hidden) { if (hidden) {
return ( return (

View File

@ -9,12 +9,12 @@ export default class ColumnHeaderSettingButton extends PureComponent {
static propTypes = { static propTypes = {
title: PropTypes.node.isRequired, title: PropTypes.node.isRequired,
icon: PropTypes.string.isRequired, icon: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func,
to: PropTypes.string, to: PropTypes.string,
}; };
render () { render () {
const { title, icon, to } = this.props; const { title, icon, to, onClick } = this.props;
const classes = classNames('column-header-setting-btn', { const classes = classNames('column-header-setting-btn', {
'column-header-setting-btn--link': !!to 'column-header-setting-btn--link': !!to
@ -30,7 +30,7 @@ export default class ColumnHeaderSettingButton extends PureComponent {
} }
return ( return (
<button className={classes} tabIndex='0' onClick={this.props.onClick}> <button className={classes} tabIndex='0' onClick={onClick}>
<Icon id={icon} /> <Icon id={icon} />
{title} {title}
</button> </button>

View File

@ -3,6 +3,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { openModal } from '../../../actions/modal'; import { openModal } from '../../../actions/modal';
import { cancelReplyCompose } from '../../../actions/compose'; import { cancelReplyCompose } from '../../../actions/compose';
import ModalLayout from '../modal_layout'; import ModalLayout from '../modal_layout';
import TimelineComposeBlock from '../../timeline_compose_block';
const messages = defineMessages({ const messages = defineMessages({
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@ -46,7 +47,7 @@ class ComposeModal extends ImmutablePureComponent {
const { intl } = this.props; const { intl } = this.props;
return ( return (
<ModalLayout title={intl.formatMessage(messages.title)} onClose={onClickClose}> <ModalLayout title={intl.formatMessage(messages.title)} onClose={this.onClickClose}>
<TimelineComposeBlock /> <TimelineComposeBlock />
</ModalLayout> </ModalLayout>
); );

View File

@ -16,7 +16,7 @@ class ModalLayout extends PureComponent {
}; };
render() { render() {
const { title, children } = this.props; const { title, children, intl, onClose } = this.props;
return ( return (
<div className='modal modal--layout modal--root'> <div className='modal modal--layout modal--root'>

View File

@ -8,7 +8,7 @@ class SectionHeadlineBarItem extends PureComponent {
icon: PropTypes.string, icon: PropTypes.string,
className: PropTypes.string, className: PropTypes.string,
onClick: PropTypes.func, onClick: PropTypes.func,
title: PropTypes.oneOf([ title: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
PropTypes.node, PropTypes.node,
]), ]),
@ -21,14 +21,20 @@ class SectionHeadlineBarItem extends PureComponent {
const classes = classNames('section-header-bar__item', className); const classes = classNames('section-header-bar__item', className);
if (to) { if (to) {
return (<NavLink className={classes} exact={exact} to={to}>{title}</NavLink>); return (
<NavLink className={classes} exact={exact} to={to}>{title}</NavLink>
)
} else if (icon) { } else if (icon) {
<button className={classes} onClick={onClick} title={title}> return (
<Icon id={icon} fixedWidth /> <button className={classes} onClick={onClick} title={title}>
</button> <Icon id={icon} fixedWidth />
</button>
)
} }
return (<button className={classes} onClick={onClick}>{title}</button>) return (
<button className={classes} onClick={onClick}>{title}</button>
)
} }
}; };
@ -46,8 +52,8 @@ export default class SectionHeadlineBar extends PureComponent {
return ( return (
<div className={classes}> <div className={classes}>
{ {
items.forEach(item, i => ( items.forEach((item, i) => (
<SectionHeadlineBarItem key={`shbi-{i}`} {...item} /> <SectionHeadlineBarItem key={`shbi-${i}`} {...item} />
)) ))
} }
</div> </div>

View File

@ -14,6 +14,8 @@ export default class TrendingItem extends ImmutablePureComponent {
}; };
render() { render() {
const { hashtag } = this.props;
return ( return (
<div className='trending-item'> <div className='trending-item'>
<div className='trending-item__text'> <div className='trending-item__text'>

View File

@ -157,7 +157,7 @@ class AccountGallery extends ImmutablePureComponent {
} }
render () { render () {
const { attachments, isLoading, hasMore, isAccount, accountId, unavailable, accountUsername } = this.props; const { attachments, isLoading, hasMore, isAccount, accountId, unavailable, accountUsername, intl } = this.props;
const { width } = this.state; const { width } = this.state;
if (!isAccount && accountId !== -1) { if (!isAccount && accountId !== -1) {

View File

@ -6,6 +6,8 @@ import classNames from 'classnames';
import { decode } from 'blurhash'; import { decode } from 'blurhash';
import { isIOS } from 'gabsocial/utils/is_mobile'; import { isIOS } from 'gabsocial/utils/is_mobile';
import './media_item.scss';
export default class MediaItem extends ImmutablePureComponent { export default class MediaItem extends ImmutablePureComponent {
static propTypes = { static propTypes = {

View File

@ -17,9 +17,11 @@ export default class CharacterCounter extends PureComponent {
'character-counter--over': (diff < 0), 'character-counter--over': (diff < 0),
}); });
<div className='character-counter__wrapper'> return (
<span className={classes}>{diff}</span> <div className='character-counter__wrapper'>
</div> <span className={classes}>{diff}</span>
</div>
)
} }
} }

View File

@ -50,7 +50,7 @@ class ComposeSearch extends PureComponent {
} }
render () { render () {
const { intl, value, onShow, ...rest } = this.props; const { intl, value, onShow, openInRoute } = this.props;
return ( return (
<Search <Search
@ -61,7 +61,7 @@ class ComposeSearch extends PureComponent {
handleClear={this.handleClear} handleClear={this.handleClear}
onShow={onShow} onShow={onShow}
withOverlay withOverlay
{...rest} openInRoute
/> />
) )
} }

View File

@ -43,7 +43,6 @@ const mapStateToProps = (state, { params: { username } }) => {
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl
class Following extends ImmutablePureComponent { class Following extends ImmutablePureComponent {
static propTypes = { static propTypes = {

View File

@ -48,7 +48,7 @@ class ListEditorSearch extends PureComponent {
} }
render () { render () {
const { value, intl, ...rest } = this.props; const { value, intl } = this.props;
return ( return (
<Search <Search
@ -60,7 +60,6 @@ class ListEditorSearch extends PureComponent {
handleSubmit={this.handleSubmit} handleSubmit={this.handleSubmit}
handleClear={this.handleClear} handleClear={this.handleClear}
searchTitle={intl.formatMessage(messages.searchTitle)} searchTitle={intl.formatMessage(messages.searchTitle)}
{...rest}
/> />
) )
} }

View File

@ -1,7 +1,7 @@
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import SectionHeadlineBar from '../../../../components/section_headline_bar'; import SectionHeadlineBar from '../../../../components/section_headline_bar';
const tooltips = defineMessages({ const messages = defineMessages({
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favorites' }, favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favorites' },
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Reposts' }, boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Reposts' },
@ -58,33 +58,33 @@ class NotificationFilterBar extends PureComponent {
{ {
className: selectedFilter === 'mention' ? 'active' : '', className: selectedFilter === 'mention' ? 'active' : '',
onClick: this.onClick('mention'), onClick: this.onClick('mention'),
title: intl.formatMessage(tooltips.mentions), title: intl.formatMessage(messages.mentions),
icon: 'at', icon: 'at',
}, },
{ {
className: selectedFilter === 'favourite' ? 'active' : '', className: selectedFilter === 'favourite' ? 'active' : '',
onClick: this.onClick('favourite'), onClick: this.onClick('favourite'),
title: intl.formatMessage(tooltips.favourites), title: intl.formatMessage(messages.favourites),
icon: 'star', icon: 'star',
}, },
{ {
className: selectedFilter === 'reblog' ? 'active' : '', className: selectedFilter === 'reblog' ? 'active' : '',
onClick: this.onClick('reblog'), onClick: this.onClick('reblog'),
title: intl.formatMessage(tooltips.boosts), title: intl.formatMessage(messages.boosts),
icon: 'retweet', icon: 'retweet',
}, },
{ {
className: selectedFilter === 'poll' ? 'active' : '', className: selectedFilter === 'poll' ? 'active' : '',
onClick: this.onClick('poll'), onClick: this.onClick('poll'),
title: intl.formatMessage(tooltips.polls), title: intl.formatMessage(messages.polls),
icon: 'tasks', icon: 'tasks',
}, },
{ {
className: selectedFilter === 'follow' ? 'active' : '', className: selectedFilter === 'follow' ? 'active' : '',
onClick: this.onClick('follow'), onClick: this.onClick('follow'),
title: intl.formatMessage(tooltips.follows), title: intl.formatMessage(messages.follows),
icon: 'user-plus', icon: 'user-plus',
} },
]} ]}
/> />
) )

View File

@ -420,7 +420,7 @@ class Status extends ImmutablePureComponent {
const { fullscreen } = this.state; const { fullscreen } = this.state;
if (status === null) { if (status === null) {
return (<ColumnIndicator type='missing' />); return (<ColumnIndicator type='loading' />);
} }
if (ancestorsIds && ancestorsIds.size > 0) { if (ancestorsIds && ancestorsIds.size > 0) {

View File

@ -2,7 +2,7 @@ import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import HeaderContainer from '../features/account_timeline/containers/header_container'; import HeaderContainer from '../features/account_timeline/containers/header_container';
import {WhoToFollowPanel, SignUpPanel} from '../components/panel'; import { WhoToFollowPanel, SignUpPanel } from '../components/panel';
import LinkFooter from '../components/link_footer'; import LinkFooter from '../components/link_footer';
import ProfileInfoPanel from '../features/account_timeline/components/profile_info_panel/profile_info_panel'; import ProfileInfoPanel from '../features/account_timeline/components/profile_info_panel/profile_info_panel';
import ColumnsArea from '../components/columns_area'; import ColumnsArea from '../components/columns_area';
@ -37,12 +37,15 @@ class ProfilePage extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
accountUsername: PropTypes.string.isRequired, accountUsername: PropTypes.string.isRequired,
accountId: PropTypes.number.isRequired, accountId: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
children: PropTypes.node, children: PropTypes.node,
}; };
render () { render() {
const {accountId, account, accountUsername} = this.props; const { accountId, account, accountUsername } = this.props;
return ( return (
<ColumnsArea <ColumnsArea