You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/frontend/src/Components/Page/ErrorPage.js

66 lines
2.1 KiB

7 years ago
import PropTypes from 'prop-types';
import React from 'react';
import getErrorMessage from 'Utilities/Object/getErrorMessage';
import translate from 'Utilities/String/translate';
7 years ago
import styles from './ErrorPage.css';
function ErrorPage(props) {
const {
version,
isLocalStorageSupported,
translationsError,
7 years ago
seriesError,
customFiltersError,
tagsError,
qualityProfilesError,
uiSettingsError,
systemStatusError
7 years ago
} = props;
let errorMessage = translate('FailedToLoadSonarr');
7 years ago
if (!isLocalStorageSupported) {
errorMessage = translate('LocalStorageIsNotSupported');
} else if (translationsError) {
errorMessage = getErrorMessage(translationsError, translate('FailedToLoadTranslationsFromApi'));
7 years ago
} else if (seriesError) {
errorMessage = getErrorMessage(seriesError, translate('FailedToLoadSeriesFromApi'));
7 years ago
} else if (customFiltersError) {
errorMessage = getErrorMessage(customFiltersError, translate('FailedToLoadCustomFiltersFromApi'));
7 years ago
} else if (tagsError) {
errorMessage = getErrorMessage(tagsError, translate('FailedToLoadTagsFromApi'));
7 years ago
} else if (qualityProfilesError) {
errorMessage = getErrorMessage(qualityProfilesError, translate('FailedToLoadQualityProfilesFromApi'));
7 years ago
} else if (uiSettingsError) {
errorMessage = getErrorMessage(uiSettingsError, translate('FailedToLoadUiSettingsFromApi'));
} else if (systemStatusError) {
errorMessage = getErrorMessage(uiSettingsError, translate('FailedToLoadSystemStatusFromApi'));
7 years ago
}
return (
<div className={styles.page}>
<div className={styles.errorMessage}>
{errorMessage}
</div>
<div className={styles.version}>
{translate('VersionNumber', { version })}
7 years ago
</div>
</div>
);
}
ErrorPage.propTypes = {
version: PropTypes.string.isRequired,
isLocalStorageSupported: PropTypes.bool.isRequired,
translationsError: PropTypes.object,
7 years ago
seriesError: PropTypes.object,
customFiltersError: PropTypes.object,
tagsError: PropTypes.object,
qualityProfilesError: PropTypes.object,
uiSettingsError: PropTypes.object,
systemStatusError: PropTypes.object
7 years ago
};
export default ErrorPage;