-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathutils.js
More file actions
51 lines (46 loc) · 1.32 KB
/
utils.js
File metadata and controls
51 lines (46 loc) · 1.32 KB
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
import i18n from '../../locales/index.js'
export const AO_TYPE_VISUALIZATION = 'visualization'
export const AO_TYPE_MAP = 'map'
export const AO_TYPE_EVENT_VISUALIZATION = 'eventVisualization'
export const AO_TYPE_EVENT_CHART = 'eventChart'
export const AO_TYPE_EVENT_REPORT = 'eventReport'
export const AOTypeMap = {
[AO_TYPE_VISUALIZATION]: {
apiEndpoint: 'visualizations',
},
[AO_TYPE_MAP]: {
apiEndpoint: 'maps',
},
[AO_TYPE_EVENT_VISUALIZATION]: {
apiEndpoint: 'eventVisualizations',
},
[AO_TYPE_EVENT_CHART]: {
apiEndpoint: 'eventCharts',
},
[AO_TYPE_EVENT_REPORT]: {
apiEndpoint: 'eventReports',
},
}
const NO_TYPE = 'NO_TYPE'
const texts = {
[AO_TYPE_MAP]: {
unitTitle: i18n.t('About this map'),
},
[AO_TYPE_EVENT_VISUALIZATION]: {
unitTitle: i18n.t('About this line list'),
},
[AO_TYPE_VISUALIZATION]: {
unitTitle: i18n.t('About this visualization'),
},
[AO_TYPE_EVENT_CHART]: {
unitTitle: i18n.t('About this event chart'),
},
[AO_TYPE_EVENT_REPORT]: {
unitTitle: i18n.t('About this event report'),
},
[NO_TYPE]: {
unitTitle: i18n.t('About this visualization'),
},
}
export const getTranslatedString = (type, key) =>
(texts[type] || texts[NO_TYPE])[key]