Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook.
Added babel-plugin-transform-class-properties as a Babel plugin.
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
+ "transform-class-properties",
[
"react-intl",
{
class Account extends ImmutablePureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired,
+ me: PropTypes.number.isRequired,
+ onFollow: PropTypes.func.isRequired,
+ onBlock: PropTypes.func.isRequired,
+ onMute: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
constructor (props, context) {
super(props, context);
this.handleFollow = this.handleFollow.bind(this);
}
-Account.propTypes = {
- account: ImmutablePropTypes.map.isRequired,
- me: PropTypes.number.isRequired,
- onFollow: PropTypes.func.isRequired,
- onBlock: PropTypes.func.isRequired,
- onMute: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-}
-
export default injectIntl(Account);
class AttachmentList extends React.PureComponent {
+ static propTypes = {
+ media: ImmutablePropTypes.list.isRequired
+ };
+
render () {
const { media } = this.props;
</div>
);
}
-}
-AttachmentList.propTypes = {
- media: ImmutablePropTypes.list.isRequired
-};
+}
export default AttachmentList;
class AutosuggestTextarea extends ImmutablePureComponent {
+ static propTypes = {
+ value: PropTypes.string,
+ suggestions: ImmutablePropTypes.list,
+ disabled: PropTypes.bool,
+ placeholder: PropTypes.string,
+ onSuggestionSelected: PropTypes.func.isRequired,
+ onSuggestionsClearRequested: PropTypes.func.isRequired,
+ onSuggestionsFetchRequested: PropTypes.func.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onKeyUp: PropTypes.func,
+ onKeyDown: PropTypes.func,
+ onPaste: PropTypes.func.isRequired,
+ autoFocus: PropTypes.bool
+ };
+
+ static defaultProps = {
+ autoFucus: true
+ };
+
constructor (props, context) {
super(props, context);
this.state = {
);
}
-};
-
-AutosuggestTextarea.propTypes = {
- value: PropTypes.string,
- suggestions: ImmutablePropTypes.list,
- disabled: PropTypes.bool,
- placeholder: PropTypes.string,
- onSuggestionSelected: PropTypes.func.isRequired,
- onSuggestionsClearRequested: PropTypes.func.isRequired,
- onSuggestionsFetchRequested: PropTypes.func.isRequired,
- onChange: PropTypes.func.isRequired,
- onKeyUp: PropTypes.func,
- onKeyDown: PropTypes.func,
- onPaste: PropTypes.func.isRequired,
- autoFocus: PropTypes.bool
-};
-
-AutosuggestTextarea.defaultProps = {
- autoFucus: true,
-};
+}
export default AutosuggestTextarea;
class Avatar extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
-
- this.state = {
- hovering: false
- };
-
- this.handleMouseEnter = this.handleMouseEnter.bind(this);
- this.handleMouseLeave = this.handleMouseLeave.bind(this);
- }
-
- handleMouseEnter () {
+ static propTypes = {
+ src: PropTypes.string.isRequired,
+ staticSrc: PropTypes.string,
+ size: PropTypes.number.isRequired,
+ style: PropTypes.object,
+ animate: PropTypes.bool,
+ inline: PropTypes.bool
+ };
+
+ static defaultProps = {
+ animate: false,
+ size: 20,
+ inline: false
+ };
+
+ state = {
+ hovering: true
+ };
+
+ handleMouseEnter = () => {
if (this.props.animate) return;
this.setState({ hovering: true });
}
- handleMouseLeave () {
+ handleMouseLeave = () => {
if (this.props.animate) return;
this.setState({ hovering: false });
}
}
-Avatar.propTypes = {
- src: PropTypes.string.isRequired,
- staticSrc: PropTypes.string,
- size: PropTypes.number.isRequired,
- style: PropTypes.object,
- animate: PropTypes.bool,
- inline: PropTypes.bool
-};
-
-Avatar.defaultProps = {
- animate: false,
- size: 20,
- inline: false
-};
-
export default Avatar;
import PropTypes from 'prop-types';
class AvatarOverlay extends React.PureComponent {
+ static propTypes = {
+ staticSrc: PropTypes.string.isRequired,
+ overlaySrc: PropTypes.string.isRequired
+ };
+
render() {
const {staticSrc, overlaySrc} = this.props;
</div>
);
}
-}
-AvatarOverlay.propTypes = {
- staticSrc: PropTypes.string.isRequired,
- overlaySrc: PropTypes.string.isRequired,
-};
+}
export default AvatarOverlay;
class Button extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
-
- handleClick (e) {
+ static propTypes = {
+ text: PropTypes.node,
+ onClick: PropTypes.func,
+ disabled: PropTypes.bool,
+ block: PropTypes.bool,
+ secondary: PropTypes.bool,
+ size: PropTypes.number,
+ style: PropTypes.object,
+ children: PropTypes.node
+ };
+
+ static defaultProps = {
+ size: 36
+ };
+
+ handleClick = (e) => {
if (!this.props.disabled) {
this.props.onClick();
}
}
-Button.propTypes = {
- text: PropTypes.node,
- onClick: PropTypes.func,
- disabled: PropTypes.bool,
- block: PropTypes.bool,
- secondary: PropTypes.bool,
- size: PropTypes.number,
- style: PropTypes.object,
- children: PropTypes.node
-};
-
-Button.defaultProps = {
- size: 36
-};
-
export default Button;
class ColumnBackButton extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
+ static contextTypes = {
+ router: PropTypes.object
+ };
- handleClick () {
+ handleClick = () => {
if (window.history && window.history.length === 1) this.context.router.push("/");
else this.context.router.goBack();
}
);
}
-};
-
-ColumnBackButton.contextTypes = {
- router: PropTypes.object
-};
+}
export default ColumnBackButton;
class ColumnBackButtonSlim extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
+ static contextTypes = {
+ router: PropTypes.object
+ };
- handleClick () {
+ handleClick = () => {
this.context.router.push('/');
}
}
}
-ColumnBackButtonSlim.contextTypes = {
- router: PropTypes.object
-};
-
export default ColumnBackButtonSlim;
class ColumnCollapsable extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- collapsed: true
- };
-
- this.handleToggleCollapsed = this.handleToggleCollapsed.bind(this);
- }
-
- handleToggleCollapsed () {
+ static propTypes = {
+ icon: PropTypes.string.isRequired,
+ title: PropTypes.string,
+ fullHeight: PropTypes.number.isRequired,
+ children: PropTypes.node,
+ onCollapse: PropTypes.func
+ };
+
+ state = {
+ collapsed: true
+ };
+
+ handleToggleCollapsed = () => {
const currentState = this.state.collapsed;
this.setState({ collapsed: !currentState });
}
}
-ColumnCollapsable.propTypes = {
- icon: PropTypes.string.isRequired,
- title: PropTypes.string,
- fullHeight: PropTypes.number.isRequired,
- children: PropTypes.node,
- onCollapse: PropTypes.func
-};
-
export default ColumnCollapsable;
class DisplayName extends React.PureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired
+ };
+
render () {
const displayName = this.props.account.get('display_name').length === 0 ? this.props.account.get('username') : this.props.account.get('display_name');
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
);
}
-};
-
-DisplayName.propTypes = {
- account: ImmutablePropTypes.map.isRequired
}
export default DisplayName;
class DropdownMenu extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- direction: 'left'
- };
- this.setRef = this.setRef.bind(this);
- this.renderItem = this.renderItem.bind(this);
- }
+ static propTypes = {
+ icon: PropTypes.string.isRequired,
+ items: PropTypes.array.isRequired,
+ size: PropTypes.number.isRequired,
+ direction: PropTypes.string,
+ ariaLabel: PropTypes.string
+ };
+
+ static defaultProps = {
+ ariaLabel: "Menu"
+ };
+
+ state = {
+ direction: 'left'
+ };
- setRef (c) {
+ setRef = (c) => {
this.dropdown = c;
}
- handleClick (i, e) {
+ handleClick = (i, e) => {
const { action } = this.props.items[i];
if (typeof action === 'function') {
}
}
- renderItem (item, i) {
+ renderItem = (item, i) => {
if (item === null) {
return <li key={ 'sep' + i } className='dropdown__sep' />;
}
}
-DropdownMenu.propTypes = {
- icon: PropTypes.string.isRequired,
- items: PropTypes.array.isRequired,
- size: PropTypes.number.isRequired,
- direction: PropTypes.string,
- ariaLabel: PropTypes.string
-};
-
-DropdownMenu.defaultProps = {
- ariaLabel: "Menu"
-};
-
export default DropdownMenu;
class ExtendedVideoPlayer extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleLoadedData = this.handleLoadedData.bind(this);
- this.setRef = this.setRef.bind(this);
- }
-
- handleLoadedData () {
+ static propTypes = {
+ src: PropTypes.string.isRequired,
+ time: PropTypes.number,
+ controls: PropTypes.bool.isRequired,
+ muted: PropTypes.bool.isRequired
+ };
+
+ handleLoadedData = () => {
if (this.props.time) {
this.video.currentTime = this.props.time;
}
this.video.removeEventListener('loadeddata', this.handleLoadedData);
}
- setRef (c) {
+ setRef = (c) => {
this.video = c;
}
}
-ExtendedVideoPlayer.propTypes = {
- src: PropTypes.string.isRequired,
- time: PropTypes.number,
- controls: PropTypes.bool.isRequired,
- muted: PropTypes.bool.isRequired
-};
-
export default ExtendedVideoPlayer;
class IconButton extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
-
- handleClick (e) {
+ static propTypes = {
+ className: PropTypes.string,
+ title: PropTypes.string.isRequired,
+ icon: PropTypes.string.isRequired,
+ onClick: PropTypes.func,
+ size: PropTypes.number,
+ active: PropTypes.bool,
+ style: PropTypes.object,
+ activeStyle: PropTypes.object,
+ disabled: PropTypes.bool,
+ inverted: PropTypes.bool,
+ animate: PropTypes.bool,
+ overlay: PropTypes.bool
+ };
+
+ static defaultProps = {
+ size: 18,
+ active: false,
+ disabled: false,
+ animate: false,
+ overlay: false
+ };
+
+ handleClick = (e) => {
e.preventDefault();
if (!this.props.disabled) {
}
-IconButton.propTypes = {
- className: PropTypes.string,
- title: PropTypes.string.isRequired,
- icon: PropTypes.string.isRequired,
- onClick: PropTypes.func,
- size: PropTypes.number,
- active: PropTypes.bool,
- style: PropTypes.object,
- activeStyle: PropTypes.object,
- disabled: PropTypes.bool,
- inverted: PropTypes.bool,
- animate: PropTypes.bool,
- overlay: PropTypes.bool
-};
-
-IconButton.defaultProps = {
- size: 18,
- active: false,
- disabled: false,
- animate: false,
- overlay: false
-};
-
export default IconButton;
});
class Item extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
- handleClick (e) {
+ static propTypes = {
+ attachment: ImmutablePropTypes.map.isRequired,
+ index: PropTypes.number.isRequired,
+ size: PropTypes.number.isRequired,
+ onClick: PropTypes.func.isRequired,
+ autoPlayGif: PropTypes.bool.isRequired
+ };
+
+ handleClick = (e) => {
const { index, onClick } = this.props;
if (e.button === 0) {
}
-Item.propTypes = {
- attachment: ImmutablePropTypes.map.isRequired,
- index: PropTypes.number.isRequired,
- size: PropTypes.number.isRequired,
- onClick: PropTypes.func.isRequired,
- autoPlayGif: PropTypes.bool.isRequired
-};
-
class MediaGallery extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- visible: !props.sensitive
- };
- this.handleOpen = this.handleOpen.bind(this);
- this.handleClick = this.handleClick.bind(this);
- }
+ static propTypes = {
+ sensitive: PropTypes.bool,
+ media: ImmutablePropTypes.list.isRequired,
+ height: PropTypes.number.isRequired,
+ onOpenMedia: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ autoPlayGif: PropTypes.bool.isRequired
+ };
+
+ state = {
+ visible: !props.sensitive
+ };
- handleOpen (e) {
+ handleOpen = (e) => {
this.setState({ visible: !this.state.visible });
}
- handleClick (index) {
+ handleClick = (index) => {
this.props.onOpenMedia(this.props.media, index);
}
}
-MediaGallery.propTypes = {
- sensitive: PropTypes.bool,
- media: ImmutablePropTypes.list.isRequired,
- height: PropTypes.number.isRequired,
- onOpenMedia: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- autoPlayGif: PropTypes.bool.isRequired
-};
-
export default injectIntl(MediaGallery);
class Permalink extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
-
- handleClick (e) {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ className: PropTypes.string,
+ href: PropTypes.string.isRequired,
+ to: PropTypes.string.isRequired,
+ children: PropTypes.node
+ };
+
+ handleClick = (e) => {
if (e.button === 0) {
e.preventDefault();
this.context.router.push(this.props.to);
}
-Permalink.contextTypes = {
- router: PropTypes.object
-};
-
-Permalink.propTypes = {
- className: PropTypes.string,
- href: PropTypes.string.isRequired,
- to: PropTypes.string.isRequired,
- children: PropTypes.node
-};
-
export default Permalink;
class Status extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- this.handleAccountClick = this.handleAccountClick.bind(this);
- }
-
- handleClick () {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map,
+ account: ImmutablePropTypes.map,
+ wrapped: PropTypes.bool,
+ onReply: PropTypes.func,
+ onFavourite: PropTypes.func,
+ onReblog: PropTypes.func,
+ onDelete: PropTypes.func,
+ onOpenMedia: PropTypes.func,
+ onOpenVideo: PropTypes.func,
+ onBlock: PropTypes.func,
+ me: PropTypes.number,
+ boostModal: PropTypes.bool,
+ autoPlayGif: PropTypes.bool,
+ muted: PropTypes.bool
+ };
+
+ handleClick = () => {
const { status } = this.props;
this.context.router.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`);
}
- handleAccountClick (id, e) {
+ handleAccountClick = (id, e) => {
if (e.button === 0) {
e.preventDefault();
this.context.router.push(`/accounts/${id}`);
}
-Status.contextTypes = {
- router: PropTypes.object
-};
-
-Status.propTypes = {
- status: ImmutablePropTypes.map,
- account: ImmutablePropTypes.map,
- wrapped: PropTypes.bool,
- onReply: PropTypes.func,
- onFavourite: PropTypes.func,
- onReblog: PropTypes.func,
- onDelete: PropTypes.func,
- onOpenMedia: PropTypes.func,
- onOpenVideo: PropTypes.func,
- onBlock: PropTypes.func,
- me: PropTypes.number,
- boostModal: PropTypes.bool,
- autoPlayGif: PropTypes.bool,
- muted: PropTypes.bool
-};
-
export default Status;
class StatusActionBar extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleReplyClick = this.handleReplyClick.bind(this);
- this.handleFavouriteClick = this.handleFavouriteClick.bind(this);
- this.handleReblogClick = this.handleReblogClick.bind(this);
- this.handleDeleteClick = this.handleDeleteClick.bind(this);
- this.handleMentionClick = this.handleMentionClick.bind(this);
- this.handleMuteClick = this.handleMuteClick.bind(this);
- this.handleBlockClick = this.handleBlockClick.bind(this);
- this.handleOpen = this.handleOpen.bind(this);
- this.handleReport = this.handleReport.bind(this);
- }
-
- handleReplyClick () {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onReply: PropTypes.func,
+ onFavourite: PropTypes.func,
+ onReblog: PropTypes.func,
+ onDelete: PropTypes.func,
+ onMention: PropTypes.func,
+ onMute: PropTypes.func,
+ onBlock: PropTypes.func,
+ onReport: PropTypes.func,
+ me: PropTypes.number.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ handleReplyClick = () => {
this.props.onReply(this.props.status, this.context.router);
}
- handleFavouriteClick () {
+ handleFavouriteClick = () => {
this.props.onFavourite(this.props.status);
}
- handleReblogClick (e) {
+ handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
- handleDeleteClick () {
+ handleDeleteClick = () => {
this.props.onDelete(this.props.status);
}
- handleMentionClick () {
+ handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router);
}
- handleMuteClick () {
+ handleMuteClick = () => {
this.props.onMute(this.props.status.get('account'));
}
- handleBlockClick () {
+ handleBlockClick = () => {
this.props.onBlock(this.props.status.get('account'));
}
- handleOpen () {
+ handleOpen = () => {
this.context.router.push(`/statuses/${this.props.status.get('id')}`);
}
- handleReport () {
+ handleReport = () => {
this.props.onReport(this.props.status);
this.context.router.push('/report');
}
}
-StatusActionBar.contextTypes = {
- router: PropTypes.object
-};
-
-StatusActionBar.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onReply: PropTypes.func,
- onFavourite: PropTypes.func,
- onReblog: PropTypes.func,
- onDelete: PropTypes.func,
- onMention: PropTypes.func,
- onMute: PropTypes.func,
- onBlock: PropTypes.func,
- onReport: PropTypes.func,
- me: PropTypes.number.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(StatusActionBar);
class StatusContent extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
-
- this.state = {
- hidden: true
- };
-
- this.onMentionClick = this.onMentionClick.bind(this);
- this.onHashtagClick = this.onHashtagClick.bind(this);
- this.handleMouseDown = this.handleMouseDown.bind(this)
- this.handleMouseUp = this.handleMouseUp.bind(this);
- this.handleSpoilerClick = this.handleSpoilerClick.bind(this);
- this.setRef = this.setRef.bind(this);
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onClick: PropTypes.func
+ };
+
+ state = {
+ hidden: true
};
componentDidMount () {
}
}
- onMentionClick (mention, e) {
+ onMentionClick = (mention, e) => {
if (e.button === 0) {
e.preventDefault();
this.context.router.push(`/accounts/${mention.get('id')}`);
}
}
- onHashtagClick (hashtag, e) {
+ onHashtagClick = (hashtag, e) => {
hashtag = hashtag.replace(/^#/, '').toLowerCase();
if (e.button === 0) {
}
}
- handleMouseDown (e) {
+ handleMouseDown = (e) => {
this.startXY = [e.clientX, e.clientY];
}
- handleMouseUp (e) {
+ handleMouseUp = (e) => {
const [ startX, startY ] = this.startXY;
const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)];
this.startXY = null;
}
- handleSpoilerClick (e) {
+ handleSpoilerClick = (e) => {
e.preventDefault();
this.setState({ hidden: !this.state.hidden });
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
}
-StatusContent.contextTypes = {
- router: PropTypes.object
-};
-
-StatusContent.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onClick: PropTypes.func
-};
-
export default StatusContent;
class StatusList extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScroll = this.handleScroll.bind(this);
- this.setRef = this.setRef.bind(this);
- this.handleLoadMore = this.handleLoadMore.bind(this);
- }
-
- handleScroll (e) {
+ static propTypes = {
+ scrollKey: PropTypes.string.isRequired,
+ statusIds: ImmutablePropTypes.list.isRequired,
+ onScrollToBottom: PropTypes.func,
+ onScrollToTop: PropTypes.func,
+ onScroll: PropTypes.func,
+ shouldUpdateScroll: PropTypes.func,
+ isLoading: PropTypes.bool,
+ isUnread: PropTypes.bool,
+ hasMore: PropTypes.bool,
+ prepend: PropTypes.node,
+ emptyMessage: PropTypes.node
+ };
+
+ static defaultProps = {
+ trackScroll: true
+ };
+
+ handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
const offset = scrollHeight - scrollTop - clientHeight;
this._oldScrollPosition = scrollHeight - scrollTop;
this.node.removeEventListener('scroll', this.handleScroll);
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
- handleLoadMore (e) {
+ handleLoadMore = (e) => {
e.preventDefault();
this.props.onScrollToBottom();
}
}
-StatusList.propTypes = {
- scrollKey: PropTypes.string.isRequired,
- statusIds: ImmutablePropTypes.list.isRequired,
- onScrollToBottom: PropTypes.func,
- onScrollToTop: PropTypes.func,
- onScroll: PropTypes.func,
- shouldUpdateScroll: PropTypes.func,
- isLoading: PropTypes.bool,
- isUnread: PropTypes.bool,
- hasMore: PropTypes.bool,
- prepend: PropTypes.node,
- emptyMessage: PropTypes.node
-};
-
-StatusList.defaultProps = {
- trackScroll: true
-};
-
export default StatusList;
class VideoPlayer extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- visible: !this.props.sensitive,
- preview: true,
- muted: true,
- hasAudio: true,
- videoError: false
- };
-
- this.handleClick = this.handleClick.bind(this);
- this.handleVideoClick = this.handleVideoClick.bind(this);
- this.handleOpen = this.handleOpen.bind(this);
- this.handleVisibility = this.handleVisibility.bind(this);
- this.handleExpand = this.handleExpand.bind(this);
- this.setRef = this.setRef.bind(this);
- this.handleLoadedData = this.handleLoadedData.bind(this);
- this.handleVideoError = this.handleVideoError.bind(this);
- }
-
- handleClick () {
+ static propTypes = {
+ media: ImmutablePropTypes.map.isRequired,
+ width: PropTypes.number,
+ height: PropTypes.number,
+ sensitive: PropTypes.bool,
+ intl: PropTypes.object.isRequired,
+ autoplay: PropTypes.bool,
+ onOpenVideo: PropTypes.func.isRequired
+ };
+
+ static defaultProps = {
+ width: 239,
+ height: 110
+ };
+
+ state = {
+ visible: !this.props.sensitive,
+ preview: true,
+ muted: true,
+ hasAudio: true,
+ videoError: false
+ };
+
+ handleClick = () => {
this.setState({ muted: !this.state.muted });
}
- handleVideoClick (e) {
+ handleVideoClick = (e) => {
e.stopPropagation();
const node = this.video;
}
}
- handleOpen () {
+ handleOpen = () => {
this.setState({ preview: !this.state.preview });
}
- handleVisibility () {
+ handleVisibility = () => {
this.setState({
visible: !this.state.visible,
preview: true
});
}
- handleExpand () {
+ handleExpand = () => {
this.video.pause();
this.props.onOpenVideo(this.props.media, this.video.currentTime);
}
- setRef (c) {
+ setRef = (c) => {
this.video = c;
}
- handleLoadedData () {
+ handleLoadedData = () => {
if (('WebkitAppearance' in document.documentElement.style && this.video.audioTracks.length === 0) || this.video.mozHasAudio === false) {
this.setState({ hasAudio: false });
}
}
- handleVideoError () {
+ handleVideoError = () => {
this.setState({ videoError: true });
}
}
-VideoPlayer.propTypes = {
- media: ImmutablePropTypes.map.isRequired,
- width: PropTypes.number,
- height: PropTypes.number,
- sensitive: PropTypes.bool,
- intl: PropTypes.object.isRequired,
- autoplay: PropTypes.bool,
- onOpenVideo: PropTypes.func.isRequired
-};
-
-VideoPlayer.defaultProps = {
- width: 239,
- height: 110
-};
-
export default injectIntl(VideoPlayer);
class ActionBar extends React.PureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired,
+ me: PropTypes.number.isRequired,
+ onFollow: PropTypes.func,
+ onBlock: PropTypes.func.isRequired,
+ onMention: PropTypes.func.isRequired,
+ onReport: PropTypes.func.isRequired,
+ onMute: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { account, me, intl } = this.props;
}
-ActionBar.propTypes = {
- account: ImmutablePropTypes.map.isRequired,
- me: PropTypes.number.isRequired,
- onFollow: PropTypes.func,
- onBlock: PropTypes.func.isRequired,
- onMention: PropTypes.func.isRequired,
- onReport: PropTypes.func.isRequired,
- onMute: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(ActionBar);
class Avatar extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired,
+ autoPlayGif: PropTypes.bool.isRequired
+ };
- this.state = {
- isHovered: false
- };
+ state = {
+ isHovered: false
+ };
- this.handleMouseOver = this.handleMouseOver.bind(this);
- this.handleMouseOut = this.handleMouseOut.bind(this);
- }
-
- handleMouseOver () {
+ handleMouseOver = () => {
if (this.state.isHovered) return;
this.setState({ isHovered: true });
}
- handleMouseOut () {
+ handleMouseOut = () => {
if (!this.state.isHovered) return;
this.setState({ isHovered: false });
}
}
-Avatar.propTypes = {
- account: ImmutablePropTypes.map.isRequired,
- autoPlayGif: PropTypes.bool.isRequired
-};
-
class Header extends ImmutablePureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map,
+ me: PropTypes.number.isRequired,
+ onFollow: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ autoPlayGif: PropTypes.bool.isRequired
+ };
+
render () {
const { account, me, intl } = this.props;
}
-Header.propTypes = {
- account: ImmutablePropTypes.map,
- me: PropTypes.number.isRequired,
- onFollow: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- autoPlayGif: PropTypes.bool.isRequired
-};
-
export default connect(makeMapStateToProps)(injectIntl(Header));
class Header extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleFollow = this.handleFollow.bind(this);
- this.handleBlock = this.handleBlock.bind(this);
- this.handleMention = this.handleMention.bind(this);
- this.handleReport = this.handleReport.bind(this);
- this.handleMute = this.handleMute.bind(this);
- }
+ static propTypes = {
+ account: ImmutablePropTypes.map,
+ me: PropTypes.number.isRequired,
+ onFollow: PropTypes.func.isRequired,
+ onBlock: PropTypes.func.isRequired,
+ onMention: PropTypes.func.isRequired,
+ onReport: PropTypes.func.isRequired,
+ onMute: PropTypes.func.isRequired
+ };
+
+ static contextTypes = {
+ router: PropTypes.object
+ };
- handleFollow () {
+ handleFollow = () => {
this.props.onFollow(this.props.account);
}
- handleBlock () {
+ handleBlock = () => {
this.props.onBlock(this.props.account);
}
- handleMention () {
+ handleMention = () => {
this.props.onMention(this.props.account, this.context.router);
}
- handleReport () {
+ handleReport = () => {
this.props.onReport(this.props.account);
this.context.router.push('/report');
}
- handleMute() {
+ handleMute = () => {
this.props.onMute(this.props.account);
}
</div>
);
}
-}
-Header.propTypes = {
- account: ImmutablePropTypes.map,
- me: PropTypes.number.isRequired,
- onFollow: PropTypes.func.isRequired,
- onBlock: PropTypes.func.isRequired,
- onMention: PropTypes.func.isRequired,
- onReport: PropTypes.func.isRequired,
- onMute: PropTypes.func.isRequired
-};
-
-Header.contextTypes = {
- router: PropTypes.object
-};
+}
export default Header;
class AccountTimeline extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScrollToBottom = this.handleScrollToBottom.bind(this);
- }
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ statusIds: ImmutablePropTypes.list,
+ isLoading: PropTypes.bool,
+ hasMore: PropTypes.bool,
+ me: PropTypes.number.isRequired
+ };
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchAccountTimeline(Number(this.props.params.accountId)));
}
- componentWillReceiveProps(nextProps) {
+ componentWillReceiveProps (nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchAccountTimeline(Number(nextProps.params.accountId)));
}
}
- handleScrollToBottom () {
+ handleScrollToBottom = () => {
if (!this.props.isLoading && this.props.hasMore) {
this.props.dispatch(expandAccountTimeline(Number(this.props.params.accountId)));
}
}
-AccountTimeline.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- statusIds: ImmutablePropTypes.list,
- isLoading: PropTypes.bool,
- hasMore: PropTypes.bool,
- me: PropTypes.number.isRequired
-};
-
export default connect(mapStateToProps)(AccountTimeline);
class Blocks extends ImmutablePureComponent {
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list,
+ intl: PropTypes.object.isRequired
+ };
+
constructor (props, context) {
super(props, context);
this.handleScroll = this.handleScroll.bind(this);
}
}
-Blocks.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list,
- intl: PropTypes.object.isRequired
-};
-
export default connect(mapStateToProps)(injectIntl(Blocks));
class CommunityTimeline extends React.PureComponent {
+ static propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ streamingAPIBaseURL: PropTypes.string.isRequired,
+ accessToken: PropTypes.string.isRequired,
+ hasUnread: PropTypes.bool
+ };
+
componentDidMount () {
const { dispatch, streamingAPIBaseURL, accessToken } = this.props;
}
-CommunityTimeline.propTypes = {
- dispatch: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- streamingAPIBaseURL: PropTypes.string.isRequired,
- accessToken: PropTypes.string.isRequired,
- hasUnread: PropTypes.bool
-};
-
export default connect(mapStateToProps)(injectIntl(CommunityTimeline));
class AutosuggestAccount extends ImmutablePureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired
+ };
+
render () {
const { account } = this.props;
}
-AutosuggestAccount.propTypes = {
- account: ImmutablePropTypes.map.isRequired
-};
-
export default AutosuggestAccount;
class CharacterCounter extends React.PureComponent {
+ static propTypes = {
+ text: PropTypes.string.isRequired,
+ max: PropTypes.number.isRequired
+ };
+
checkRemainingText (diff) {
if (diff < 0) {
return <span className='character-counter character-counter--over'>{diff}</span>;
}
-CharacterCounter.propTypes = {
- text: PropTypes.string.isRequired,
- max: PropTypes.number.isRequired
-}
-
export default CharacterCounter;
class ComposeForm extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleChange = this.handleChange.bind(this);
- this.handleKeyDown = this.handleKeyDown.bind(this);
- this.handleSubmit = this.handleSubmit.bind(this);
- this.onSuggestionsClearRequested = this.onSuggestionsClearRequested.bind(this);
- this.onSuggestionsFetchRequested = debounce(this.onSuggestionsFetchRequested.bind(this), 500);
- this.onSuggestionSelected = this.onSuggestionSelected.bind(this);
- this.handleChangeSpoilerText = this.handleChangeSpoilerText.bind(this);
- this.setAutosuggestTextarea = this.setAutosuggestTextarea.bind(this);
- this.handleEmojiPick = this.handleEmojiPick.bind(this);
- }
-
- handleChange (e) {
+ static propTypes = {
+ intl: PropTypes.object.isRequired,
+ text: PropTypes.string.isRequired,
+ suggestion_token: PropTypes.string,
+ suggestions: ImmutablePropTypes.list,
+ spoiler: PropTypes.bool,
+ privacy: PropTypes.string,
+ spoiler_text: PropTypes.string,
+ focusDate: PropTypes.instanceOf(Date),
+ preselectDate: PropTypes.instanceOf(Date),
+ is_submitting: PropTypes.bool,
+ is_uploading: PropTypes.bool,
+ me: PropTypes.number,
+ onChange: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onClearSuggestions: PropTypes.func.isRequired,
+ onFetchSuggestions: PropTypes.func.isRequired,
+ onSuggestionSelected: PropTypes.func.isRequired,
+ onChangeSpoilerText: PropTypes.func.isRequired,
+ onPaste: PropTypes.func.isRequired,
+ onPickEmoji: PropTypes.func.isRequired,
+ showSearch: PropTypes.bool,
+ };
+
+ static defaultProps = {
+ showSearch: false
+ };
+
+ handleChange = (e) => {
this.props.onChange(e.target.value);
}
- handleKeyDown (e) {
+ handleKeyDown = (e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
this.handleSubmit();
}
}
- handleSubmit () {
+ handleSubmit = () => {
this.autosuggestTextarea.reset();
this.props.onSubmit();
}
- onSuggestionsClearRequested () {
+ onSuggestionsClearRequested = () => {
this.props.onClearSuggestions();
}
- onSuggestionsFetchRequested (token) {
+ onSuggestionsFetchRequested = (token) => {
this.props.onFetchSuggestions(token);
}
- onSuggestionSelected (tokenStart, token, value) {
+ onSuggestionSelected = (tokenStart, token, value) => {
this._restoreCaret = null;
this.props.onSuggestionSelected(tokenStart, token, value);
}
- handleChangeSpoilerText (e) {
+ handleChangeSpoilerText = (e) => {
this.props.onChangeSpoilerText(e.target.value);
}
}
}
- setAutosuggestTextarea (c) {
+ setAutosuggestTextarea = (c) => {
this.autosuggestTextarea = c;
}
- handleEmojiPick (data) {
+ handleEmojiPick = (data) => {
const position = this.autosuggestTextarea.textarea.selectionStart;
this._restoreCaret = position + data.shortname.length + 1;
this.props.onPickEmoji(position, data);
}
-ComposeForm.propTypes = {
- intl: PropTypes.object.isRequired,
- text: PropTypes.string.isRequired,
- suggestion_token: PropTypes.string,
- suggestions: ImmutablePropTypes.list,
- spoiler: PropTypes.bool,
- privacy: PropTypes.string,
- spoiler_text: PropTypes.string,
- focusDate: PropTypes.instanceOf(Date),
- preselectDate: PropTypes.instanceOf(Date),
- is_submitting: PropTypes.bool,
- is_uploading: PropTypes.bool,
- me: PropTypes.number,
- onChange: PropTypes.func.isRequired,
- onSubmit: PropTypes.func.isRequired,
- onClearSuggestions: PropTypes.func.isRequired,
- onFetchSuggestions: PropTypes.func.isRequired,
- onSuggestionSelected: PropTypes.func.isRequired,
- onChangeSpoilerText: PropTypes.func.isRequired,
- onPaste: PropTypes.func.isRequired,
- onPickEmoji: PropTypes.func.isRequired,
- showSearch: PropTypes.bool,
-};
-
-ComposeForm.defaultProps = {
- showSearch: false
-};
-
export default injectIntl(ComposeForm);
class EmojiPickerDropdown extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.setRef = this.setRef.bind(this);
- this.handleChange = this.handleChange.bind(this);
- this.onHideDropdown = this.onHideDropdown.bind(this);
- this.onShowDropdown = this.onShowDropdown.bind(this);
- this.state = {
- active: false,
- loading: false
- };
- }
+ static propTypes = {
+ intl: PropTypes.object.isRequired,
+ onPickEmoji: PropTypes.func.isRequired
+ };
+
+ state = {
+ active: false,
+ loading: false
+ };
- setRef (c) {
+ setRef = (c) => {
this.dropdown = c;
}
- handleChange (data) {
+ handleChange = (data) => {
this.dropdown.hide();
this.props.onPickEmoji(data);
}
- onShowDropdown () {
+ onShowDropdown = () => {
this.setState({active: true});
if (!EmojiPicker) {
this.setState({loading: true});
}
}
- onHideDropdown () {
+ onHideDropdown = () => {
this.setState({active: false});
}
}
-EmojiPickerDropdown.propTypes = {
- intl: PropTypes.object.isRequired,
- onPickEmoji: PropTypes.func.isRequired
-};
-
export default injectIntl(EmojiPickerDropdown);
class NavigationBar extends ImmutablePureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired
+ };
+
render () {
return (
<div className='navigation-bar'>
}
-NavigationBar.propTypes = {
- account: ImmutablePropTypes.map.isRequired
-};
-
export default NavigationBar;
class PrivacyDropdown extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- open: false
- };
- this.handleToggle = this.handleToggle.bind(this);
- this.handleClick = this.handleClick.bind(this);
- this.onGlobalClick = this.onGlobalClick.bind(this);
- this.setRef = this.setRef.bind(this);
- }
+ static propTypes = {
+ value: PropTypes.string.isRequired,
+ onChange: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ state = {
+ open: false
+ };
- handleToggle () {
+ handleToggle = () => {
this.setState({ open: !this.state.open });
}
- handleClick (value, e) {
+ handleClick = (value, e) => {
e.preventDefault();
this.setState({ open: false });
this.props.onChange(value);
}
- onGlobalClick (e) {
+ onGlobalClick = (e) => {
if (e.target !== this.node && !this.node.contains(e.target) && this.state.open) {
this.setState({ open: false });
}
window.removeEventListener('touchstart', this.onGlobalClick);
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
}
-PrivacyDropdown.propTypes = {
- value: PropTypes.string.isRequired,
- onChange: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(PrivacyDropdown);
class ReplyIndicator extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- this.handleAccountClick = this.handleAccountClick.bind(this);
- }
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map,
+ onCancel: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
- handleClick () {
+ handleClick = () => {
this.props.onCancel();
}
- handleAccountClick (e) {
+ handleAccountClick = (e) => {
if (e.button === 0) {
e.preventDefault();
this.context.router.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
}
-ReplyIndicator.contextTypes = {
- router: PropTypes.object
-};
-
-ReplyIndicator.propTypes = {
- status: ImmutablePropTypes.map,
- onCancel: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(ReplyIndicator);
class Search extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleChange = this.handleChange.bind(this);
- this.handleKeyDown = this.handleKeyDown.bind(this);
- this.handleFocus = this.handleFocus.bind(this);
- this.handleClear = this.handleClear.bind(this);
- }
-
- handleChange (e) {
+ static propTypes = {
+ value: PropTypes.string.isRequired,
+ submitted: PropTypes.bool,
+ onChange: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onClear: PropTypes.func.isRequired,
+ onShow: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ handleChange = (e) => {
this.props.onChange(e.target.value);
}
- handleClear (e) {
+ handleClear = (e) => {
e.preventDefault();
if (this.props.value.length > 0 || this.props.submitted) {
}
}
- handleKeyDown (e) {
+ handleKeyDown = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.props.onSubmit();
}
- handleFocus () {
+ handleFocus = () => {
this.props.onShow();
}
}
-Search.propTypes = {
- value: PropTypes.string.isRequired,
- submitted: PropTypes.bool,
- onChange: PropTypes.func.isRequired,
- onSubmit: PropTypes.func.isRequired,
- onClear: PropTypes.func.isRequired,
- onShow: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(Search);
class SearchResults extends ImmutablePureComponent {
+ static propTypes = {
+ results: ImmutablePropTypes.map.isRequired
+ };
+
render () {
const { results } = this.props;
}
-SearchResults.propTypes = {
- results: ImmutablePropTypes.map.isRequired
-};
-
export default SearchResults;
class TextIconButton extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
-
- handleClick (e) {
+ static propTypes = {
+ label: PropTypes.string.isRequired,
+ title: PropTypes.string,
+ active: PropTypes.bool,
+ onClick: PropTypes.func.isRequired,
+ ariaControls: PropTypes.string
+ };
+
+ handleClick = (e) => {
e.preventDefault();
this.props.onClick();
}
}
-TextIconButton.propTypes = {
- label: PropTypes.string.isRequired,
- title: PropTypes.string,
- active: PropTypes.bool,
- onClick: PropTypes.func.isRequired,
- ariaControls: PropTypes.string
-};
-
export default TextIconButton;
class UploadButton extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleChange = this.handleChange.bind(this);
- this.handleClick = this.handleClick.bind(this);
- this.setRef = this.setRef.bind(this);
- }
+ static propTypes = {
+ disabled: PropTypes.bool,
+ onSelectFile: PropTypes.func.isRequired,
+ style: PropTypes.object,
+ resetFileKey: PropTypes.number,
+ acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
+ intl: PropTypes.object.isRequired
+ };
- handleChange (e) {
+ handleChange = (e) => {
if (e.target.files.length > 0) {
this.props.onSelectFile(e.target.files);
}
}
- handleClick () {
+ handleClick = () => {
this.fileElement.click();
}
- setRef (c) {
+ setRef = (c) => {
this.fileElement = c;
}
}
-UploadButton.propTypes = {
- disabled: PropTypes.bool,
- onSelectFile: PropTypes.func.isRequired,
- style: PropTypes.object,
- resetFileKey: PropTypes.number,
- acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default connect(makeMapStateToProps)(injectIntl(UploadButton));
class UploadForm extends React.PureComponent {
+ static propTypes = {
+ media: ImmutablePropTypes.list.isRequired,
+ onRemoveFile: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { intl, media } = this.props;
}
-UploadForm.propTypes = {
- media: ImmutablePropTypes.list.isRequired,
- onRemoveFile: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(UploadForm);
class UploadProgress extends React.PureComponent {
+ static propTypes = {
+ active: PropTypes.bool,
+ progress: PropTypes.number
+ };
+
render () {
const { active, progress } = this.props;
}
-UploadProgress.propTypes = {
- active: PropTypes.bool,
- progress: PropTypes.number
-};
-
export default UploadProgress;
class Warning extends React.PureComponent {
- constructor (props) {
- super(props);
- }
+ static propTypes = {
+ message: PropTypes.node.isRequired
+ };
render () {
const { message } = this.props;
}
-Warning.propTypes = {
- message: PropTypes.node.isRequired
-};
-
export default Warning;
class SensitiveButton extends React.PureComponent {
+ static propTypes = {
+ visible: PropTypes.bool,
+ active: PropTypes.bool,
+ onClick: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { visible, active, onClick, intl } = this.props;
}
-SensitiveButton.propTypes = {
- visible: PropTypes.bool,
- active: PropTypes.bool,
- onClick: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(SensitiveButton));
class Compose extends React.PureComponent {
+ static propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ withHeader: PropTypes.bool,
+ showSearch: PropTypes.bool,
+ intl: PropTypes.object.isRequired
+ };
+
componentDidMount () {
this.props.dispatch(mountCompose());
}
}
-Compose.propTypes = {
- dispatch: PropTypes.func.isRequired,
- withHeader: PropTypes.bool,
- showSearch: PropTypes.bool,
- intl: PropTypes.object.isRequired
-};
-
export default connect(mapStateToProps)(injectIntl(Compose));
class Favourites extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScrollToBottom = this.handleScrollToBottom.bind(this);
- }
+ static propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ statusIds: ImmutablePropTypes.list.isRequired,
+ loaded: PropTypes.bool,
+ intl: PropTypes.object.isRequired,
+ me: PropTypes.number.isRequired
+ };
componentWillMount () {
this.props.dispatch(fetchFavouritedStatuses());
}
- handleScrollToBottom () {
+ handleScrollToBottom = () => {
this.props.dispatch(expandFavouritedStatuses());
}
}
-Favourites.propTypes = {
- dispatch: PropTypes.func.isRequired,
- statusIds: ImmutablePropTypes.list.isRequired,
- loaded: PropTypes.bool,
- intl: PropTypes.object.isRequired,
- me: PropTypes.number.isRequired
-};
-
export default connect(mapStateToProps)(injectIntl(Favourites));
class Favourites extends ImmutablePureComponent {
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list
+ };
+
componentWillMount () {
this.props.dispatch(fetchFavourites(Number(this.props.params.statusId)));
}
}
-Favourites.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list
-};
-
export default connect(mapStateToProps)(Favourites);
class AccountAuthorize extends ImmutablePureComponent {
+ static propTypes = {
+ account: ImmutablePropTypes.map.isRequired,
+ onAuthorize: PropTypes.func.isRequired,
+ onReject: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { intl, account, onAuthorize, onReject } = this.props;
const content = { __html: emojify(account.get('note')) };
}
-AccountAuthorize.propTypes = {
- account: ImmutablePropTypes.map.isRequired,
- onAuthorize: PropTypes.func.isRequired,
- onReject: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(AccountAuthorize);
class FollowRequests extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScroll = this.handleScroll.bind(this);
- }
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list,
+ intl: PropTypes.object.isRequired
+ };
componentWillMount () {
this.props.dispatch(fetchFollowRequests());
}
- handleScroll (e) {
+ handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight) {
</Column>
);
}
-}
-FollowRequests.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list,
- intl: PropTypes.object.isRequired
-};
+}
export default connect(mapStateToProps)(injectIntl(FollowRequests));
class Followers extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScroll = this.handleScroll.bind(this);
- this.handleLoadMore = this.handleLoadMore.bind(this);
- }
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list
+ };
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchFollowers(Number(this.props.params.accountId)));
}
- componentWillReceiveProps(nextProps) {
+ componentWillReceiveProps (nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchFollowers(Number(nextProps.params.accountId)));
}
}
- handleScroll (e) {
+ handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight) {
}
}
- handleLoadMore (e) {
+ handleLoadMore = (e) => {
e.preventDefault();
this.props.dispatch(expandFollowers(Number(this.props.params.accountId)));
}
}
-Followers.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list
-};
-
export default connect(mapStateToProps)(Followers);
class Following extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScroll = this.handleScroll.bind(this);
- this.handleLoadMore = this.handleLoadMore.bind(this);
- }
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list
+ };
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchFollowing(Number(this.props.params.accountId)));
}
- componentWillReceiveProps(nextProps) {
+ componentWillReceiveProps (nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchFollowing(Number(nextProps.params.accountId)));
}
}
- handleScroll (e) {
+ handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight) {
}
}
- handleLoadMore (e) {
+ handleLoadMore = (e) => {
e.preventDefault();
this.props.dispatch(expandFollowing(Number(this.props.params.accountId)));
}
}
-Following.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list
-};
-
export default connect(mapStateToProps)(Following);
class GettingStarted extends ImmutablePureComponent {
+ static propTypes = {
+ intl: PropTypes.object.isRequired,
+ me: ImmutablePropTypes.map.isRequired
+ };
+
render () {
const { intl, me } = this.props;
}
}
-GettingStarted.propTypes = {
- intl: PropTypes.object.isRequired,
- me: ImmutablePropTypes.map.isRequired
-};
-
export default connect(mapStateToProps)(injectIntl(GettingStarted));
class HashtagTimeline extends React.PureComponent {
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ streamingAPIBaseURL: PropTypes.string.isRequired,
+ accessToken: PropTypes.string.isRequired,
+ hasUnread: PropTypes.bool
+ };
+
_subscribe (dispatch, id) {
const { streamingAPIBaseURL, accessToken } = this.props;
}
-HashtagTimeline.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- streamingAPIBaseURL: PropTypes.string.isRequired,
- accessToken: PropTypes.string.isRequired,
- hasUnread: PropTypes.bool
-};
-
export default connect(mapStateToProps)(HashtagTimeline);
class ColumnSettings extends React.PureComponent {
+ static propTypes = {
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { settings, onChange, onSave, intl } = this.props;
}
-ColumnSettings.propTypes = {
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-}
-
export default injectIntl(ColumnSettings);
class SettingText extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleChange = this.handleChange.bind(this);
- }
-
- handleChange (e) {
+ static propTypes = {
+ settings: ImmutablePropTypes.map.isRequired,
+ settingKey: PropTypes.array.isRequired,
+ label: PropTypes.string.isRequired,
+ onChange: PropTypes.func.isRequired
+ };
+
+ handleChange = (e) => {
this.props.onChange(this.props.settingKey, e.target.value)
}
}
-SettingText.propTypes = {
- settings: ImmutablePropTypes.map.isRequired,
- settingKey: PropTypes.array.isRequired,
- label: PropTypes.string.isRequired,
- onChange: PropTypes.func.isRequired
-};
-
export default SettingText;
class HomeTimeline extends React.PureComponent {
+ static propTypes = {
+ intl: PropTypes.object.isRequired,
+ hasUnread: PropTypes.bool,
+ hasFollows: PropTypes.bool
+ };
+
render () {
const { intl, hasUnread, hasFollows } = this.props;
}
-HomeTimeline.propTypes = {
- intl: PropTypes.object.isRequired,
- hasUnread: PropTypes.bool,
- hasFollows: PropTypes.bool
-};
-
export default connect(mapStateToProps)(injectIntl(HomeTimeline));
class ClearColumnButton extends React.Component {
+ static propTypes = {
+ onClick: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { intl } = this.props;
}
}
-ClearColumnButton.propTypes = {
- onClick: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(ClearColumnButton);
class ColumnSettings extends React.PureComponent {
+ static propTypes = {
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+ intl: PropTypes.shape({
+ formatMessage: PropTypes.func.isRequired
+ }).isRequired
+ };
+
render () {
const { settings, intl, onChange, onSave } = this.props;
}
-ColumnSettings.propTypes = {
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- intl: PropTypes.shape({
- formatMessage: PropTypes.func.isRequired
- }).isRequired
-};
-
export default injectIntl(ColumnSettings);
class Notification extends ImmutablePureComponent {
+ static propTypes = {
+ notification: ImmutablePropTypes.map.isRequired
+ };
+
renderFollow (account, link) {
return (
<div className='notification notification-follow'>
}
-Notification.propTypes = {
- notification: ImmutablePropTypes.map.isRequired
-};
-
export default Notification;
class Notifications extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleScroll = this.handleScroll.bind(this);
- this.handleLoadMore = this.handleLoadMore.bind(this);
- this.handleClear = this.handleClear.bind(this);
- this.setRef = this.setRef.bind(this);
- }
-
- handleScroll (e) {
+ static propTypes = {
+ notifications: ImmutablePropTypes.list.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ shouldUpdateScroll: PropTypes.func,
+ intl: PropTypes.object.isRequired,
+ isLoading: PropTypes.bool,
+ isUnread: PropTypes.bool
+ };
+
+ static defaultProps = {
+ trackScroll: true
+ };
+
+ handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
const offset = scrollHeight - scrollTop - clientHeight;
this._oldScrollPosition = scrollHeight - scrollTop;
}
}
- handleLoadMore (e) {
+ handleLoadMore = (e) => {
e.preventDefault();
this.props.dispatch(expandNotifications());
}
- handleClear () {
+ handleClear = () => {
const { dispatch, intl } = this.props;
dispatch(openModal('CONFIRM', {
}));
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
}
-Notifications.propTypes = {
- notifications: ImmutablePropTypes.list.isRequired,
- dispatch: PropTypes.func.isRequired,
- shouldUpdateScroll: PropTypes.func,
- intl: PropTypes.object.isRequired,
- isLoading: PropTypes.bool,
- isUnread: PropTypes.bool
-};
-
-Notifications.defaultProps = {
- trackScroll: true
-};
-
export default connect(mapStateToProps)(injectIntl(Notifications));
class PublicTimeline extends React.PureComponent {
+ static propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ streamingAPIBaseURL: PropTypes.string.isRequired,
+ accessToken: PropTypes.string.isRequired,
+ hasUnread: PropTypes.bool
+ };
+
componentDidMount () {
const { dispatch, streamingAPIBaseURL, accessToken } = this.props;
}
-PublicTimeline.propTypes = {
- dispatch: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- streamingAPIBaseURL: PropTypes.string.isRequired,
- accessToken: PropTypes.string.isRequired,
- hasUnread: PropTypes.bool
-};
-
export default connect(mapStateToProps)(injectIntl(PublicTimeline));
class Reblogs extends ImmutablePureComponent {
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ accountIds: ImmutablePropTypes.list
+ };
+
componentWillMount () {
this.props.dispatch(fetchReblogs(Number(this.props.params.statusId)));
}
}
-Reblogs.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- accountIds: ImmutablePropTypes.list
-};
-
export default connect(mapStateToProps)(Reblogs);
class StatusCheckBox extends React.PureComponent {
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ checked: PropTypes.bool,
+ onToggle: PropTypes.func.isRequired,
+ disabled: PropTypes.bool
+ };
+
render () {
const { status, checked, onToggle, disabled } = this.props;
const content = { __html: emojify(status.get('content')) };
}
-StatusCheckBox.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- checked: PropTypes.bool,
- onToggle: PropTypes.func.isRequired,
- disabled: PropTypes.bool
-};
-
export default StatusCheckBox;
class Report extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleCommentChange = this.handleCommentChange.bind(this);
- this.handleSubmit = this.handleSubmit.bind(this);
- }
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ isSubmitting: PropTypes.bool,
+ account: ImmutablePropTypes.map,
+ statusIds: ImmutablePropTypes.orderedSet.isRequired,
+ comment: PropTypes.string.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
componentWillMount () {
if (!this.props.account) {
}
}
- handleCommentChange (e) {
+ handleCommentChange = (e) => {
this.props.dispatch(changeReportComment(e.target.value));
}
- handleSubmit () {
+ handleSubmit = () => {
this.props.dispatch(submitReport());
this.context.router.replace('/');
}
}
-Report.contextTypes = {
- router: PropTypes.object
-};
-
-Report.propTypes = {
- isSubmitting: PropTypes.bool,
- account: ImmutablePropTypes.map,
- statusIds: ImmutablePropTypes.orderedSet.isRequired,
- comment: PropTypes.string.isRequired,
- dispatch: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default connect(makeMapStateToProps)(injectIntl(Report));
class ActionBar extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleReplyClick = this.handleReplyClick.bind(this);
- this.handleReblogClick = this.handleReblogClick.bind(this);
- this.handleFavouriteClick = this.handleFavouriteClick.bind(this);
- this.handleDeleteClick = this.handleDeleteClick.bind(this);
- this.handleMentionClick = this.handleMentionClick.bind(this);
- this.handleReport = this.handleReport.bind(this);
- }
-
- handleReplyClick () {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onReply: PropTypes.func.isRequired,
+ onReblog: PropTypes.func.isRequired,
+ onFavourite: PropTypes.func.isRequired,
+ onDelete: PropTypes.func.isRequired,
+ onMention: PropTypes.func.isRequired,
+ onReport: PropTypes.func,
+ me: PropTypes.number.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ handleReplyClick = () => {
this.props.onReply(this.props.status);
}
- handleReblogClick (e) {
+ handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
- handleFavouriteClick () {
+ handleFavouriteClick = () => {
this.props.onFavourite(this.props.status);
}
- handleDeleteClick () {
+ handleDeleteClick = () => {
this.props.onDelete(this.props.status);
}
- handleMentionClick () {
+ handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router);
}
- handleReport () {
+ handleReport = () => {
this.props.onReport(this.props.status);
this.context.router.push('/report');
}
}
-ActionBar.contextTypes = {
- router: PropTypes.object
-};
-
-ActionBar.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onReply: PropTypes.func.isRequired,
- onReblog: PropTypes.func.isRequired,
- onFavourite: PropTypes.func.isRequired,
- onDelete: PropTypes.func.isRequired,
- onMention: PropTypes.func.isRequired,
- onReport: PropTypes.func,
- me: PropTypes.number.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(ActionBar);
class Card extends React.PureComponent {
+ static propTypes = {
+ card: ImmutablePropTypes.map
+ };
+
renderLink () {
const { card } = this.props;
}
}
-Card.propTypes = {
- card: ImmutablePropTypes.map
-};
-
export default Card;
class DetailedStatus extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleAccountClick = this.handleAccountClick.bind(this);
- }
-
- handleAccountClick (e) {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onOpenMedia: PropTypes.func.isRequired,
+ onOpenVideo: PropTypes.func.isRequired,
+ autoPlayGif: PropTypes.bool,
+ };
+
+ handleAccountClick = (e) => {
if (e.button === 0) {
e.preventDefault();
this.context.router.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
}
-DetailedStatus.contextTypes = {
- router: PropTypes.object
-};
-
-DetailedStatus.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onOpenMedia: PropTypes.func.isRequired,
- onOpenVideo: PropTypes.func.isRequired,
- autoPlayGif: PropTypes.bool,
-};
-
export default DetailedStatus;
class Status extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleFavouriteClick = this.handleFavouriteClick.bind(this);
- this.handleReplyClick = this.handleReplyClick.bind(this);
- this.handleModalReblog = this.handleModalReblog.bind(this);
- this.handleReblogClick = this.handleReblogClick.bind(this);
- this.handleDeleteClick = this.handleDeleteClick.bind(this);
- this.handleMentionClick = this.handleMentionClick.bind(this);
- this.handleOpenMedia = this.handleOpenMedia.bind(this);
- this.handleOpenVideo = this.handleOpenVideo.bind(this);
- this.handleReport = this.handleReport.bind(this);
- }
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ params: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ status: ImmutablePropTypes.map,
+ ancestorsIds: ImmutablePropTypes.list,
+ descendantsIds: ImmutablePropTypes.list,
+ me: PropTypes.number,
+ boostModal: PropTypes.bool,
+ autoPlayGif: PropTypes.bool,
+ intl: PropTypes.object.isRequired
+ };
componentWillMount () {
this.props.dispatch(fetchStatus(Number(this.props.params.statusId)));
}
}
- handleFavouriteClick (status) {
+ handleFavouriteClick = (status) => {
if (status.get('favourited')) {
this.props.dispatch(unfavourite(status));
} else {
}
}
- handleReplyClick (status) {
+ handleReplyClick = (status) => {
this.props.dispatch(replyCompose(status, this.context.router));
}
- handleModalReblog (status) {
+ handleModalReblog = (status) => {
this.props.dispatch(reblog(status));
}
- handleReblogClick (status, e) {
+ handleReblogClick = (status, e) => {
if (status.get('reblogged')) {
this.props.dispatch(unreblog(status));
} else {
}
}
- handleDeleteClick (status) {
+ handleDeleteClick = (status) => {
const { dispatch, intl } = this.props;
dispatch(openModal('CONFIRM', {
}));
}
- handleMentionClick (account, router) {
+ handleMentionClick = (account, router) => {
this.props.dispatch(mentionCompose(account, router));
}
- handleOpenMedia (media, index) {
+ handleOpenMedia = (media, index) => {
this.props.dispatch(openModal('MEDIA', { media, index }));
}
- handleOpenVideo (media, time) {
+ handleOpenVideo = (media, time) => {
this.props.dispatch(openModal('VIDEO', { media, time }));
}
- handleReport (status) {
+ handleReport = (status) => {
this.props.dispatch(initReport(status.get('account'), status));
}
}
-Status.contextTypes = {
- router: PropTypes.object
-};
-
-Status.propTypes = {
- params: PropTypes.object.isRequired,
- dispatch: PropTypes.func.isRequired,
- status: ImmutablePropTypes.map,
- ancestorsIds: ImmutablePropTypes.list,
- descendantsIds: ImmutablePropTypes.list,
- me: PropTypes.number,
- boostModal: PropTypes.bool,
- autoPlayGif: PropTypes.bool,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(connect(makeMapStateToProps)(Status));
class BoostModal extends ImmutablePureComponent {
+ static contextTypes = {
+ router: PropTypes.object
+ };
+
+ static propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onReblog: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
constructor (props, context) {
super(props, context);
this.handleReblog = this.handleReblog.bind(this);
this.handleAccountClick = this.handleAccountClick.bind(this);
}
- handleReblog() {
+ handleReblog = () => {
this.props.onReblog(this.props.status);
this.props.onClose();
}
- handleAccountClick (e) {
+ handleAccountClick = (e) => {
if (e.button === 0) {
e.preventDefault();
this.props.onClose();
}
-BoostModal.contextTypes = {
- router: PropTypes.object
-};
-
-BoostModal.propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onReblog: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(BoostModal);
class Column extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleHeaderClick = this.handleHeaderClick.bind(this);
- this.handleWheel = this.handleWheel.bind(this);
- this.setRef = this.setRef.bind(this);
- }
+ static propTypes = {
+ heading: PropTypes.string,
+ icon: PropTypes.string,
+ children: PropTypes.node,
+ active: PropTypes.bool,
+ hideHeadingOnMobile: PropTypes.bool
+ };
- handleHeaderClick () {
+ handleHeaderClick = () => {
const scrollable = this.node.querySelector('.scrollable');
if (!scrollable) {
return;
this._interruptScrollAnimation = scrollTop(scrollable);
}
- handleWheel () {
+ handleWheel = () => {
if (typeof this._interruptScrollAnimation !== 'undefined') {
this._interruptScrollAnimation();
}
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
}
-Column.propTypes = {
- heading: PropTypes.string,
- icon: PropTypes.string,
- children: PropTypes.node,
- active: PropTypes.bool,
- hideHeadingOnMobile: PropTypes.bool
-};
-
export default Column;
class ColumnHeader extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- }
-
- handleClick () {
+ static propTypes = {
+ icon: PropTypes.string,
+ type: PropTypes.string,
+ active: PropTypes.bool,
+ onClick: PropTypes.func,
+ hideOnMobile: PropTypes.bool,
+ columnHeaderId: PropTypes.string
+ };
+
+ handleClick = () => {
this.props.onClick();
}
}
-ColumnHeader.propTypes = {
- icon: PropTypes.string,
- type: PropTypes.string,
- active: PropTypes.bool,
- onClick: PropTypes.func,
- hideOnMobile: PropTypes.bool,
- columnHeaderId: PropTypes.string
-};
-
export default ColumnHeader;
class ColumnsArea extends React.PureComponent {
+ static propTypes = {
+ children: PropTypes.node
+ };
+
render () {
return (
<div className='columns-area'>
}
-ColumnsArea.propTypes = {
- children: PropTypes.node
-};
-
export default ColumnsArea;
class ConfirmationModal extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleClick = this.handleClick.bind(this);
- this.handleCancel = this.handleCancel.bind(this);
- }
-
- handleClick () {
+ static propTypes = {
+ message: PropTypes.node.isRequired,
+ confirm: PropTypes.string.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ handleClick = () => {
this.props.onClose();
this.props.onConfirm();
}
- handleCancel (e) {
+ handleCancel = (e) => {
e.preventDefault();
this.props.onClose();
}
}
-ConfirmationModal.propTypes = {
- message: PropTypes.node.isRequired,
- confirm: PropTypes.string.isRequired,
- onClose: PropTypes.func.isRequired,
- onConfirm: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(ConfirmationModal);
class MediaModal extends ImmutablePureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- index: null
- };
- this.handleNextClick = this.handleNextClick.bind(this);
- this.handlePrevClick = this.handlePrevClick.bind(this);
- this.handleKeyUp = this.handleKeyUp.bind(this);
- }
-
- handleNextClick () {
+ static propTypes = {
+ media: ImmutablePropTypes.list.isRequired,
+ index: PropTypes.number.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
+ state = {
+ index: null
+ };
+
+ handleNextClick = () => {
this.setState({ index: (this.getIndex() + 1) % this.props.media.size});
}
- handlePrevClick () {
+ handlePrevClick = () => {
this.setState({ index: (this.getIndex() - 1) % this.props.media.size});
}
- handleKeyUp (e) {
+ handleKeyUp = (e) => {
switch(e.key) {
case 'ArrowLeft':
this.handlePrevClick();
}
-MediaModal.propTypes = {
- media: ImmutablePropTypes.list.isRequired,
- index: PropTypes.number.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(MediaModal);
class ModalRoot extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.handleKeyUp = this.handleKeyUp.bind(this);
- }
+ static propTypes = {
+ type: PropTypes.string,
+ props: PropTypes.object,
+ onClose: PropTypes.func.isRequired
+ };
- handleKeyUp (e) {
+ handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
&& !!this.props.type) {
this.props.onClose();
}
-ModalRoot.propTypes = {
- type: PropTypes.string,
- props: PropTypes.object,
- onClose: PropTypes.func.isRequired
-};
-
export default ModalRoot;
class OnboardingModal extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- currentIndex: 0
- };
- this.handleSkip = this.handleSkip.bind(this);
- this.handleDot = this.handleDot.bind(this);
- this.handleNext = this.handleNext.bind(this);
- }
-
- handleSkip (e) {
+ static propTypes = {
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ me: ImmutablePropTypes.map.isRequired,
+ domain: PropTypes.string.isRequired,
+ admin: ImmutablePropTypes.map
+ };
+
+ state = {
+ currentIndex: 0
+ };
+
+ handleSkip = (e) => {
e.preventDefault();
this.props.onClose();
}
- handleDot (i, e) {
+ handleDot = (i, e) => {
e.preventDefault();
this.setState({ currentIndex: i });
}
- handleNext (maxNum, e) {
+ handleNext = (maxNum, e) => {
e.preventDefault();
if (this.state.currentIndex < maxNum - 1) {
}
-OnboardingModal.propTypes = {
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- me: ImmutablePropTypes.map.isRequired,
- domain: PropTypes.string.isRequired,
- admin: ImmutablePropTypes.map
-}
-
export default connect(mapStateToProps)(injectIntl(OnboardingModal));
class UploadArea extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
+ static propTypes = {
+ active: PropTypes.bool,
+ onClose: PropTypes.func
+ };
- this.handleKeyUp = this.handleKeyUp.bind(this);
- }
-
- handleKeyUp (e) {
+ handleKeyUp = (e) => {
e.preventDefault();
e.stopPropagation();
}
-UploadArea.propTypes = {
- active: PropTypes.bool,
- onClose: PropTypes.func
-};
-
export default UploadArea;
class VideoModal extends ImmutablePureComponent {
+ static propTypes = {
+ media: ImmutablePropTypes.map.isRequired,
+ time: PropTypes.number,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired
+ };
+
render () {
const { media, intl, time, onClose } = this.props;
}
-VideoModal.propTypes = {
- media: ImmutablePropTypes.map.isRequired,
- time: PropTypes.number,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired
-};
-
export default injectIntl(VideoModal);
class UI extends React.PureComponent {
- constructor (props, context) {
- super(props, context);
- this.state = {
- width: window.innerWidth,
- draggingOver: false
- };
- this.handleResize = debounce(this.handleResize.bind(this), 500);
- this.handleDragEnter = this.handleDragEnter.bind(this);
- this.handleDragOver = this.handleDragOver.bind(this);
- this.handleDrop = this.handleDrop.bind(this);
- this.handleDragLeave = this.handleDragLeave.bind(this);
- this.handleDragEnd = this.handleDragLeave.bind(this)
- this.closeUploadModal = this.closeUploadModal.bind(this)
- this.setRef = this.setRef.bind(this);
- }
+ static propTypes = {
+ dispatch: PropTypes.func.isRequired,
+ children: PropTypes.node
+ };
+
+ state = {
+ width: window.innerWidth,
+ draggingOver: false
+ };
- handleResize () {
+ handleResize = () => {
this.setState({ width: window.innerWidth });
}
- handleDragEnter (e) {
+ handleDragEnter = (e) => {
e.preventDefault();
if (!this.dragTargets) {
}
}
- handleDragOver (e) {
+ handleDragOver = (e) => {
e.preventDefault();
e.stopPropagation();
return false;
}
- handleDrop (e) {
+ handleDrop = (e) => {
e.preventDefault();
this.setState({ draggingOver: false });
}
}
- handleDragLeave (e) {
+ handleDragLeave = (e) => {
e.preventDefault();
e.stopPropagation();
this.setState({ draggingOver: false });
}
- closeUploadModal() {
+ closeUploadModal = () => {
this.setState({ draggingOver: false });
}
document.removeEventListener('dragend', this.handleDragEnd);
}
- setRef (c) {
+ setRef = (c) => {
this.node = c;
}
}
-UI.propTypes = {
- dispatch: PropTypes.func.isRequired,
- children: PropTypes.node
-};
-
export default connect()(UI);
"babel-plugin-react-intl": "^2.3.1",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
+ "babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-jsx-self": "^6.22.0",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
babel-runtime "^6.22.0"
babel-template "^6.22.0"
+babel-plugin-transform-class-properties@^6.24.1:
+ version "6.24.1"
+ resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz#6a79763ea61d33d36f37b611aa9def81a81b46ac"
+ dependencies:
+ babel-helper-function-name "^6.24.1"
+ babel-plugin-syntax-class-properties "^6.8.0"
+ babel-runtime "^6.22.0"
+ babel-template "^6.24.1"
+
babel-plugin-transform-decorators@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.22.0.tgz#c03635b27a23b23b7224f49232c237a73988d27c"