@eeacms/volto-n2k 0.1.13 → 0.1.15

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,11 +4,18 @@ 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
- ### [0.1.13](https://github.com/eea/volto-n2k/compare/0.1.12...0.1.13) - 30 September 2022
7
+ ### [0.1.15](https://github.com/eea/volto-n2k/compare/0.1.14...0.1.15) - 19 October 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Update [Miu Razvan - [`d26e4b1`](https://github.com/eea/volto-n2k/commit/d26e4b125e03ee106473bae2c893953f9d4932fc)]
12
+ ### [0.1.14](https://github.com/eea/volto-n2k/compare/0.1.13...0.1.14) - 18 October 2022
8
13
 
9
14
  #### :hammer_and_wrench: Others
10
15
 
11
- - Rerun cypress [Miu Razvan - [`37b91e4`](https://github.com/eea/volto-n2k/commit/37b91e409a18b200e7b480e3d36c2f93c12e4fe5)]
16
+ - Prettier fix [Miu Razvan - [`0a9192d`](https://github.com/eea/volto-n2k/commit/0a9192dd9d51620f68b4adcc76aa0a58435700ca)]
17
+ ### [0.1.13](https://github.com/eea/volto-n2k/compare/0.1.12...0.1.13) - 30 September 2022
18
+
12
19
  ### [0.1.12](https://github.com/eea/volto-n2k/compare/0.1.11...0.1.12) - 30 September 2022
13
20
 
14
21
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -4,6 +4,7 @@ import { generatePath } from 'react-router';
4
4
  import { Grid } from 'semantic-ui-react';
5
5
  import { UniversalLink } from '@plone/volto/components';
6
6
  import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
7
+ import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
7
8
  import hiker from './images/hiker.webp';
8
9
  import { tiles, tileProps, getStyle } from './index';
9
10
 
@@ -18,6 +19,21 @@ const DefaultView = (props) => {
18
19
  >
19
20
  <Grid className="landing-page" container columns="12">
20
21
  <Grid.Row>
22
+ <Grid.Column
23
+ {...{
24
+ mobile: 12,
25
+ tablet: 12,
26
+ computer: 12,
27
+ largeScreen: 12,
28
+ widescreen: 12,
29
+ }}
30
+ style={{ zIndex: 1, marginBottom: '1rem' }}
31
+ >
32
+ <LanguageSelector
33
+ navigation={props.navigation}
34
+ className="landingpage-variation"
35
+ />
36
+ </Grid.Column>
21
37
  <Grid.Column
22
38
  className="landing-page-description"
23
39
  widescreen="6"
@@ -79,5 +95,6 @@ const DefaultView = (props) => {
79
95
  };
80
96
 
81
97
  export default connect((state) => ({
98
+ navigation: state.navigation,
82
99
  screen: state.screen,
83
100
  }))(withLocalStorage(DefaultView));
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { connect } from 'react-redux';
2
3
  import { Grid, Button } from 'semantic-ui-react';
3
4
  import { isEmpty } from 'lodash';
4
5
  import EditBlockWrapper from './EditBlockWrapper';
@@ -8,6 +9,7 @@ import { SidebarPortal, UniversalLink } from '@plone/volto/components';
8
9
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
9
10
  import config from '@plone/volto/registry';
10
11
  import settingsSVG from '@plone/volto/icons/settings.svg';
12
+ import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
11
13
  import DefaultView from './DefalutView';
12
14
  import getSchema from './schema';
13
15
  import hiker from './images/hiker.webp';
@@ -98,6 +100,21 @@ const Edit = (props) => {
98
100
  >
99
101
  <Grid className="landing-page" container columns="12">
100
102
  <Grid.Row>
103
+ <Grid.Column
104
+ {...{
105
+ mobile: 12,
106
+ tablet: 12,
107
+ computer: 12,
108
+ largeScreen: 12,
109
+ widescreen: 12,
110
+ }}
111
+ style={{ zIndex: 1, marginBottom: '1rem' }}
112
+ >
113
+ <LanguageSelector
114
+ navigation={props.navigation}
115
+ className="landingpage-variation"
116
+ />
117
+ </Grid.Column>
101
118
  <Grid.Column
102
119
  className="landing-page-description"
103
120
  widescreen="6"
@@ -216,4 +233,7 @@ const Edit = (props) => {
216
233
  );
217
234
  };
218
235
 
219
- export default Edit;
236
+ export default connect((state) => ({
237
+ navigation: state.navigation,
238
+ screen: state.screen,
239
+ }))(Edit);
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { connect } from 'react-redux';
2
3
  import { Grid } from 'semantic-ui-react';
3
4
  import { RenderBlocks, UniversalLink } from '@plone/volto/components';
5
+ import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
4
6
  import DefaultView from './DefalutView';
5
7
  import hiker from './images/hiker.webp';
6
8
  import { tileProps, getStyle } from './index';
@@ -15,9 +17,27 @@ const View = (props) => {
15
17
  return useDefault ? (
16
18
  <DefaultView {...props} />
17
19
  ) : (
18
- <div className="landing-page-wrapper full-width" style={getStyle(props)}>
20
+ <div
21
+ className="landing-page-wrapper default full-width"
22
+ style={getStyle(props)}
23
+ >
19
24
  <Grid className="landing-page" container columns="12">
20
25
  <Grid.Row>
26
+ <Grid.Column
27
+ {...{
28
+ mobile: 12,
29
+ tablet: 12,
30
+ computer: 12,
31
+ largeScreen: 12,
32
+ widescreen: 12,
33
+ }}
34
+ style={{ zIndex: 1, marginBottom: '1rem' }}
35
+ >
36
+ <LanguageSelector
37
+ navigation={props.navigation}
38
+ className="landingpage-variation"
39
+ />
40
+ </Grid.Column>
21
41
  <Grid.Column
22
42
  className="landing-page-description"
23
43
  widescreen="6"
@@ -62,4 +82,7 @@ const View = (props) => {
62
82
  );
63
83
  };
64
84
 
65
- export default View;
85
+ export default connect((state) => ({
86
+ navigation: state.navigation,
87
+ screen: state.screen,
88
+ }))(View);
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import React, { useEffect, useContext } from 'react';
7
- import { withRouter } from 'react-router';
7
+ import { matchPath, withRouter } from 'react-router';
8
8
  import { Container, Sticky } from 'semantic-ui-react';
9
9
  import { connect } from 'react-redux';
10
10
  import { Portal } from 'react-portal';
@@ -47,6 +47,11 @@ const Navbar = (props) => {
47
47
  const Header = (props) => {
48
48
  const [isSticky, setIsSticky] = React.useState(false);
49
49
  const { stickyRef } = useContext(StickyContext);
50
+ const isRoot = !!matchPath(props.pathname, {
51
+ path: config.settings.multilingualRoot,
52
+ exact: true,
53
+ strict: false,
54
+ });
50
55
 
51
56
  useEffect(() => {
52
57
  if (!props.localStorage.get('N2K_LANGUAGE')) {
@@ -55,7 +60,7 @@ const Header = (props) => {
55
60
  /* eslint-disable-next-line */
56
61
  }, []);
57
62
 
58
- return props.location.pathname === '/natura2000' ? (
63
+ return isRoot ? (
59
64
  ''
60
65
  ) : (
61
66
  <>
@@ -6,6 +6,7 @@
6
6
  import React from 'react';
7
7
  import { withRouter, matchPath, generatePath } from 'react-router';
8
8
  import { useSelector } from 'react-redux';
9
+ import cx from 'classnames';
9
10
  import { langmap } from '@plone/volto/helpers';
10
11
  import { flattenToAppURL } from '@plone/volto/helpers';
11
12
  import { Dropdown } from 'semantic-ui-react';
@@ -21,21 +22,31 @@ const LanguageSelector = (props) => {
21
22
  const localStorage = props.localStorage;
22
23
  const pathname = props.location.pathname;
23
24
  const currentLang = localStorage.get('N2K_LANGUAGE');
24
- const match = matchPath(pathname, {
25
+ const matchRoot = matchPath(pathname, {
26
+ path: settings.multilingualRoot,
27
+ exact: true,
28
+ strict: false,
29
+ });
30
+ const matchChild = matchPath(pathname, {
25
31
  path: settings.multilingualPath,
26
32
  exact: true,
27
33
  strict: false,
28
34
  });
35
+ const match = matchRoot || matchChild;
29
36
  const hasMultilingualSupport =
30
37
  match && settings.supportedLanguages.includes(match.params.lang);
31
38
  const translations = hasMultilingualSupport
32
- ? settings.supportedLanguages.map((lang) => ({
33
- path: generatePath(settings.multilingualPath, {
34
- ...match.params,
39
+ ? settings.supportedLanguages.map((lang) => {
40
+ return {
41
+ path: matchRoot
42
+ ? `/natura2000/${lang}`
43
+ : generatePath(settings.multilingualPath, {
44
+ ...match.params,
45
+ lang,
46
+ }),
35
47
  lang,
36
- }),
37
- lang,
38
- }))
48
+ };
49
+ })
39
50
  : [];
40
51
  const supportedLanguagesOptions = settings.supportedLanguages.map((lang) => ({
41
52
  key: lang,
@@ -44,7 +55,7 @@ const LanguageSelector = (props) => {
44
55
  }));
45
56
 
46
57
  return (
47
- <div className="language-selector">
58
+ <div className={cx('language-selector', props.className)}>
48
59
  <Dropdown
49
60
  aria-label="Language selector"
50
61
  disabled={content.get.loading}
@@ -41,4 +41,11 @@
41
41
  }
42
42
  }
43
43
  }
44
+
45
+ &.landingpage-variation {
46
+ .divider.text {
47
+ color: #fff !important;
48
+ font-size: 20px;
49
+ }
50
+ }
44
51
  }
@@ -102,6 +102,7 @@ class Navigation extends Component {
102
102
  this.state = {
103
103
  isMobileMenuOpen: false,
104
104
  isSdf: false,
105
+ language: this.props.localStorage.get('N2K_LANGUAGE'),
105
106
  };
106
107
  this.container = React.createRef();
107
108
  }
@@ -260,7 +261,7 @@ class Navigation extends Component {
260
261
  />
261
262
  </div>
262
263
  <Menu.Item className="home-button logo">
263
- <Link title="Natura 2000" to="/natura2000">
264
+ <Link title="Natura 2000" to={`/natura2000/${this.state.language}`}>
264
265
  <Icon name={n2kLogo} size={44} />
265
266
  </Link>
266
267
  </Menu.Item>