This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
error_title.jsx
92 lines (85 loc) · 2.59 KB
/
error_title.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import PropTypes from 'prop-types';
import React from 'react';
import {FormattedMessage} from 'react-intl';
import {ErrorPageTypes} from 'utils/constants.jsx';
import * as Utils from 'utils/utils.jsx';
export default function ErrorTitle({type, title}) {
let errorTitle = null;
if (type) {
switch (type) {
case ErrorPageTypes.LOCAL_STORAGE:
errorTitle = (
<FormattedMessage
id='error.local_storage.title'
defaultMessage='Cannot Load Mattermost'
/>
);
break;
case ErrorPageTypes.PERMALINK_NOT_FOUND:
errorTitle = (
<FormattedMessage
id='permalink.error.title'
defaultMessage='Message Not Found'
/>
);
break;
case ErrorPageTypes.OAUTH_ACCESS_DENIED:
errorTitle = (
<FormattedMessage
id='error.oauth_access_denied.title'
defaultMessage='Authorization Error'
/>
);
break;
case ErrorPageTypes.OAUTH_MISSING_CODE:
errorTitle = (
<FormattedMessage
id='error.oauth_missing_code.title'
defaultMessage='Mattermost needs your help'
/>
);
break;
case ErrorPageTypes.TEAM_NOT_FOUND:
errorTitle = (
<FormattedMessage
id='error.team_not_found.title'
defaultMessage='Team Not Found'
/>
);
break;
case ErrorPageTypes.CHANNEL_NOT_FOUND:
errorTitle = (
<FormattedMessage
id='error.channel_not_found.title'
defaultMessage='Channel Not Found'
/>
);
break;
case ErrorPageTypes.PAGE_NOT_FOUND:
default:
errorTitle = (
<FormattedMessage
id='error.not_found.title'
defaultMessage='Page Not Found'
/>
);
}
} else if (title) {
errorTitle = title;
} else {
errorTitle = Utils.localizeMessage('error.generic.title', 'Error');
}
return errorTitle;
}
ErrorTitle.propTypes = {
/*
* Error type
*/
type: PropTypes.string,
/*
* Error title
*/
title: PropTypes.string,
};