Change all components to use the same error page in web UI (#24512)

th-downstream
Eugen Rochko 2 years ago committed by GitHub
parent aca2cd1528
commit cee357d538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 }) => (
<div className={classNames('regeneration-indicator', { 'regeneration-indicator--without-header': fullPage })}>
<div className='regeneration-indicator__figure'>
<img src={illustration} alt='' />
</div>
<div className='regeneration-indicator__label'>
<FormattedMessage id='missing_indicator.label' tagName='strong' defaultMessage='Not found' />
<FormattedMessage id='missing_indicator.sublabel' defaultMessage='This resource could not be found' />
</div>
<Helmet>
<meta name='robots' content='noindex' />
</Helmet>
</div>
);
MissingIndicator.propTypes = {
fullPage: PropTypes.bool,
};
export default MissingIndicator;

@ -13,10 +13,10 @@ import MediaItem from './components/media_item';
import HeaderContainer from '../account_timeline/containers/header_container'; import HeaderContainer from '../account_timeline/containers/header_container';
import ScrollContainer from 'mastodon/containers/scroll_container'; import ScrollContainer from 'mastodon/containers/scroll_container';
import LoadMore from 'mastodon/components/load_more'; import LoadMore from 'mastodon/components/load_more';
import MissingIndicator from 'mastodon/components/missing_indicator';
import { openModal } from 'mastodon/actions/modal'; import { openModal } from 'mastodon/actions/modal';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const mapStateToProps = (state, { params: { acct, id } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
@ -161,9 +161,7 @@ class AccountGallery extends ImmutablePureComponent {
if (!isAccount) { if (!isAccount) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<MissingIndicator />
</Column>
); );
} }

@ -12,7 +12,6 @@ import ColumnBackButton from '../../components/column_back_button';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint'; import TimelineHint from 'mastodon/components/timeline_hint';
import { me } from 'mastodon/initial_state'; import { me } from 'mastodon/initial_state';
import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines'; import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines';
@ -20,6 +19,7 @@ import LimitedAccountHint from './components/limited_account_hint';
import { getAccountHidden } from 'mastodon/selectors'; import { getAccountHidden } from 'mastodon/selectors';
import { fetchFeaturedTags } from '../../actions/featured_tags'; import { fetchFeaturedTags } from '../../actions/featured_tags';
import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const emptyList = ImmutableList(); const emptyList = ImmutableList();
@ -157,10 +157,7 @@ class AccountTimeline extends ImmutablePureComponent {
); );
} else if (!isLoading && !isAccount) { } else if (!isLoading && !isAccount) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<ColumnBackButton multiColumn={multiColumn} />
<MissingIndicator />
</Column>
); );
} }

@ -17,11 +17,11 @@ import Column from '../ui/components/column';
import HeaderContainer from '../account_timeline/containers/header_container'; import HeaderContainer from '../account_timeline/containers/header_container';
import ColumnBackButton from '../../components/column_back_button'; import ColumnBackButton from '../../components/column_back_button';
import ScrollableList from '../../components/scrollable_list'; import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint'; import TimelineHint from 'mastodon/components/timeline_hint';
import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
import { getAccountHidden } from 'mastodon/selectors'; import { getAccountHidden } from 'mastodon/selectors';
import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const mapStateToProps = (state, { params: { acct, id } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
@ -111,9 +111,7 @@ class Followers extends ImmutablePureComponent {
if (!isAccount) { if (!isAccount) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<MissingIndicator />
</Column>
); );
} }

@ -17,11 +17,11 @@ import Column from '../ui/components/column';
import HeaderContainer from '../account_timeline/containers/header_container'; import HeaderContainer from '../account_timeline/containers/header_container';
import ColumnBackButton from '../../components/column_back_button'; import ColumnBackButton from '../../components/column_back_button';
import ScrollableList from '../../components/scrollable_list'; import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'mastodon/components/missing_indicator';
import TimelineHint from 'mastodon/components/timeline_hint'; import TimelineHint from 'mastodon/components/timeline_hint';
import LimitedAccountHint from '../account_timeline/components/limited_account_hint'; import LimitedAccountHint from '../account_timeline/components/limited_account_hint';
import { getAccountHidden } from 'mastodon/selectors'; import { getAccountHidden } from 'mastodon/selectors';
import { normalizeForLookup } from 'mastodon/reducers/accounts_map'; import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const mapStateToProps = (state, { params: { acct, id } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]); const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
@ -111,9 +111,7 @@ class Following extends ImmutablePureComponent {
if (!isAccount) { if (!isAccount) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<MissingIndicator />
</Column>
); );
} }

@ -1,11 +0,0 @@
import React from 'react';
import Column from '../ui/components/column';
import MissingIndicator from '../../components/missing_indicator';
const GenericNotFound = () => (
<Column>
<MissingIndicator fullPage />
</Column>
);
export default GenericNotFound;

