From a0bc0619caf045f912e49bb2ddfe1e7c0a9bc0bc Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 28 May 2023 14:56:24 +0200 Subject: [PATCH] [Glitch] Use JSX syntax for Fragments Port 5a16bd7bf4591feb852364da9b84407438c9b7d6 to glitch-soc --- .../flavours/glitch/components/account.jsx | 9 ++++---- .../glitch/components/admin/Counter.jsx | 14 +++++------ .../glitch/components/dropdown_menu.jsx | 6 ++--- .../flavours/glitch/components/hashtag.jsx | 4 ++-- .../glitch/components/icon_button.tsx | 4 ++-- .../glitch/components/navigation_portal.jsx | 14 +++++------ .../glitch/containers/media_container.jsx | 6 ++--- .../features/account/components/header.jsx | 5 ++-- .../compose/components/dropdown_menu.jsx | 6 ++--- .../features/compose/components/options.jsx | 5 ++-- .../features/explore/components/story.jsx | 6 ++--- .../glitch/features/explore/results.jsx | 6 ++--- .../features/filters/added_to_filter.jsx | 14 +++++------ .../glitch/features/filters/select_filter.jsx | 6 ++--- .../features/follow_recommendations/index.jsx | 5 ++-- .../glitch/features/getting_started/index.jsx | 5 ++-- .../components/follow_request.jsx | 5 ++-- .../notifications/components/report.jsx | 5 ++-- .../glitch/features/notifications/index.jsx | 8 +------ .../glitch/features/report/category.jsx | 6 ++--- .../glitch/features/report/comment.jsx | 10 ++++---- .../flavours/glitch/features/report/rules.jsx | 6 ++--- .../glitch/features/report/statuses.jsx | 6 ++--- .../glitch/features/report/thanks.jsx | 10 ++++---- .../status/components/detailed_status.jsx | 23 +++++++++---------- .../features/ui/components/actions_modal.jsx | 5 ++-- .../ui/components/compare_history_modal.jsx | 6 ++--- .../features/ui/components/compose_panel.jsx | 10 ++++---- .../ui/components/focal_point_modal.jsx | 6 ++--- .../ui/components/navigation_panel.jsx | 10 ++++---- .../features/ui/components/zoomable_image.jsx | 6 ++--- 31 files changed, 110 insertions(+), 127 deletions(-) diff --git a/app/javascript/flavours/glitch/components/account.jsx b/app/javascript/flavours/glitch/components/account.jsx index 12758d2351..c1c7560e92 100644 --- a/app/javascript/flavours/glitch/components/account.jsx +++ b/app/javascript/flavours/glitch/components/account.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { Avatar } from './avatar'; @@ -97,10 +96,10 @@ class Account extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } @@ -128,10 +127,10 @@ class Account extends ImmutablePureComponent { hidingNotificationsButton = ; } buttons = ( - + <> {hidingNotificationsButton} - + ); } else if (defaultAction === 'mute') { buttons = ; diff --git a/app/javascript/flavours/glitch/components/admin/Counter.jsx b/app/javascript/flavours/glitch/components/admin/Counter.jsx index 9c0a958096..471eb113f3 100644 --- a/app/javascript/flavours/glitch/components/admin/Counter.jsx +++ b/app/javascript/flavours/glitch/components/admin/Counter.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'flavours/glitch/api'; import { FormattedNumber } from 'react-intl'; @@ -62,25 +62,25 @@ export default class Counter extends PureComponent { if (loading) { content = ( - + <> - + ); } else { const measure = data[0]; const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1); content = ( - + <> {measure.human_value || } {measure.previous_total && ( 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'})} - + ); } const inner = ( - + <>
{content}
@@ -96,7 +96,7 @@ export default class Counter extends PureComponent { )} -
+ ); if (href) { diff --git a/app/javascript/flavours/glitch/components/dropdown_menu.jsx b/app/javascript/flavours/glitch/components/dropdown_menu.jsx index 45ed2561c0..de303b8dc7 100644 --- a/app/javascript/flavours/glitch/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/components/dropdown_menu.jsx @@ -1,4 +1,4 @@ -import { PureComponent, cloneElement, Children, Fragment } from 'react'; +import { PureComponent, cloneElement, Children } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { IconButton } from './icon_button'; @@ -306,7 +306,7 @@ export default class Dropdown extends PureComponent { ); return ( - + <> {button} @@ -329,7 +329,7 @@ export default class Dropdown extends PureComponent { )} - + ); } diff --git a/app/javascript/flavours/glitch/components/hashtag.jsx b/app/javascript/flavours/glitch/components/hashtag.jsx index 0cd7953e49..4a1f43ec0d 100644 --- a/app/javascript/flavours/glitch/components/hashtag.jsx +++ b/app/javascript/flavours/glitch/components/hashtag.jsx @@ -1,5 +1,5 @@ // @ts-check -import { Component, Fragment } from 'react'; +import { Component } from 'react'; import { Sparklines, SparklinesCurve } from 'react-sparklines'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; @@ -70,7 +70,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className, description
- {name ? #{name} : } + {name ? <>#{name} : } {description ? ( diff --git a/app/javascript/flavours/glitch/components/icon_button.tsx b/app/javascript/flavours/glitch/components/icon_button.tsx index 8b7aa104c2..ecc418773c 100644 --- a/app/javascript/flavours/glitch/components/icon_button.tsx +++ b/app/javascript/flavours/glitch/components/icon_button.tsx @@ -138,7 +138,7 @@ export class IconButton extends React.PureComponent { } let contents = ( - + <> + ); if (href != null) { diff --git a/app/javascript/flavours/glitch/components/navigation_portal.jsx b/app/javascript/flavours/glitch/components/navigation_portal.jsx index 8995c7e657..cdd16259aa 100644 --- a/app/javascript/flavours/glitch/components/navigation_portal.jsx +++ b/app/javascript/flavours/glitch/components/navigation_portal.jsx @@ -5,14 +5,12 @@ import Trends from 'flavours/glitch/features/getting_started/containers/trends_c import AccountNavigation from 'flavours/glitch/features/account/navigation'; const DefaultNavigation = () => ( - <> - {showTrends && ( - <> -
- - - )} - + showTrends ? ( + <> +
+ + + ) : null ); class NavigationPortal extends PureComponent { diff --git a/app/javascript/flavours/glitch/containers/media_container.jsx b/app/javascript/flavours/glitch/containers/media_container.jsx index 4378f93ad1..f0e6ae7762 100644 --- a/app/javascript/flavours/glitch/containers/media_container.jsx +++ b/app/javascript/flavours/glitch/containers/media_container.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import { createPortal } from 'react-dom'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; @@ -75,7 +75,7 @@ export default class MediaContainer extends PureComponent { return ( - + <> {[].map.call(components, (component, i) => { const componentName = component.getAttribute('data-component'); const Component = MEDIA_COMPONENTS[componentName]; @@ -115,7 +115,7 @@ export default class MediaContainer extends PureComponent { /> )} - + ); } diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index a1bdfeb5d4..a7a4e680b2 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -345,10 +344,10 @@ class Header extends ImmutablePureComponent { {!suspended && (
{!hidden && ( - + <> {actionBtn} {bellBtn} - + )} diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx index 1ff28d29c1..bb3c8b4aef 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx @@ -1,6 +1,6 @@ // Package imports. import PropTypes from 'prop-types'; -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import classNames from 'classnames'; import { supportsPassiveEvents } from 'detect-passive-events'; @@ -152,14 +152,14 @@ export default class ComposerOptionsDropdownContent extends PureComponent { if (!contents) { contents = ( - + <> {icon && }
{text} {meta}
-
+ ); } diff --git a/app/javascript/flavours/glitch/features/compose/components/options.jsx b/app/javascript/flavours/glitch/features/compose/components/options.jsx index f6a9b2e2ea..ffbd12264c 100644 --- a/app/javascript/flavours/glitch/features/compose/components/options.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/options.jsx @@ -1,6 +1,5 @@ // Package imports. import PropTypes from 'prop-types'; -import { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl } from 'react-intl'; import Toggle from 'react-toggle'; @@ -101,14 +100,14 @@ class ToggleOptionImpl extends ImmutablePureComponent { const { meta, text, checked } = this.props; return ( - + <>
{text} {meta}
-
+ ); } diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 3d67340e77..0df5418192 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { Blurhash } from 'flavours/glitch/components/blurhash'; import { accountsCountRenderer } from 'flavours/glitch/components/hashtag'; @@ -38,10 +38,10 @@ export default class Story extends PureComponent {
{thumbnail ? ( - + <>
-
+ ) : }
diff --git a/app/javascript/flavours/glitch/features/explore/results.jsx b/app/javascript/flavours/glitch/features/explore/results.jsx index c9cd707464..dc85a1cabe 100644 --- a/app/javascript/flavours/glitch/features/explore/results.jsx +++ b/app/javascript/flavours/glitch/features/explore/results.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; @@ -102,7 +102,7 @@ class Results extends PureComponent { } return ( - + <>
@@ -117,7 +117,7 @@ class Results extends PureComponent { {intl.formatMessage(messages.title, { q })} - + ); } diff --git a/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx b/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx index a7deb5a06b..8afbacbcfb 100644 --- a/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/added_to_filter.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; @@ -30,7 +30,7 @@ class AddedToFilter extends PureComponent { let expiredMessage = null; if (filter.get('expires_at') && filter.get('expires_at') < new Date()) { expiredMessage = ( - + <>

-
+ ); } let contextMismatchMessage = null; if (contextType && !filter.get('context').includes(toServerSideType(contextType))) { contextMismatchMessage = ( - + <>

-
+ ); } @@ -67,7 +67,7 @@ class AddedToFilter extends PureComponent { ); return ( - + <>

-
+ ); } diff --git a/app/javascript/flavours/glitch/features/filters/select_filter.jsx b/app/javascript/flavours/glitch/features/filters/select_filter.jsx index 23d9d1582a..5881252c9b 100644 --- a/app/javascript/flavours/glitch/features/filters/select_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/select_filter.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -169,7 +169,7 @@ class SelectFilter extends PureComponent { const results = this.search(); return ( - + <>

@@ -183,7 +183,7 @@ class SelectFilter extends PureComponent { {isSearching && this.renderCreateNew(searchValue) }
- + ); } diff --git a/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx b/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx index fae99a5991..7eea6ad192 100644 --- a/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx +++ b/app/javascript/flavours/glitch/features/follow_recommendations/index.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -86,7 +85,7 @@ class FollowRecommendations extends ImmutablePureComponent {
{!isLoading && ( - + <>
{suggestions.size > 0 ? suggestions.map(suggestion => ( @@ -101,7 +100,7 @@ class FollowRecommendations extends ImmutablePureComponent {
-
+ )}
diff --git a/app/javascript/flavours/glitch/features/getting_started/index.jsx b/app/javascript/flavours/glitch/features/getting_started/index.jsx index 9537180d60..0f84682a9f 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/index.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading'; @@ -173,13 +172,13 @@ class GettingStarted extends ImmutablePureComponent { {multiColumn && } {navItems} {signedIn && ( - + <> {listItems} { preferencesLink !== undefined && } - + )}
diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx index ba19258779..de975843fd 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { Avatar } from 'flavours/glitch/components/avatar'; @@ -74,10 +73,10 @@ class FollowRequest extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } diff --git a/app/javascript/flavours/glitch/features/notifications/components/report.jsx b/app/javascript/flavours/glitch/features/notifications/components/report.jsx index ef58891077..12f18af23a 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/report.jsx @@ -1,4 +1,3 @@ -import { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; @@ -31,9 +30,9 @@ class Report extends ImmutablePureComponent { if (hidden) { return ( - + <> {report.get('id')} - + ); } diff --git a/app/javascript/flavours/glitch/features/notifications/index.jsx b/app/javascript/flavours/glitch/features/notifications/index.jsx index 6a87aff86f..be1df15dfb 100644 --- a/app/javascript/flavours/glitch/features/notifications/index.jsx +++ b/app/javascript/flavours/glitch/features/notifications/index.jsx @@ -323,12 +323,6 @@ class Notifications extends PureComponent {
); - const extraButton = ( - <> - {extraButtons} - - ); - return ( diff --git a/app/javascript/flavours/glitch/features/report/category.jsx b/app/javascript/flavours/glitch/features/report/category.jsx index 3f88631866..cd97d5747a 100644 --- a/app/javascript/flavours/glitch/features/report/category.jsx +++ b/app/javascript/flavours/glitch/features/report/category.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; @@ -72,7 +72,7 @@ class Category extends PureComponent { ]; return ( - + <>

@@ -95,7 +95,7 @@ class Category extends PureComponent {
-
+ ); } diff --git a/app/javascript/flavours/glitch/features/report/comment.jsx b/app/javascript/flavours/glitch/features/report/comment.jsx index 507ecdd6e7..d8677b837a 100644 --- a/app/javascript/flavours/glitch/features/report/comment.jsx +++ b/app/javascript/flavours/glitch/features/report/comment.jsx @@ -1,4 +1,4 @@ -import { PureComponent, Fragment } from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; @@ -47,7 +47,7 @@ class Comment extends PureComponent { const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props; return ( - + <>