-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathutils.js
More file actions
82 lines (76 loc) · 2.99 KB
/
utils.js
File metadata and controls
82 lines (76 loc) · 2.99 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
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
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 AOTypeMap = {
[AO_TYPE_VISUALIZATION]: {
apiEndpoint: 'visualizations',
},
[AO_TYPE_MAP]: {
apiEndpoint: 'maps',
},
[AO_TYPE_EVENT_VISUALIZATION]: {
apiEndpoint: 'eventVisualizations',
},
}
const NO_TYPE = 'NO_TYPE'
const texts = {
[NO_TYPE]: {
modalTitle: i18n.t('Open'),
loadingText: i18n.t('Loading'),
errorTitle: i18n.t("Couldn't load items"),
errorText: i18n.t(
'There was a problem loading items. Try again or contact your system administrator.'
),
noDataText: i18n.t('No items found. Create a new to get started.'),
noFilteredDataText: i18n.t(
"No items found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('Create new'),
},
[AO_TYPE_VISUALIZATION]: {
modalTitle: i18n.t('Open a visualization'),
loadingText: i18n.t('Loading visualizations'),
errorTitle: i18n.t("Couldn't load visualizations"),
errorText: i18n.t(
'There was a problem loading visualizations. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No visualizations found. Click New visualization to get started.'
),
noFilteredDataText: i18n.t(
"No visualizations found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New visualization'),
},
[AO_TYPE_MAP]: {
modalTitle: i18n.t('Open a map'),
loadingText: i18n.t('Loading maps'),
errorTitle: i18n.t("Couldn't load maps"),
errorText: i18n.t(
'There was a problem loading maps. Try again or contact your system administrator.'
),
noDataText: i18n.t('No maps found. Click New map to get started.'),
noFilteredDataText: i18n.t(
"No maps found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New map'),
},
[AO_TYPE_EVENT_VISUALIZATION]: {
modalTitle: i18n.t('Open a line list'),
loadingText: i18n.t('Loading line lists'),
errorTitle: i18n.t("Couldn't load line lists"),
errorText: i18n.t(
'There was a problem loading line lists. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No line lists found. Click New line list to get started.'
),
noFilteredDataText: i18n.t(
"No line lists found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New line list'),
},
}
export const getTranslatedString = (type, key) =>
(texts[type] || texts[NO_TYPE])[key]