@ -10,13 +10,12 @@ import { openModal } from 'mastodon/actions/modal';
import { connectListStream } from 'mastodon/actions/streaming'; import { connectListStream } from 'mastodon/actions/streaming';
import { expandListTimeline } from 'mastodon/actions/timelines'; import { expandListTimeline } from 'mastodon/actions/timelines';
import Column from 'mastodon/components/column'; import Column from 'mastodon/components/column';
import ColumnBackButton from 'mastodon/components/column_back_button';
import ColumnHeader from 'mastodon/components/column_header'; import ColumnHeader from 'mastodon/components/column_header';
import Icon from 'mastodon/components/icon'; import Icon from 'mastodon/components/icon';
import LoadingIndicator from 'mastodon/components/loading_indicator'; import LoadingIndicator from 'mastodon/components/loading_indicator';
import MissingIndicator from 'mastodon/components/missing_indicator';
import RadioButton from 'mastodon/components/radio_button'; import RadioButton from 'mastodon/components/radio_button';
import StatusListContainer from 'mastodon/features/ui/containers/status_list_container'; import StatusListContainer from 'mastodon/features/ui/containers/status_list_container';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const messages = defineMessages({ const messages = defineMessages({
deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, 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) { } else if (list === false) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<ColumnBackButton multiColumn={multiColumn} />
<MissingIndicator />
</Column>
); );
} }

@ -16,7 +16,6 @@ import {
translateStatus, translateStatus,
undoStatusTranslation, undoStatusTranslation,
} from '../../actions/statuses'; } from '../../actions/statuses';
import MissingIndicator from '../../components/missing_indicator';
import LoadingIndicator from 'mastodon/components/loading_indicator'; import LoadingIndicator from 'mastodon/components/loading_indicator';
import DetailedStatus from './components/detailed_status'; import DetailedStatus from './components/detailed_status';
import ActionBar from './components/action_bar'; import ActionBar from './components/action_bar';
@ -50,7 +49,6 @@ import { initBoostModal } from '../../actions/boosts';
import { initReport } from '../../actions/reports'; import { initReport } from '../../actions/reports';
import { makeGetStatus, makeGetPictureInPicture } from '../../selectors'; import { makeGetStatus, makeGetPictureInPicture } from '../../selectors';
import ScrollContainer from 'mastodon/containers/scroll_container'; import ScrollContainer from 'mastodon/containers/scroll_container';
import ColumnBackButton from '../../components/column_back_button';
import ColumnHeader from '../../components/column_header'; import ColumnHeader from '../../components/column_header';
import StatusContainer from '../../containers/status_container'; import StatusContainer from '../../containers/status_container';
import { openModal } from '../../actions/modal'; import { openModal } from '../../actions/modal';
@ -62,6 +60,7 @@ import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from
import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; import { textForScreenReader, defaultMediaVisibility } from '../../components/status';
import Icon from 'mastodon/components/icon'; import Icon from 'mastodon/components/icon';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
const messages = defineMessages({ const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@ -584,19 +583,16 @@ class Status extends ImmutablePureComponent {
if (status === null) { if (status === null) {
return ( return (
<Column> <BundleColumnError multiColumn={multiColumn} errorType='routing' />
<ColumnBackButton multiColumn={multiColumn} />
<MissingIndicator />
</Column>
); );
} }
if (ancestorsIds && ancestorsIds.size > 0) { if (ancestorsIds && ancestorsIds.size > 0) {
ancestors = <div>{this.renderChildren(ancestorsIds)}</div>; ancestors = <>{this.renderChildren(ancestorsIds)}</>;
} }
if (descendantsIds && descendantsIds.size > 0) { if (descendantsIds && descendantsIds.size > 0) {
descendants = <div>{this.renderChildren(descendantsIds)}</div>; descendants = <>{this.renderChildren(descendantsIds)}</>;
} }
const isLocal = status.getIn(['account', 'acct'], '').indexOf('@') === -1; const isLocal = status.getIn(['account', 'acct'], '').indexOf('@') === -1;

@ -82,10 +82,6 @@ export function FollowRequests () {
return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests'); return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests');
} }
export function GenericNotFound () {
return import(/* webpackChunkName: "features/generic_not_found" */'../../generic_not_found');
}
export function FavouritedStatuses () { export function FavouritedStatuses () {
return import(/* webpackChunkName: "features/favourited_statuses" */'../../favourited_statuses'); return import(/* webpackChunkName: "features/favourited_statuses" */'../../favourited_statuses');
} }

@ -353,19 +353,6 @@
], ],
"path": "app/javascript/mastodon/components/media_gallery.json" "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": [ "descriptors": [
{ {

Loading…
Cancel
Save