@eeacms/volto-cca-policy 0.2.93 → 0.2.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { defineMessages, FormattedMessage } from 'react-intl';
1
2
  import loadable from '@loadable/component';
2
3
  import { compose } from 'redux';
3
4
  import { Sitemap } from '@plone/volto/components';
@@ -43,6 +44,21 @@ const getEnv = () => (typeof window !== 'undefined' ? window.env : process.env);
43
44
 
44
45
  const pathToNegRegex = (p) => `(?!(${p}))`;
45
46
 
47
+ const messages = defineMessages({
48
+ placeholderClimateSearch: {
49
+ id: 'Search the Climate-ADAPT database',
50
+ defaultMessage: 'Search the Climate-ADAPT database',
51
+ },
52
+ placeholderObservatorySearch: {
53
+ id: 'Search the Observatory Resource Catalogue...',
54
+ defaultMessage: 'Search the Observatory Resource Catalogue...',
55
+ },
56
+ placeholderMissionSearch: {
57
+ id: 'Search the EU Mission on Adaptation',
58
+ defaultMessage: 'Search the EU Mission on Adaptation',
59
+ },
60
+ });
61
+
46
62
  const applyConfig = (config) => {
47
63
  const env = getEnv();
48
64
 
@@ -172,33 +188,67 @@ const applyConfig = (config) => {
172
188
  {
173
189
  isDefault: false,
174
190
  // to replace search path change path to whatever you want and match with the page in volto website
175
- matchpath: '/en/mission',
176
- path: '/en/mission/advanced-search',
177
- placeholder: 'Search the EU Mission on Adaptation',
178
- description: 'For more search options',
179
- buttonTitle: 'Go to advanced search',
180
- buttonUrl:
181
- 'https://climate-adapt.eea.europa.eu/en/mission/advanced-search/',
191
+ matchpath: /\/([a-z]{2})\/mission/,
192
+ path: ({ currentLang }) => `/${currentLang}/mission/advanced-search`,
193
+ placeholder: ({ intl }) =>
194
+ intl.formatMessage(messages.placeholderMissionSearch),
195
+ description: (
196
+ <FormattedMessage
197
+ id="For more search options"
198
+ defaultMessage="For more search options"
199
+ />
200
+ ),
201
+ buttonTitle: (
202
+ <FormattedMessage
203
+ id="Go to advanced search"
204
+ defaultMessage="Go to advanced search"
205
+ />
206
+ ),
207
+ buttonUrl: ({ currentLang }) =>
208
+ `/${currentLang}/mission/advanced-search/`,
182
209
  },
183
210
  {
184
211
  isDefault: false,
185
212
  // to replace search path change path to whatever you want and match with the page in volto website
186
- matchpath: '/en/observatory',
187
- path: '/en/observatory/advanced-search',
188
- placeholder: 'Search the Observatory Resource Catalogue...',
189
- description: 'Looking for more information?',
190
- buttonTitle: 'Explore more on Climate-ADAPT',
191
- buttonUrl: 'https://climate-adapt.eea.europa.eu/en/data-and-downloads/',
213
+ matchpath: /\/([a-z]{2})\/observatory/,
214
+ path: ({ currentLang }) =>
215
+ `/${currentLang}/observatory/advanced-search`,
216
+ placeholder: ({ intl }) =>
217
+ intl.formatMessage(messages.placeholderObservatorySearch),
218
+ description: (
219
+ <FormattedMessage
220
+ id="Looking for more information?"
221
+ defaultMessage="Looking for more information?"
222
+ />
223
+ ),
224
+ buttonTitle: (
225
+ <FormattedMessage
226
+ id="Explore more on Climate-ADAPT"
227
+ defaultMessage="Explore more on Climate-ADAPT"
228
+ />
229
+ ),
230
+ buttonUrl: ({ currentLang }) => `/${currentLang}/data-and-downloads/`,
192
231
  },
193
232
  {
194
233
  isDefault: true,
195
234
  // to replace search path change path to whatever you want and match with the page in volto website
196
235
  matchpath: '/',
197
- path: '/en/data-and-downloads',
198
- placeholder: 'Search the Climate-ADAPT database',
199
- description: 'Looking for more information?',
200
- buttonTitle: 'Explore more on Climate-ADAPT',
201
- buttonUrl: 'https://climate-adapt.eea.europa.eu/en/data-and-downloads/',
236
+ path: ({ currentLang }) => `/${currentLang}/data-and-downloads`,
237
+ placeholder: ({ intl }) =>
238
+ intl.formatMessage(messages.placeholderClimateSearch),
239
+ description: (
240
+ <FormattedMessage
241
+ id="Looking for more information?"
242
+ defaultMessage="Looking for more information?"
243
+ />
244
+ ),
245
+ buttonTitle: (
246
+ <FormattedMessage
247
+ id="Explore more on Climate-ADAPT"
248
+ defaultMessage="Explore more on Climate-ADAPT"
249
+ />
250
+ ),
251
+ buttonUrl: ({ currentLang }) => `/${currentLang}/data-and-downloads/`,
202
252
  },
203
253
  ],
204
254
  logoTargetUrl: '/',