From cee357d5385c66a0217827ba3ceab2e77cd2f649 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 12 Apr 2023 12:44:58 +0200 Subject: [PATCH] Change all components to use the same error page in web UI (#24512) --- .../mastodon/components/missing_indicator.jsx | 29 ------------------- .../features/account_gallery/index.jsx | 6 ++-- .../features/account_timeline/index.jsx | 7 ++--- .../mastodon/features/followers/index.jsx | 6 ++-- .../mastodon/features/following/index.jsx | 6 ++-- .../features/generic_not_found/index.jsx | 11 ------- .../mastodon/features/list_timeline/index.jsx | 8 ++--- .../mastodon/features/status/index.jsx | 12 +++----- .../features/ui/util/async-components.js | 4 --- .../mastodon/locales/defaultMessages.json | 15 +--------- 10 files changed, 15 insertions(+), 89 deletions(-) delete mode 100644 app/javascript/mastodon/components/missing_indicator.jsx delete mode 100644 app/javascript/mastodon/features/generic_not_found/index.jsx diff --git a/app/javascript/mastodon/components/missing_indicator.jsx b/app/javascript/mastodon/components/missing_indicator.jsx deleted file mode 100644 index 05e0d653d..000000000 --- a/app/javascript/mastodon/components/missing_indicator.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import illustration from 'mastodon/../images/elephant_ui_disappointed.svg'; -import classNames from 'classnames'; -import { Helmet } from 'react-helmet'; - -const MissingIndicator = ({ fullPage }) => ( -
-
- -
- -
- - -
- - - - -
-); - -MissingIndicator.propTypes = { - fullPage: PropTypes.bool, -}; - -export default MissingIndicator; diff --git a/app/javascript/mastodon/features/account_gallery/index.jsx b/app/javascript/mastodon/features/account_gallery/index.jsx index db76507db..b876df6a2 100644 --- a/app/javascript/mastodon/features/account_gallery/index.jsx +++ b/app/javascript/mastodon/features/account_gallery/index.jsx @@ -13,10 +13,10 @@ import MediaItem from './components/media_item'; import HeaderContainer from '../account_timeline/containers/header_container'; import ScrollContainer from 'mastodon/containers/scroll_container'; import LoadMore from 'mastodon/components/load_more'; -import MissingIndicator from 'mastodon/components/missing_indicator'; import { openModal } from 'mastodon/actions/modal'; import { FormattedMessage } from 'react-intl'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); @@ -161,9 +161,7 @@ class AccountGallery extends ImmutablePureComponent { if (!isAccount) { return ( - - - + ); } diff --git a/app/javascript/mastodon/features/account_timeline/index.jsx b/app/javascript/mastodon/features/account_timeline/index.jsx index d77563684..bc66f128d 100644 --- a/app/javascript/mastodon/features/account_timeline/index.jsx +++ b/app/javascript/mastodon/features/account_timeline/index.jsx @@ -12,7 +12,6 @@ import ColumnBackButton from '../../components/column_back_button'; import { List as ImmutableList } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; -import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; import { me } from 'mastodon/initial_state'; import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines'; @@ -20,6 +19,7 @@ import LimitedAccountHint from './components/limited_account_hint'; import { getAccountHidden } from 'mastodon/selectors'; import { fetchFeaturedTags } from '../../actions/featured_tags'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const emptyList = ImmutableList(); @@ -157,10 +157,7 @@ class AccountTimeline extends ImmutablePureComponent { ); } else if (!isLoading && !isAccount) { return ( - - - - + ); } diff --git a/app/javascript/mastodon/features/followers/index.jsx b/app/javascript/mastodon/features/followers/index.jsx index fe86ebb3b..cdd65c9ef 100644 --- a/app/javascript/mastodon/features/followers/index.jsx +++ b/app/javascript/mastodon/features/followers/index.jsx @@ -17,11 +17,11 @@ import Column from '../ui/components/column'; import HeaderContainer from '../account_timeline/containers/header_container'; import ColumnBackButton from '../../components/column_back_button'; import ScrollableList from '../../components/scrollable_list'; -import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; import { getAccountHidden } from 'mastodon/selectors'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); @@ -111,9 +111,7 @@ class Followers extends ImmutablePureComponent { if (!isAccount) { return ( - - - + ); } diff --git a/app/javascript/mastodon/features/following/index.jsx b/app/javascript/mastodon/features/following/index.jsx index 8095d73a3..26dee213d 100644 --- a/app/javascript/mastodon/features/following/index.jsx +++ b/app/javascript/mastodon/features/following/index.jsx @@ -17,11 +17,11 @@ import Column from '../ui/components/column'; import HeaderContainer from '../account_timeline/containers/header_container'; import ColumnBackButton from '../../components/column_back_button'; import ScrollableList from '../../components/scrollable_list'; -import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; import { getAccountHidden } from 'mastodon/selectors'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); @@ -111,9 +111,7 @@ class Following extends ImmutablePureComponent { if (!isAccount) { return ( - - - + ); } diff --git a/app/javascript/mastodon/features/generic_not_found/index.jsx b/app/javascript/mastodon/features/generic_not_found/index.jsx deleted file mode 100644 index 41cd61a5f..000000000 --- a/app/javascript/mastodon/features/generic_not_found/index.jsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import Column from '../ui/components/column'; -import MissingIndicator from '../../components/missing_indicator'; - -const GenericNotFound = () => ( - - - -); - -export default GenericNotFound; diff --git a/app/javascript/mastodon/features/list_timeline/index.jsx b/app/javascript/mastodon/features/list_timeline/index.jsx index c0b9a62ff..8297c2748 100644 --- a/app/javascript/mastodon/features/list_timeline/index.jsx +++ b/app/javascript/mastodon/features/list_timeline/index.jsx @@ -10,13 +10,12 @@ import { openModal } from 'mastodon/actions/modal'; import { connectListStream } from 'mastodon/actions/streaming'; import { expandListTimeline } from 'mastodon/actions/timelines'; import Column from 'mastodon/components/column'; -import ColumnBackButton from 'mastodon/components/column_back_button'; import ColumnHeader from 'mastodon/components/column_header'; import Icon from 'mastodon/components/icon'; import LoadingIndicator from 'mastodon/components/loading_indicator'; -import MissingIndicator from 'mastodon/components/missing_indicator'; import RadioButton from 'mastodon/components/radio_button'; import StatusListContainer from 'mastodon/features/ui/containers/status_list_container'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const messages = defineMessages({ deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, @@ -156,10 +155,7 @@ class ListTimeline extends React.PureComponent { ); } else if (list === false) { return ( - - - - + ); } diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 2d18c6e9d..b547741f7 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -16,7 +16,6 @@ import { translateStatus, undoStatusTranslation, } from '../../actions/statuses'; -import MissingIndicator from '../../components/missing_indicator'; import LoadingIndicator from 'mastodon/components/loading_indicator'; import DetailedStatus from './components/detailed_status'; import ActionBar from './components/action_bar'; @@ -50,7 +49,6 @@ import { initBoostModal } from '../../actions/boosts'; import { initReport } from '../../actions/reports'; import { makeGetStatus, makeGetPictureInPicture } from '../../selectors'; import ScrollContainer from 'mastodon/containers/scroll_container'; -import ColumnBackButton from '../../components/column_back_button'; import ColumnHeader from '../../components/column_header'; import StatusContainer from '../../containers/status_container'; import { openModal } from '../../actions/modal'; @@ -62,6 +60,7 @@ import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; import Icon from 'mastodon/components/icon'; import { Helmet } from 'react-helmet'; +import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, @@ -584,19 +583,16 @@ class Status extends ImmutablePureComponent { if (status === null) { return ( - - - - + ); } if (ancestorsIds && ancestorsIds.size > 0) { - ancestors =
{this.renderChildren(ancestorsIds)}
; + ancestors = <>{this.renderChildren(ancestorsIds)}; } if (descendantsIds && descendantsIds.size > 0) { - descendants =
{this.renderChildren(descendantsIds)}
; + descendants = <>{this.renderChildren(descendantsIds)}; } const isLocal = status.getIn(['account', 'acct'], '').indexOf('@') === -1; diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js index 1cf07f645..e6382fa10 100644 --- a/app/javascript/mastodon/features/ui/util/async-components.js +++ b/app/javascript/mastodon/features/ui/util/async-components.js @@ -82,10 +82,6 @@ export function FollowRequests () { return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests'); } -export function GenericNotFound () { - return import(/* webpackChunkName: "features/generic_not_found" */'../../generic_not_found'); -} - export function FavouritedStatuses () { return import(/* webpackChunkName: "features/favourited_statuses" */'../../favourited_statuses'); } diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json index b490a7b6b..e6c2ae4b1 100644 --- a/app/javascript/mastodon/locales/defaultMessages.json +++ b/app/javascript/mastodon/locales/defaultMessages.json @@ -353,19 +353,6 @@ ], "path": "app/javascript/mastodon/components/media_gallery.json" }, - { - "descriptors": [ - { - "defaultMessage": "Not found", - "id": "missing_indicator.label" - }, - { - "defaultMessage": "This resource could not be found", - "id": "missing_indicator.sublabel" - } - ], - "path": "app/javascript/mastodon/components/missing_indicator.json" - }, { "descriptors": [ { @@ -4359,4 +4346,4 @@ ], "path": "app/javascript/mastodon/features/video/index.json" } -] \ No newline at end of file +]