@eeacms/volto-eea-website-theme 1.8.0 → 1.8.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.8.1](https://github.com/eea/volto-eea-website-theme/compare/1.8.0...1.8.1) - 9 February 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(NotFound): wrap withRootNavigation in NotFound to have menu in 404 [nileshgulia1 - [`9f66a69`](https://github.com/eea/volto-eea-website-theme/commit/9f66a69b005f1a3d5446c67a1649c895f8c87d87)]
12
+ - feat(search): Make random suggestions to show [kreafox - [`e62041e`](https://github.com/eea/volto-eea-website-theme/commit/e62041ead4895e9c4d85dc2c93895607c71b2f1a)]
13
+ - feat(search): Max 6 suggestions [kreafox - [`99ffc75`](https://github.com/eea/volto-eea-website-theme/commit/99ffc754fddad95f44893f30ac3bfc76aacadb43)]
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix(search): Fix undefined value [kreafox - [`51d49c2`](https://github.com/eea/volto-eea-website-theme/commit/51d49c2786ce97f7886e3d03d328a3858182b23a)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - do not customize 404 [nileshgulia1 - [`446c1cd`](https://github.com/eea/volto-eea-website-theme/commit/446c1cdd121dd80a9e1efac2ee897b050eb99215)]
22
+ - test(lint): Fix lint [Alin Voinea - [`57722a3`](https://github.com/eea/volto-eea-website-theme/commit/57722a3477295cde2735d8a366c46e4105a9f9a3)]
23
+ - Update config.js [Tiberiu Ichim - [`a1685b8`](https://github.com/eea/volto-eea-website-theme/commit/a1685b85ea0badec5dca8655c2ea7e6d11afbece)]
24
+ - Updated search header configuration [Tiberiu Ichim - [`8e3d9e9`](https://github.com/eea/volto-eea-website-theme/commit/8e3d9e9339919351ac8bb9fffde12744432ce313)]
7
25
  ### [1.8.0](https://github.com/eea/volto-eea-website-theme/compare/1.7.0...1.8.0) - 8 February 2023
8
26
 
9
27
  #### :rocket: New Features
@@ -86,6 +104,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
86
104
 
87
105
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
88
106
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
107
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
89
108
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
90
109
 
91
110
  #### :hammer_and_wrench: Others
@@ -119,6 +138,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
119
138
 
120
139
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
121
140
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
141
+ - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
122
142
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
123
143
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
124
144
 
@@ -128,6 +148,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
128
148
 
129
149
  #### :hammer_and_wrench: Others
130
150
 
151
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
131
152
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
132
153
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
133
154
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -136,6 +157,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
136
157
 
137
158
  - feat(Footer): Bring back footer contacts extra actions - refs #151856 [Alin Voinea - [`6c19413`](https://github.com/eea/volto-eea-website-theme/commit/6c194139420c9fd847692d180db1c1593e2483de)]
138
159
 
160
+ #### :hammer_and_wrench: Others
161
+
162
+ - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
139
163
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
140
164
 
141
165
  #### :rocket: New Features
@@ -176,6 +200,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
176
200
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
177
201
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
178
202
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
203
+ - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
179
204
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
180
205
 
181
206
  #### :nail_care: Enhancements
@@ -223,6 +248,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
223
248
 
224
249
  #### :hammer_and_wrench: Others
225
250
 
251
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
226
252
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
227
253
 
228
254
  #### :hammer_and_wrench: Others
@@ -490,6 +516,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
490
516
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
491
517
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
492
518
  - feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
519
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
493
520
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
494
521
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
495
522
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -531,4 +558,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
531
558
 
532
559
  #### :hammer_and_wrench: Others
533
560
 
561
+ - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
534
562
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -0,0 +1,6 @@
1
+ import { compose } from 'redux';
2
+ import { injectIntl } from 'react-intl';
3
+ import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
4
+ import { NotFound } from '@plone/volto/components';
5
+
6
+ export default compose(injectIntl, withRootNavigation)(NotFound);
package/src/config.js CHANGED
@@ -258,17 +258,29 @@ export const headerSearchBox = [
258
258
  {
259
259
  isDefault: true,
260
260
  path: '/en/advanced-search',
261
- placeholder: 'Search...',
262
- description:
263
- 'Looking for more information? Try searching the full EEA website content',
264
- buttonTitle: 'Go to full site search',
261
+ placeholder: 'Search or ask your question...',
262
+ description: 'For more search options',
263
+ buttonTitle: 'Go to advanced search',
264
+ searchSuggestions: {
265
+ maxToShow: 6,
266
+ suggestionsTitle: 'Try our suggestions',
267
+ suggestions: [
268
+ 'What is PFAS?',
269
+ 'Which transport mode has the lowest pollution?',
270
+ 'Which countries use most renewable energy?',
271
+ 'How many premature deaths are attributed to PM2.5?',
272
+ 'How many premature deaths are attributed to air pollution?',
273
+ 'How much have new cars co2 emissions decreased?',
274
+ 'What countries had the highest land take in the EEA-39?',
275
+ 'How many people are exposed to air pollution?',
276
+ ],
277
+ },
265
278
  },
266
279
  {
267
280
  path: '/en/datahub',
268
281
  placeholder: 'Search Datahub...',
269
- description:
270
- 'Looking for more information? Try searching the full EEA website content',
271
- buttonTitle: 'Go to full site search',
282
+ description: 'Looking for more information?',
283
+ buttonTitle: 'Go to advanced search',
272
284
  },
273
285
  ];
274
286
 
@@ -1,9 +1,15 @@
1
1
  import React from 'react';
2
- import { Container, Input } from 'semantic-ui-react';
2
+ import { Container, Input, List } from 'semantic-ui-react';
3
3
  import { withRouter } from 'react-router-dom';
4
4
  import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
5
5
  import config from '@plone/volto/registry';
6
6
 
7
+ const getRandomItems = (arr, max) => {
8
+ return arr.slice(0, max).map(function () {
9
+ return this.splice(Math.floor(Math.random() * this.length), 1)[0];
10
+ }, arr.slice());
11
+ };
12
+
7
13
  function HeaderSearchPopUp({
8
14
  history,
9
15
  location,
@@ -18,8 +24,18 @@ function HeaderSearchPopUp({
18
24
  location.pathname.includes(v.path),
19
25
  );
20
26
  const activeView = localView.length > 0 ? localView[0] : defaultView[0];
21
-
27
+ const {
28
+ path,
29
+ placeholder,
30
+ buttonTitle,
31
+ description,
32
+ searchSuggestions,
33
+ } = activeView;
34
+ const { suggestionsTitle, suggestions, maxToShow } = searchSuggestions || {};
22
35
  const [text, setText] = React.useState('');
36
+ const visibleSuggestions = suggestions
37
+ ? getRandomItems(suggestions, maxToShow)
38
+ : [];
23
39
 
24
40
  useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
25
41
 
@@ -29,7 +45,7 @@ function HeaderSearchPopUp({
29
45
  };
30
46
 
31
47
  const onSubmit = (event) => {
32
- history.push(`${activeView.path}?q=${text}`);
48
+ history.push(`${path}?q=${text}`);
33
49
 
34
50
  if (window?.searchContext?.resetSearch) {
35
51
  window.searchContext.resetSearch({ searchTerm: text });
@@ -39,11 +55,21 @@ function HeaderSearchPopUp({
39
55
  event.preventDefault();
40
56
  };
41
57
 
58
+ const onClickHandler = (suggestion) => {
59
+ history.push(`${path}?q=${suggestion}`);
60
+
61
+ if (window?.searchContext?.resetSearch) {
62
+ window.searchContext.resetSearch({ searchTerm: suggestion });
63
+ }
64
+
65
+ onClose();
66
+ };
67
+
42
68
  return (
43
69
  <div id="search-box" ref={nodeRef}>
44
- <form method="get" onSubmit={onSubmit}>
70
+ <div className="wrapper">
45
71
  <Container>
46
- <div className="wrapper">
72
+ <form method="get" onSubmit={onSubmit}>
47
73
  <Input
48
74
  ref={searchInputRef}
49
75
  className="search"
@@ -53,26 +79,41 @@ function HeaderSearchPopUp({
53
79
  link: true,
54
80
  onClick: onSubmit,
55
81
  }}
56
- placeholder={activeView.placeholder}
82
+ placeholder={placeholder}
57
83
  fluid
58
84
  />
59
- </div>
85
+ </form>
86
+ {searchSuggestions && suggestions.length > 0 && (
87
+ <div className="search-suggestions">
88
+ {suggestionsTitle && <h4>{suggestionsTitle}</h4>}
89
+
90
+ <List>
91
+ {visibleSuggestions.map((item, i) => {
92
+ return (
93
+ <List.Item key={i} onClick={() => onClickHandler(item)}>
94
+ {item}
95
+ </List.Item>
96
+ );
97
+ })}
98
+ </List>
99
+ </div>
100
+ )}
60
101
  </Container>
61
- </form>
62
- {activeView.buttonTitle && (
63
- <div className="advanced-search">
64
- <Container>
65
- <p>{activeView.description}</p>
66
- <a
67
- href={defaultView[0].path}
68
- className="ui button white inverted"
69
- title="Advanced search"
70
- >
71
- {activeView.buttonTitle}
72
- </a>
73
- </Container>
74
- </div>
75
- )}
102
+ {buttonTitle && (
103
+ <div className="advanced-search">
104
+ <Container>
105
+ <div>{description}</div>
106
+ <a
107
+ href={defaultView[0].path}
108
+ className="ui button white inverted"
109
+ title="Advanced search"
110
+ >
111
+ {buttonTitle}
112
+ </a>
113
+ </Container>
114
+ </div>
115
+ )}
116
+ </div>
76
117
  </div>
77
118
  );
78
119
  }
@@ -0,0 +1,3 @@
1
+ import withRootNavigation from './withRootNavigation';
2
+
3
+ export { withRootNavigation };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { connect, useDispatch } from 'react-redux';
3
+ import { getBaseUrl, hasApiExpander } from '@plone/volto/helpers';
4
+ import { getNavigation } from '@plone/volto/actions';
5
+ import config from '@plone/volto/registry';
6
+
7
+ export default function withRootNavigation(WrappedComponent) {
8
+ return connect(
9
+ (state) => {
10
+ return {
11
+ items: state.navigation.items,
12
+ lang: state.intl.locale,
13
+ };
14
+ },
15
+ { getNavigation },
16
+ )((props) => {
17
+ const dispatch = useDispatch();
18
+ React.useEffect(() => {
19
+ const { settings } = config;
20
+ const currentLang = props.lang;
21
+ const base_url = getBaseUrl(`/${currentLang}`);
22
+ if (!hasApiExpander('navigation', base_url)) {
23
+ dispatch(getNavigation(base_url, settings.navDepth));
24
+ }
25
+ }, [props.lang, dispatch]);
26
+
27
+ return <WrappedComponent {...props} items={props.items} />;
28
+ });
29
+ }
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ import * as eea from './config';
2
2
  import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
3
3
  import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
4
4
  import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
5
+ import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
5
6
  import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
6
7
  import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
7
8
  import SubsiteClass from './components/theme/SubsiteClass';
@@ -48,7 +49,10 @@ const applyConfig = (config) => {
48
49
  homepage_view: 'Homepage view',
49
50
  homepage_inverse_view: 'Homepage white view',
50
51
  };
51
-
52
+ config.views.errorViews = {
53
+ ...config.views.errorViews,
54
+ '404': NotFound,
55
+ };
52
56
  // Apply accordion block customization
53
57
  if (config.blocks.blocksConfig.accordion) {
54
58
  config.blocks.blocksConfig.accordion.semanticIcon = 'ri-arrow-down-s-line';