@eeacms/volto-n2k 0.1.13 → 0.1.14
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 +5 -2
- package/package.json +1 -1
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +17 -0
- package/src/components/manage/Blocks/Landing/Edit.jsx +20 -1
- package/src/components/manage/Blocks/Landing/View.jsx +20 -1
- package/src/components/theme/Header/Header.jsx +7 -2
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +19 -8
- package/src/components/theme/LanguageSelector/styles.less +7 -0
- package/src/components/theme/Navigation/Navigation.jsx +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,14 @@ 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.
|
|
7
|
+
### [0.1.14](https://github.com/eea/volto-n2k/compare/0.1.13...0.1.14) - 18 October 2022
|
|
8
8
|
|
|
9
9
|
#### :hammer_and_wrench: Others
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- Prettier fix [Miu Razvan - [`0a9192d`](https://github.com/eea/volto-n2k/commit/0a9192dd9d51620f68b4adcc76aa0a58435700ca)]
|
|
12
|
+
- Multilanguage landing page [Miu Razvan - [`a7ceedf`](https://github.com/eea/volto-n2k/commit/a7ceedf0fe304f0a220aa1b6f2737c86537e15da)]
|
|
13
|
+
### [0.1.13](https://github.com/eea/volto-n2k/compare/0.1.12...0.1.13) - 30 September 2022
|
|
14
|
+
|
|
12
15
|
### [0.1.12](https://github.com/eea/volto-n2k/compare/0.1.11...0.1.12) - 30 September 2022
|
|
13
16
|
|
|
14
17
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -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,6 @@ const Edit = (props) => {
|
|
|
216
233
|
);
|
|
217
234
|
};
|
|
218
235
|
|
|
219
|
-
export default
|
|
236
|
+
export default connect((state) => ({
|
|
237
|
+
navigation: state.navigation,
|
|
238
|
+
}))(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';
|
|
@@ -17,6 +19,21 @@ const View = (props) => {
|
|
|
17
19
|
) : (
|
|
18
20
|
<div className="landing-page-wrapper full-width" style={getStyle(props)}>
|
|
19
21
|
<Grid className="landing-page" container columns="12">
|
|
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>
|
|
20
37
|
<Grid.Row>
|
|
21
38
|
<Grid.Column
|
|
22
39
|
className="landing-page-description"
|
|
@@ -62,4 +79,6 @@ const View = (props) => {
|
|
|
62
79
|
);
|
|
63
80
|
};
|
|
64
81
|
|
|
65
|
-
export default
|
|
82
|
+
export default connect((state) => ({
|
|
83
|
+
navigation: state.navigation,
|
|
84
|
+
}))(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
|
|
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
|
|
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
|
-
|
|
34
|
-
|
|
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
|
-
|
|
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=
|
|
58
|
+
<div className={cx('language-selector', props.className)}>
|
|
48
59
|
<Dropdown
|
|
49
60
|
aria-label="Language selector"
|
|
50
61
|
disabled={content.get.loading}
|
|
@@ -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=
|
|
264
|
+
<Link title="Natura 2000" to={`/natura2000/${this.state.language}`}>
|
|
264
265
|
<Icon name={n2kLogo} size={44} />
|
|
265
266
|
</Link>
|
|
266
267
|
</Menu.Item>
|