[Glitch] Use the new JSX transform everywhere

Port 8f66126b10 to glitch-soc
This commit is contained in:
Claire 2023-05-28 14:18:23 +02:00
parent 9381f78166
commit 6001f5ff36
263 changed files with 403 additions and 502 deletions

View File

@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Avatar } from './avatar';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { FormattedNumber } from 'react-intl';
@ -24,7 +24,7 @@ const percIncrease = (a, b) => {
return percent;
};
export default class Counter extends React.PureComponent {
export default class Counter extends PureComponent {
static propTypes = {
measure: PropTypes.string.isRequired,
@ -62,25 +62,25 @@ export default class Counter extends React.PureComponent {
if (loading) {
content = (
<React.Fragment>
<Fragment>
<span className='sparkline__value__total'><Skeleton width={43} /></span>
<span className='sparkline__value__change'><Skeleton width={43} /></span>
</React.Fragment>
</Fragment>
);
} else {
const measure = data[0];
const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1);
content = (
<React.Fragment>
<Fragment>
<span className='sparkline__value__total'>{measure.human_value || <FormattedNumber value={measure.total} />}</span>
{measure.previous_total && (<span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span>)}
</React.Fragment>
</Fragment>
);
}
const inner = (
<React.Fragment>
<Fragment>
<div className='sparkline__value'>
{content}
</div>
@ -96,7 +96,7 @@ export default class Counter extends React.PureComponent {
</Sparklines>
)}
</div>
</React.Fragment>
</Fragment>
);
if (href) {

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { FormattedNumber } from 'react-intl';
import { roundTo10 } from 'flavours/glitch/utils/numbers';
import { Skeleton } from 'flavours/glitch/components/skeleton';
export default class Dimension extends React.PureComponent {
export default class Dimension extends PureComponent {
static propTypes = {
dimension: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { injectIntl, defineMessages } from 'react-intl';
@ -10,7 +10,7 @@ const messages = defineMessages({
violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' },
});
class Category extends React.PureComponent {
class Category extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
@ -52,7 +52,7 @@ class Category extends React.PureComponent {
}
class Rule extends React.PureComponent {
class Rule extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
@ -84,7 +84,7 @@ class Rule extends React.PureComponent {
}
class ReportReasonSelector extends React.PureComponent {
class ReportReasonSelector extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { FormattedMessage, FormattedNumber, FormattedDate } from 'react-intl';
@ -14,7 +14,7 @@ const dateForCohort = cohort => {
}
};
export default class Retention extends React.PureComponent {
export default class Retention extends PureComponent {
static propTypes = {
start_at: PropTypes.string,

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'flavours/glitch/api';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Hashtag from 'flavours/glitch/components/hashtag';
export default class Trends extends React.PureComponent {
export default class Trends extends PureComponent {
static propTypes = {
limit: PropTypes.number.isRequired,

View File

@ -1,4 +1,5 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import * as React from 'react';
import { TransitionMotion, spring } from 'react-motion';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light';
import { assetHost } from 'flavours/glitch/utils/config';
export default class AutosuggestEmoji extends React.PureComponent {
export default class AutosuggestEmoji extends PureComponent {
static propTypes = {
emoji: PropTypes.object.isRequired,

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ShortNumber from 'flavours/glitch/components/short_number';
import { FormattedMessage } from 'react-intl';
export default class AutosuggestHashtag extends React.PureComponent {
export default class AutosuggestHashtag extends PureComponent {
static propTypes = {
tag: PropTypes.shape({

View File

@ -1,4 +1,3 @@
import React from 'react';
import AutosuggestAccountContainer from 'flavours/glitch/features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag';

View File

@ -1,4 +1,3 @@
import React from 'react';
import AutosuggestAccountContainer from 'flavours/glitch/features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag';

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from 'flavours/glitch/initial_state';
export default class AvatarComposite extends React.PureComponent {
export default class AvatarComposite extends PureComponent {
static propTypes = {
accounts: ImmutablePropTypes.list.isRequired,

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from 'flavours/glitch/initial_state';
export default class AvatarOverlay extends React.PureComponent {
export default class AvatarOverlay extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,5 @@
import React, { useRef, useEffect } from 'react';
import { useRef, useEffect } from 'react';
import * as React from 'react';
import { decode } from 'blurhash';

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class Button extends React.PureComponent {
export default class Button extends PureComponent {
static propTypes = {
text: PropTypes.node,

View File

@ -1,5 +1,3 @@
import React from 'react';
const Check = () => (
<svg width='14' height='11' viewBox='0 0 14 11'>
<path d='M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0' fill='currentColor' fillRule='evenodd' />

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { supportsPassiveEvents } from 'detect-passive-events';
import { scrollTop } from '../scroll';
const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
export default class Column extends React.PureComponent {
export default class Column extends PureComponent {
static propTypes = {
children: PropTypes.node,

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import { Icon } from 'flavours/glitch/components/icon';
import { createPortal } from 'react-dom';
export default class ColumnBackButton extends React.PureComponent {
export default class ColumnBackButton extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import { Icon } from 'flavours/glitch/components/icon';
export default class ColumnBackButtonSlim extends React.PureComponent {
export default class ColumnBackButtonSlim extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
@ -12,7 +12,7 @@ const messages = defineMessages({
moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
});
class ColumnHeader extends React.PureComponent {
class ColumnHeader extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,5 +1,4 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from 'react-intl';
/**

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { IconButton } from './icon_button';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl';
@ -8,7 +8,7 @@ const messages = defineMessages({
dismiss: { id: 'dismissable_banner.dismiss', defaultMessage: 'Dismiss' },
});
class DismissableBanner extends React.PureComponent {
class DismissableBanner extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,

View File

@ -1,4 +1,5 @@
import React, { useCallback } from 'react';
import { useCallback } from 'react';
import * as React from 'react';
import type { InjectedIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent, cloneElement, Children, Fragment } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { IconButton } from './icon_button';
@ -10,7 +10,7 @@ import { CircularProgress } from 'flavours/glitch/components/loading_indicator';
const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true;
let id = 0;
class DropdownMenu extends React.PureComponent {
class DropdownMenu extends PureComponent {
static contextTypes = {
router: PropTypes.object,
@ -155,7 +155,7 @@ class DropdownMenu extends React.PureComponent {
}
export default class Dropdown extends React.PureComponent {
export default class Dropdown extends PureComponent {
static contextTypes = {
router: PropTypes.object,
@ -286,7 +286,7 @@ export default class Dropdown extends React.PureComponent {
const open = this.state.id === openDropdownId;
const button = children ? React.cloneElement(React.Children.only(children), {
const button = children ? cloneElement(Children.only(children), {
onClick: this.handleClick,
onMouseDown: this.handleMouseDown,
onKeyDown: this.handleButtonKeyDown,
@ -306,7 +306,7 @@ export default class Dropdown extends React.PureComponent {
);
return (
<React.Fragment>
<Fragment>
<span ref={this.setTargetRef}>
{button}
</span>
@ -329,7 +329,7 @@ export default class Dropdown extends React.PureComponent {
</div>
)}
</Overlay>
</React.Fragment>
</Fragment>
);
}

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';
import { Icon } from 'flavours/glitch/components/icon';
@ -16,7 +16,7 @@ const mapDispatchToProps = (dispatch, { statusId }) => ({
});
class EditedTimestamp extends React.PureComponent {
class EditedTimestamp extends PureComponent {
static propTypes = {
statusId: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { source_url } from 'flavours/glitch/initial_state';
@ -6,7 +6,7 @@ import { preferencesLink } from 'flavours/glitch/utils/backend_links';
import StackTrace from 'stacktrace-js';
import { Helmet } from 'react-helmet';
export default class ErrorBoundary extends React.PureComponent {
export default class ErrorBoundary extends PureComponent {
static propTypes = {
children: PropTypes.node,

View File

@ -1,4 +1,5 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import * as React from 'react';
interface Props {
src: string;

View File

@ -1,5 +1,5 @@
// @ts-check
import React from 'react';
import { Component, Fragment } from 'react';
import { Sparklines, SparklinesCurve } from 'react-sparklines';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
@ -9,7 +9,7 @@ import ShortNumber from 'flavours/glitch/components/short_number';
import { Skeleton } from 'flavours/glitch/components/skeleton';
import classNames from 'classnames';
class SilentErrorBoundary extends React.Component {
class SilentErrorBoundary extends Component {
static propTypes = {
children: PropTypes.node,
@ -70,7 +70,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
<div className={classNames('trends__item', className)}>
<div className='trends__item__name'>
<Permalink href={href} to={to}>
{name ? <React.Fragment>#<span>{name}</span></React.Fragment> : <Skeleton width={50} />}
{name ? <Fragment>#<span>{name}</span></Fragment> : <Skeleton width={50} />}
</Permalink>
{description ? (

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import classNames from 'classnames';

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import classNames from 'classnames';

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Icon } from './icon';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { makeGetAccount } from 'flavours/glitch/selectors';
@ -14,7 +14,7 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
class InlineAccount extends React.PureComponent {
class InlineAccount extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { cloneElement, Component } from 'react';
import PropTypes from 'prop-types';
import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
@ -6,7 +6,7 @@ import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
// Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
export default class IntersectionObserverArticle extends React.Component {
export default class IntersectionObserverArticle extends Component {
static propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired,
@ -123,7 +123,7 @@ export default class IntersectionObserverArticle extends React.Component {
tabIndex={0}
style={style}
>
{children && React.cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })}
{children && cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })}
</article>
);
}

View File

@ -4,7 +4,7 @@
// Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
// Utils.
import { assignHandlers } from 'flavours/glitch/utils/react_helpers';
@ -25,7 +25,7 @@ const handlers = {
};
// The component.
export default class Link extends React.PureComponent {
export default class Link extends PureComponent {
// Constructor.
constructor (props) {

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl';
import { Icon } from 'flavours/glitch/components/icon';
@ -7,7 +7,7 @@ const messages = defineMessages({
load_more: { id: 'status.load_more', defaultMessage: 'Load more' },
});
class LoadGap extends React.PureComponent {
class LoadGap extends PureComponent {
static propTypes = {
disabled: PropTypes.bool,

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
export default class LoadMore extends React.PureComponent {
export default class LoadMore extends PureComponent {
static propTypes = {
onClick: PropTypes.func,

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
export default class LoadPending extends React.PureComponent {
export default class LoadPending extends PureComponent {
static propTypes = {
onClick: PropTypes.func,

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
export const CircularProgress = ({ size, strokeWidth }) => {

View File

@ -1,4 +1,3 @@
import React from 'react';
import logo from 'mastodon/../images/logo.svg';
export const WordmarkLogo = () => (

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { is } from 'immutable';
@ -32,7 +32,7 @@ const messages = defineMessages({
},
});
class Item extends React.PureComponent {
class Item extends PureComponent {
static propTypes = {
attachment: ImmutablePropTypes.map.isRequired,
@ -217,7 +217,7 @@ class Item extends React.PureComponent {
}
class MediaGallery extends React.PureComponent {
class MediaGallery extends PureComponent {
static propTypes = {
sensitive: PropTypes.bool,

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import 'wicg-inert';
import { createBrowserHistory } from 'history';
import { multiply } from 'color-blend';
export default class ModalRoot extends React.PureComponent {
export default class ModalRoot extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { Switch, Route, withRouter } from 'react-router-dom';
import { showTrends } from 'flavours/glitch/initial_state';
import Trends from 'flavours/glitch/features/getting_started/containers/trends_container';
@ -15,7 +15,7 @@ const DefaultNavigation = () => (
</>
);
class NavigationPortal extends React.PureComponent {
class NavigationPortal extends PureComponent {
render () {
return (

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';

View File

@ -6,7 +6,6 @@
// Package imports //
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,7 +1,7 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
export default class Permalink extends React.PureComponent {
export default class Permalink extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Icon } from 'flavours/glitch/components/icon';
import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
class PictureInPicturePlaceholder extends React.PureComponent {
class PictureInPicturePlaceholder extends PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import classNames from 'classnames';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import illustration from 'flavours/glitch/images/elephant_ui_working.svg';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { Component } from 'react';
import type { InjectedIntl } from 'react-intl';
import { injectIntl, defineMessages } from 'react-intl';
@ -199,7 +199,7 @@ interface Props {
interface States {
now: number;
}
class RelativeTimestamp extends React.Component<Props, States> {
class RelativeTimestamp extends Component<Props, States> {
state = {
now: this.props.intl.now(),
};

View File

@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { Children, cloneElement, PureComponent } from 'react';
import ScrollContainer from 'flavours/glitch/containers/scroll_container';
import PropTypes from 'prop-types';
import IntersectionObserverArticleContainer from 'flavours/glitch/containers/intersection_observer_article_container';
@ -184,8 +184,8 @@ class ScrollableList extends PureComponent {
};
getSnapshotBeforeUpdate (prevProps) {
const someItemInserted = React.Children.count(prevProps.children) > 0 &&
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
const someItemInserted = Children.count(prevProps.children) > 0 &&
Children.count(prevProps.children) < Children.count(this.props.children) &&
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0);
@ -293,7 +293,7 @@ class ScrollableList extends PureComponent {
render () {
const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props;
const { fullscreen } = this.state;
const childrenCount = React.Children.count(children);
const childrenCount = Children.count(children);
const loadMore = (hasMore && onLoadMore) ? <LoadMore visible={!isLoading} onClick={this.handleLoadMore} /> : null;
const loadPending = (numPending > 0) ? <LoadPending count={numPending} onClick={this.handleLoadPending} /> : null;
@ -319,7 +319,7 @@ class ScrollableList extends PureComponent {
{loadPending}
{React.Children.map(this.props.children, (child, index) => (
{Children.map(this.props.children, (child, index) => (
<IntersectionObserverArticleContainer
key={child.key}
id={child.key}
@ -328,7 +328,7 @@ class ScrollableList extends PureComponent {
intersectionObserverWrapper={this.intersectionObserverWrapper}
saveHeightKey={trackScroll ? `${this.context.router.route.location.key}:${scrollKey}` : null}
>
{React.cloneElement(child, {
{cloneElement(child, {
getScrollPosition: this.getScrollPosition,
updateScrollBottom: this.updateScrollBottom,
cachedMediaWidth: this.state.cachedMediaWidth,

View File

@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { fetchServer } from 'flavours/glitch/actions/server';
@ -18,7 +18,7 @@ const mapStateToProps = state => ({
server: state.getIn(['server', 'server']),
});
class ServerBanner extends React.PureComponent {
class ServerBanner extends PureComponent {
static propTypes = {
server: PropTypes.object,

View File

@ -1,4 +1,5 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import * as React from 'react';
import classNames from 'classnames';

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
export default class SettingText extends React.PureComponent {
export default class SettingText extends PureComponent {
static propTypes = {
settings: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { memo } from 'react';
import PropTypes from 'prop-types';
import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers';
import { FormattedMessage, FormattedNumber } from 'react-intl';
@ -109,4 +109,4 @@ ShortNumberCounter.propTypes = {
value: PropTypes.arrayOf(PropTypes.number),
};
export default React.memo(ShortNumber);
export default memo(ShortNumber);

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
interface Props {
width?: number | string;

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import StatusPrepend from './status_prepend';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { IconButton } from './icon_button';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';
@ -63,7 +63,7 @@ const isLinkMisleading = (link) => {
return !(textMatchesTarget(text, origin, host) || textMatchesTarget(text.toLowerCase(), origin, host));
};
class TranslateButton extends React.PureComponent {
class TranslateButton extends PureComponent {
static propTypes = {
translation: ImmutablePropTypes.map,
@ -104,7 +104,7 @@ const mapStateToProps = state => ({
languages: state.getIn(['server', 'translationLanguages', 'items']),
});
class StatusContent extends React.PureComponent {
class StatusContent extends PureComponent {
static contextTypes = {
identity: PropTypes.object,

View File

@ -1,5 +1,5 @@
// Package imports.
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
@ -8,7 +8,7 @@ import { Avatar } from './avatar';
import AvatarOverlay from './avatar_overlay';
import { DisplayName } from './display_name';
export default class StatusHeader extends React.PureComponent {
export default class StatusHeader extends PureComponent {
static propTypes = {
status: ImmutablePropTypes.map.isRequired,

View File

@ -1,5 +1,5 @@
// Package imports.
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl } from 'react-intl';
@ -40,7 +40,7 @@ LanguageIcon.propTypes = {
language: PropTypes.string.isRequired,
};
class StatusIcons extends React.PureComponent {
class StatusIcons extends PureComponent {
static propTypes = {
status: ImmutablePropTypes.map.isRequired,

View File

@ -1,5 +1,4 @@
import { debounce } from 'lodash';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import StatusContainer from 'flavours/glitch/containers/status_container';

View File

@ -1,12 +1,12 @@
// Package imports //
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
import { Icon } from 'flavours/glitch/components/icon';
import { me } from 'flavours/glitch/initial_state';
export default class StatusPrepend extends React.PureComponent {
export default class StatusPrepend extends PureComponent {
static propTypes = {
type: PropTypes.string.isRequired,

View File

@ -1,5 +1,4 @@
// Package imports //
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { makeGetAccount } from 'flavours/glitch/selectors';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from 'mastodon/locales';
@ -6,7 +6,7 @@ import { getLocale } from 'mastodon/locales';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
export default class AdminComponent extends React.PureComponent {
export default class AdminComponent extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { Provider } from 'react-redux';
import PropTypes from 'prop-types';
import { store } from 'flavours/glitch/store';
@ -18,7 +18,7 @@ if (initialState) {
store.dispatch(fetchCustomEmojis());
export default class TimelineContainer extends React.PureComponent {
export default class TimelineContainer extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { blockDomain, unblockDomain } from '../actions/domain_blocks';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';

View File

@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
import { Helmet } from 'react-helmet';
import { IntlProvider, addLocaleData } from 'react-intl';
import { Provider as ReduxProvider } from 'react-redux';
@ -38,7 +38,7 @@ const createIdentityContext = state => ({
permissions: state.role ? state.role.permissions : 0,
});
export default class Mastodon extends React.PureComponent {
export default class Mastodon extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React, { PureComponent, Fragment } from 'react';
import { PureComponent, Fragment } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
@ -41,7 +41,7 @@ const mapStateToProps = state => ({
domainBlocks: state.getIn(['server', 'domainBlocks']),
});
class Section extends React.PureComponent {
class Section extends PureComponent {
static propTypes = {
title: PropTypes.string,
@ -80,7 +80,7 @@ class Section extends React.PureComponent {
}
class About extends React.PureComponent {
class About extends PureComponent {
static propTypes = {
server: ImmutablePropTypes.map,

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { NavLink } from 'react-router-dom';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { Icon } from 'flavours/glitch/components/icon';
class ActionBar extends React.PureComponent {
class ActionBar extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -345,10 +345,10 @@ class Header extends ImmutablePureComponent {
{!suspended && (
<div className='account__header__tabs__buttons'>
{!hidden && (
<React.Fragment>
<Fragment>
{actionBtn}
{bellBtn}
</React.Fragment>
</Fragment>
)}
<DropdownMenuContainer disabled={menu.length === 0} items={menu} icon='ellipsis-v' size={24} direction='right' />

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ColumnHeader from '../../../components/column_header';
import { injectIntl, defineMessages } from 'react-intl';
@ -7,7 +7,7 @@ const messages = defineMessages({
profile: { id: 'column_header.profile', defaultMessage: 'Profile' },
});
class ProfileColumnHeader extends React.PureComponent {
class ProfileColumnHeader extends PureComponent {
static propTypes = {
onClick: PropTypes.func,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import FeaturedTags from 'flavours/glitch/features/account/containers/featured_tags_container';
@ -19,7 +19,7 @@ const mapStateToProps = (state, { match: { params: { acct } } }) => {
};
};
class AccountNavigation extends React.PureComponent {
class AccountNavigation extends PureComponent {
static propTypes = {
match: PropTypes.shape({

View File

@ -3,7 +3,6 @@ import classNames from 'classnames';
import { Icon } from 'flavours/glitch/components/icon';
import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import InnerHeader from 'flavours/glitch/features/account/components/header';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { revealAccount } from 'flavours/glitch/actions/accounts';
@ -14,7 +14,7 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({
});
class LimitedAccountHint extends React.PureComponent {
class LimitedAccountHint extends PureComponent {
static propTypes = {
accountId: PropTypes.string.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
const MemorialNote = () => (

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { makeGetAccount, getAccountHidden } from 'flavours/glitch/selectors';
import Header from '../components/header';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import { formatTime, getPointerPosition, fileNameFromURL } from 'flavours/glitch/features/video';
@ -22,7 +22,7 @@ const messages = defineMessages({
const TICK_SIZE = 10;
const PADDING = 180;
class Audio extends React.PureComponent {
class Audio extends PureComponent {
static propTypes = {
src: PropTypes.string.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';

View File

@ -1,6 +1,5 @@
import { debounce } from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
import { Helmet } from 'react-helmet';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePropTypes from 'react-immutable-proptypes';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -10,7 +10,7 @@ const messages = defineMessages({
settings: { id: 'home.settings', defaultMessage: 'Column settings' },
});
class ColumnSettings extends React.PureComponent {
class ColumnSettings extends PureComponent {
static propTypes = {
settings: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
@ -32,7 +32,7 @@ const mapStateToProps = (state, { columnId }) => {
};
};
class CommunityTimeline extends React.PureComponent {
class CommunityTimeline extends PureComponent {
static defaultProps = {
onlyMedia: false,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
@ -21,7 +21,7 @@ const messages = defineMessages({
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
});
class ActionBar extends React.PureComponent {
class ActionBar extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { Avatar } from 'flavours/glitch/components/avatar';
import { DisplayName } from 'flavours/glitch/components/display_name';
import ImmutablePropTypes from 'react-immutable-proptypes';

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { length } from 'stringz';
export default class CharacterCounter extends React.PureComponent {
export default class CharacterCounter extends PureComponent {
static propTypes = {
text: PropTypes.string.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import CharacterCounter from './character_counter';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';

View File

@ -1,7 +1,7 @@
// Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
import Overlay from 'react-overlays/Overlay';
// Components.
@ -9,7 +9,7 @@ import { IconButton } from 'flavours/glitch/components/icon_button';
import DropdownMenu from './dropdown_menu';
// The component.
export default class ComposerOptionsDropdown extends React.PureComponent {
export default class ComposerOptionsDropdown extends PureComponent {
static propTypes = {
isUserTouching: PropTypes.func,

Some files were not shown because too many files have changed in this diff Show More