@eeacms/volto-n2k 1.0.21 → 1.0.23

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/package.json +4 -5
  3. package/src/components/index.js +2 -2
  4. package/src/components/manage/Blocks/BodyClass/index.js +1 -1
  5. package/src/components/manage/Blocks/CarouselHorizontal/HorizontalView.jsx +84 -37
  6. package/src/components/manage/Blocks/CarouselHorizontal/styles.less +32 -0
  7. package/src/components/manage/Blocks/HabitatsBanner/Edit.jsx +49 -0
  8. package/src/components/manage/Blocks/HabitatsBanner/View.jsx +115 -21
  9. package/src/components/manage/Blocks/HabitatsBanner/chevron-left-square-fill-svgrepo-com.svg +9 -0
  10. package/src/components/manage/Blocks/HabitatsBanner/chevron-right-square-fill-svgrepo-com.svg +9 -0
  11. package/src/components/manage/Blocks/HabitatsBanner/index.js +18 -11
  12. package/src/components/manage/Blocks/HabitatsBanner/schema.js +64 -5
  13. package/src/components/manage/Blocks/HabitatsBanner/style.less +139 -17
  14. package/src/components/manage/Blocks/Landing/DefalutView.jsx +21 -11
  15. package/src/components/manage/Blocks/Landing/index.js +7 -6
  16. package/src/components/manage/Blocks/Landing/style.less +54 -37
  17. package/src/components/manage/Blocks/NavigationAnchors/View.jsx +16 -10
  18. package/src/components/manage/Blocks/NavigationAnchors/styles.less +2 -0
  19. package/src/components/manage/Blocks/SiteBanner/style.less +4 -0
  20. package/src/components/manage/Blocks/SiteShape/View.jsx +4 -4
  21. package/src/components/manage/Blocks/SiteSpeciesList/style.less +2 -1
  22. package/src/components/manage/Blocks/TilesImages/View.jsx +1 -0
  23. package/src/index.js +1 -48
  24. package/src/less/styles.less +0 -42
  25. package/src/components/theme/Footer/Footer.jsx +0 -209
  26. package/src/components/theme/Header/Header.jsx +0 -169
  27. package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -98
  28. package/src/components/theme/LanguageSelector/styles.less +0 -62
  29. package/src/components/theme/Navigation/Navigation.jsx +0 -524
  30. package/src/components/theme/Navigation/bise.svg +0 -132
package/CHANGELOG.md CHANGED
@@ -4,11 +4,23 @@ 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.0.21](https://github.com/eea/volto-n2k/compare/1.0.20...1.0.21) - 22 March 2023
7
+ ### [1.0.23](https://github.com/eea/volto-n2k/compare/1.0.22...1.0.23) - 12 April 2023
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style(HabitatsBanner): reorganize CSS properties and remove unused CSS properties [Miu Razvan - [`682ccc6`](https://github.com/eea/volto-n2k/commit/682ccc630e7f83d8084ec25cd5782315330af4ee)]
8
12
 
9
13
  #### :hammer_and_wrench: Others
10
14
 
11
- - use latest stable version of volto [Claudia Ifrim - [`99ea551`](https://github.com/eea/volto-n2k/commit/99ea551a8f35729791982a59f015a5c894ea2db3)]
15
+ - update [Miu Razvan - [`3b1f4bb`](https://github.com/eea/volto-n2k/commit/3b1f4bb0ab47baae9bf316c86f4ccaa8494a1a4d)]
16
+ - fix navigation icons svg [tedw87 - [`233255d`](https://github.com/eea/volto-n2k/commit/233255d5dcb655ef12e0ffbfdc64619f186884a5)]
17
+ - update [Miu Razvan - [`9009bc2`](https://github.com/eea/volto-n2k/commit/9009bc2bb08ddaf160bcacd57f9eefec4a487319)]
18
+ - update [Miu Razvan - [`baac43c`](https://github.com/eea/volto-n2k/commit/baac43cabbd61c44ae6513af774bffb0030a0450)]
19
+ - add habitats carousel [tedw87 - [`41861d1`](https://github.com/eea/volto-n2k/commit/41861d172884f04ef0b53ea4035c1051224dcf4e)]
20
+ ### [1.0.22](https://github.com/eea/volto-n2k/compare/1.0.21...1.0.22) - 29 March 2023
21
+
22
+ ### [1.0.21](https://github.com/eea/volto-n2k/compare/1.0.20...1.0.21) - 22 March 2023
23
+
12
24
  ### [1.0.20](https://github.com/eea/volto-n2k/compare/1.0.19...1.0.20) - 22 March 2023
13
25
 
14
26
  ### [1.0.19](https://github.com/eea/volto-n2k/compare/1.0.18...1.0.19) - 7 March 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -16,15 +16,13 @@
16
16
  "@eeacms/volto-datablocks",
17
17
  "@eeacms/volto-openlayers-map",
18
18
  "@eeacms/volto-resize-helper",
19
- "@eeacms/volto-tabs-block",
20
- "@eeacms/volto-bise"
19
+ "@eeacms/volto-tabs-block"
21
20
  ],
22
21
  "repository": {
23
22
  "type": "git",
24
23
  "url": "git@github.com:eea/volto-n2k.git"
25
24
  },
26
25
  "dependencies": {
27
- "@eeacms/volto-bise": "*",
28
26
  "@eeacms/volto-datablocks": "*",
29
27
  "@eeacms/volto-openlayers-map": "*",
30
28
  "@eeacms/volto-resize-helper": "*",
@@ -35,7 +33,8 @@
35
33
  "react-stickynode": "^4.0.0",
36
34
  "react-use-localstorage": "^3.5.3",
37
35
  "resize-observer-polyfill": "1.5.1",
38
- "slick-carousel": "1.8.1"
36
+ "slick-carousel": "1.8.1",
37
+ "swiper": "9.1.1"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@cypress/code-coverage": "^3.10.0",
@@ -1,3 +1,3 @@
1
- export { default as Header } from '@eeacms/volto-n2k/components/theme/Header/Header';
2
- export { default as Footer } from '@eeacms/volto-n2k/components/theme/Footer/Footer';
1
+ // export { default as Header } from '@eeacms/volto-n2k/components/theme/Header/Header';
2
+ // export { default as Footer } from '@eeacms/volto-n2k/components/theme/Footer/Footer';
3
3
  export { default as Sitemap } from '@eeacms/volto-n2k/components/theme/Sitemap/Sitemap';
@@ -18,7 +18,7 @@ export default (config) => {
18
18
  addPermission: [],
19
19
  view: [],
20
20
  },
21
- blockHasOwnFocusManagement: true,
21
+ blockHasOwnFocusManagement: false,
22
22
  };
23
23
  return config;
24
24
  };
@@ -11,6 +11,7 @@ import cx from 'classnames';
11
11
  import 'slick-carousel/slick/slick.css';
12
12
  import 'slick-carousel/slick/slick-theme.css';
13
13
  import '@eeacms/volto-tabs-block/less/carousel.less';
14
+ import './styles.less';
14
15
 
15
16
  const Slider = loadable(() => import('react-slick'));
16
17
 
@@ -27,8 +28,11 @@ const Dots = (props) => {
27
28
  >
28
29
  <button
29
30
  aria-label={`Select slide ${index + 1}`}
31
+ tabIndex={0}
30
32
  onClick={() => {
31
- slider.current.slickGoTo(index);
33
+ if (slider.current) {
34
+ slider.current.slickGoTo(index);
35
+ }
32
36
  }}
33
37
  />
34
38
  </li>
@@ -56,7 +60,12 @@ const ArrowsGroup = (props) => {
56
60
  <button
57
61
  aria-label="Previous slide"
58
62
  className="slick-arrow slick-prev"
59
- onClick={slider.current.slickPrev}
63
+ onClick={() => {
64
+ if (slider.current) {
65
+ slider.current.slickPrev();
66
+ }
67
+ }}
68
+ tabIndex={0}
60
69
  >
61
70
  <Icon name={leftArrowSVG} size="50px" />
62
71
  </button>
@@ -67,7 +76,12 @@ const ArrowsGroup = (props) => {
67
76
  <button
68
77
  aria-label="Next slide"
69
78
  className="slick-arrow slick-next"
70
- onClick={slider.current.slickNext}
79
+ onClick={() => {
80
+ if (slider.current) {
81
+ slider.current.slickNext();
82
+ }
83
+ }}
84
+ tabIndex={0}
71
85
  >
72
86
  {currentSlide === 0 && props.learnMore ? (
73
87
  <p className="learn-more">{props.learnMore}</p>
@@ -88,8 +102,9 @@ const ArrowsGroup = (props) => {
88
102
  const View = (props) => {
89
103
  const slider = React.useRef(null);
90
104
  const img = React.useRef(null);
91
- const [imgHeight, setImgHeight] = React.useState(0);
105
+ // const [imgHeight, setImgHeight] = React.useState(0);
92
106
  const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
107
+ const blockId = props.id;
93
108
  const {
94
109
  activeTab = null,
95
110
  data = {},
@@ -100,7 +115,6 @@ const View = (props) => {
100
115
  setActiveTab = () => {},
101
116
  } = props;
102
117
  const activeTabIndex = tabsList.indexOf(activeTab);
103
- // const tabData = tabs[activeTab] || {};
104
118
  const uiContainer = data.align === 'full' ? 'ui container' : false;
105
119
  const image = data.image || null;
106
120
 
@@ -120,28 +134,28 @@ const View = (props) => {
120
134
  },
121
135
  };
122
136
 
123
- const panes = tabsList.map((tab, index) => {
124
- return {
125
- id: tab,
126
- renderItem: (
127
- <React.Fragment key={`slide-${tab}`}>
128
- <RenderBlocks {...props} metadata={metadata} content={tabs[tab]} />
129
- {index === 0 ? (
130
- <div
131
- className="divider"
132
- style={{ height: `${imgHeight - 80}px` }}
133
- />
134
- ) : (
135
- ''
136
- )}
137
- </React.Fragment>
138
- ),
139
- };
140
- });
137
+ // const panes = tabsList.map((tab, index) => {
138
+ // return {
139
+ // id: tab,
140
+ // renderItem: (
141
+ // <React.Fragment key={`slide-${tab}`}>
142
+ // <RenderBlocks {...props} metadata={metadata} content={tabs[tab]} />
143
+ // {index === 0 ? (
144
+ // <div
145
+ // className="divider"
146
+ // style={{ height: `${imgHeight - 80}px` }}
147
+ // />
148
+ // ) : (
149
+ // ''
150
+ // )}
151
+ // </React.Fragment>
152
+ // ),
153
+ // };
154
+ // });
141
155
 
142
- const updateImageHeight = () => {
143
- setImgHeight(img.current?.height || 0);
144
- };
156
+ // const updateImageHeight = () => {
157
+ // setImgHeight(img.current?.height || 0);
158
+ // };
145
159
 
146
160
  React.useEffect(() => {
147
161
  const urlHash = props.location.hash.substring(1) || '';
@@ -177,21 +191,54 @@ const View = (props) => {
177
191
  /* eslint-disable-next-line */
178
192
  }, [hashlink.counter]);
179
193
 
180
- React.useEffect(() => {
181
- updateImageHeight();
182
- img.current.onload = () => {
183
- updateImageHeight();
184
- };
185
- window.addEventListener('resize', updateImageHeight);
186
- return () => {
187
- window.removeEventListener('resize', updateImageHeight);
194
+ const panes = tabsList.map((tab, index) => {
195
+ return {
196
+ id: tab,
197
+ renderItem: (
198
+ <RenderBlocks
199
+ key={`slide-${tab}`}
200
+ {...props}
201
+ metadata={metadata}
202
+ content={tabs[tab]}
203
+ />
204
+ ),
188
205
  };
189
- /* eslint-disable-next-line */
190
- }, []);
206
+ });
207
+
208
+ // React.useEffect(() => {
209
+ // updateImageHeight();
210
+ // img.current.onload = () => {
211
+ // updateImageHeight();
212
+ // };
213
+ // window.addEventListener('resize', updateImageHeight);
214
+ // return () => {
215
+ // window.removeEventListener('resize', updateImageHeight);
216
+ // };
217
+ // /* eslint-disable-next-line */
218
+ // }, []);
219
+
220
+ // console.log('HERE RERENDER');
191
221
 
192
222
  return (
193
223
  <>
194
- <Slider {...settings} ref={slider} className={cx(uiContainer)}>
224
+ <Slider
225
+ {...settings}
226
+ ref={slider}
227
+ className={cx(uiContainer, 'tabs-accessibility')}
228
+ accessibility={true}
229
+ afterChange={() => {
230
+ if (
231
+ document
232
+ .getElementById(blockId)
233
+ ?.getElementsByClassName('slick-slider')?.length > 0
234
+ ) {
235
+ document
236
+ .getElementById(blockId)
237
+ .getElementsByClassName('slick-current')[0]
238
+ .focus();
239
+ }
240
+ }}
241
+ >
195
242
  {panes.length ? panes.map((pane) => pane.renderItem) : ''}
196
243
  </Slider>
197
244
  <img
@@ -0,0 +1,32 @@
1
+ @import (multiple, reference, optional) '../../theme.config';
2
+ @type: extra;
3
+ @element: custom;
4
+
5
+ .slick-image {
6
+ position: absolute;
7
+ bottom: 0;
8
+ left: 0;
9
+ width: 600px;
10
+ pointer-events: none;
11
+ }
12
+
13
+ @media only screen and (min-width: @mobileBreakpoint) {
14
+ .slick-image {
15
+ width: 450px !important;
16
+ transform: translateX(-40%) translateY(5%) !important;
17
+ }
18
+ }
19
+
20
+ @media only screen and (min-width: @tabletBreakpoint) {
21
+ .slick-image {
22
+ width: 500px !important;
23
+ transform: translateX(-25%) translateY(5%) !important;
24
+ }
25
+ }
26
+
27
+ @media only screen and (min-width: @computerBreakpoint) {
28
+ .slick-image {
29
+ width: 600px !important;
30
+ transform: translateX(-20%) translateY(5%) !important;
31
+ }
32
+ }
@@ -0,0 +1,49 @@
1
+ import React, { useMemo } from 'react';
2
+ import { compose } from 'redux';
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
+ import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
6
+ import { connectToProviderData } from '@eeacms/volto-datablocks/hocs';
7
+ import getSchema from './schema';
8
+ import View from './View';
9
+ import './style.less';
10
+
11
+ const Edit = (props) => {
12
+ const schema = useMemo(() => getSchema(props), [props]);
13
+
14
+ return (
15
+ <>
16
+ <View {...props} mode="edit" />
17
+
18
+ <SidebarPortal selected={props.selected}>
19
+ <BlockDataForm
20
+ schema={schema}
21
+ title={schema.title}
22
+ onChangeField={(id, value) => {
23
+ props.onChangeBlock(props.block, {
24
+ ...props.data,
25
+ [id]: value,
26
+ });
27
+ }}
28
+ onChangeBlock={props.onChangeBlock}
29
+ formData={props.data}
30
+ block={props.block}
31
+ />
32
+ </SidebarPortal>
33
+ </>
34
+ );
35
+ };
36
+
37
+ const EditWrapper = compose(
38
+ connectToProviderData((props) => ({
39
+ provider_url: props.data?.provider_url,
40
+ })),
41
+ )(Edit);
42
+
43
+ export default (props) => {
44
+ return (
45
+ <VisibilitySensor>
46
+ <EditWrapper {...props} />
47
+ </VisibilitySensor>
48
+ );
49
+ };
@@ -1,30 +1,49 @@
1
- import React from 'react';
2
- import { Container } from 'semantic-ui-react';
1
+ import React, { useState } from 'react';
2
+ import loadable from '@loadable/component';
3
+ import { compose } from 'redux';
4
+ import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
5
+ import { connectToMultipleProviders } from '@eeacms/volto-datablocks/hocs';
6
+ import arrowLeft from './chevron-left-square-fill-svgrepo-com.svg';
7
+ import arrowRight from './chevron-right-square-fill-svgrepo-com.svg';
3
8
  import './style.less';
4
9
 
5
- const View = (props) => {
6
- const provider_data = props.provider_data || {};
10
+ const SwiperLoader = loadable.lib(() => import('swiper'));
11
+ const SwiperReactLoader = loadable.lib(() => import('swiper/react'));
12
+
13
+ const _View = (props) => {
14
+ const [activeSlide, setActiveSlide] = useState(0);
15
+ const { providers = [] } = props.data;
16
+ const habitat = props.providers_data?.[providers[0]?.provider_url] || {};
17
+ const habitat_pictures =
18
+ props.providers_data?.[providers[1]?.provider_url] || {};
19
+
7
20
  const {
8
- code_2000 = [],
21
+ code_2000,
9
22
  // habitat_description = [],
10
23
  // habitat_type = [],
11
24
  // number_countries = [],
12
25
  // number_sites = [],
13
- scientific_name = [],
14
- } = provider_data;
26
+ scientific_name,
27
+ } = habitat;
28
+
29
+ const pictures = habitat_pictures?.['WebURL'] || [];
30
+ const picture_names = habitat_pictures?.['filename'] || [];
31
+ const copyright = habitat_pictures?.['attribution_copyright'] || [];
32
+
33
+ if (!code_2000 && props.mode === 'edit') {
34
+ return 'Habitat banner block (code_2000 undefined)';
35
+ }
36
+ if (!code_2000) return null;
15
37
 
16
- if (!code_2000[0]) return '';
17
38
  return (
18
- <div className="habitat-banner-details full-width">
19
- <Container>
20
- <div className="habitat-details">
21
- <div className="habitat-metadata">
22
- <h2 className="name">{scientific_name[0]}</h2>
23
- <p className="info">
24
- Habitats Directive Annex I code&nbsp;&nbsp;&nbsp;{code_2000[0]}
25
- </p>
26
- <br />
27
- {/* {number_sites[0] && (
39
+ <div className="habitat-banner-details">
40
+ <div className="habitat-details">
41
+ <div className="habitat-metadata">
42
+ <h2 className="name">{scientific_name[0]}</h2>
43
+ <p className="info">
44
+ Habitats Directive Annex I code&nbsp;&nbsp;&nbsp;{code_2000[0]}
45
+ </p>
46
+ {/* {number_sites[0] && (
28
47
  <>
29
48
  <h3 style={{ marginBottom: '0.15rem' }}>{number_sites[0]}</h3>
30
49
  <h4 className="radjhan-normal">
@@ -32,11 +51,86 @@ const View = (props) => {
32
51
  </h4>
33
52
  </>
34
53
  )} */}
35
- </div>
36
54
  </div>
37
- </Container>
55
+ {pictures?.length > 0 && (
56
+ <div className="carousel">
57
+ <div className="arrows">
58
+ <div className="swiper-button image-swiper-button-prev">
59
+ <img
60
+ className="icon icon-left"
61
+ src={arrowLeft}
62
+ alt="left arrow"
63
+ />
64
+ {/* <Icon className="icon-left" name={arrowSVG} size="24px" /> */}
65
+ </div>
66
+ <div className="swiper-button image-swiper-button-next">
67
+ <img
68
+ className="icon icon-right"
69
+ src={arrowRight}
70
+ alt="right arrow"
71
+ />
72
+ {/* <Icon className="icon-right" name={arrowSVG} size="24px" /> */}
73
+ </div>
74
+ <p>{copyright[activeSlide]}</p>
75
+ </div>
76
+ <SwiperLoader>
77
+ {({ Navigation, Pagination }) => {
78
+ return (
79
+ <SwiperReactLoader>
80
+ {({ Swiper, SwiperSlide }) => {
81
+ return (
82
+ <Swiper
83
+ modules={[Navigation, Pagination]}
84
+ navigation={{
85
+ prevEl: '.image-swiper-button-prev',
86
+ nextEl: '.image-swiper-button-next',
87
+ }}
88
+ slidesPerView={3}
89
+ spaceBetween={0}
90
+ loop={true}
91
+ breakpoints={{
92
+ 320: {
93
+ slidesPerView: 1,
94
+ spaceBetween: 0,
95
+ },
96
+ 1200: {
97
+ slidesPerView: 3,
98
+ spaceBetween: 0,
99
+ },
100
+ }}
101
+ onSlideChange={(swiper) => {
102
+ setActiveSlide(swiper.activeIndex);
103
+ }}
104
+ >
105
+ {pictures.map((source, index) => (
106
+ <SwiperSlide>
107
+ <img src={source} alt={picture_names[index]} />
108
+ </SwiperSlide>
109
+ ))}
110
+ </Swiper>
111
+ );
112
+ }}
113
+ </SwiperReactLoader>
114
+ );
115
+ }}
116
+ </SwiperLoader>
117
+ </div>
118
+ )}
119
+ </div>
38
120
  </div>
39
121
  );
40
122
  };
41
123
 
42
- export default View;
124
+ const View = compose(
125
+ connectToMultipleProviders((props) => ({
126
+ providers: props.data?.providers,
127
+ })),
128
+ )(_View);
129
+
130
+ export default (props) => {
131
+ return (
132
+ <VisibilitySensor Placeholder={() => <div>loading....&nbsp;</div>}>
133
+ <View {...props} />
134
+ </VisibilitySensor>
135
+ );
136
+ };
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 24.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill-rule:evenodd;clip-rule:evenodd;}
7
+ </style>
8
+ <path class="st0" d="M32,0H0v32h32V0z M12,16l10.1,10.1l-2.5,2.5L7,16L19.6,3.4l2.5,2.5L12,16z"/>
9
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 24.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill-rule:evenodd;clip-rule:evenodd;}
7
+ </style>
8
+ <path class="st0" d="M0,32h32V0L0,0L0,32z M9.9,5.9l2.5-2.5L25,16L12.4,28.6l-2.5-2.5L20,16L9.9,5.9z"/>
9
+ </svg>
@@ -1,17 +1,24 @@
1
- import HabitatsBannerView from './View';
2
- import getSchema from './schema';
1
+ import worldSVG from '@plone/volto/icons/world.svg';
2
+ import Edit from './Edit';
3
+ import View from './View';
3
4
 
4
5
  export default (config) => {
5
- config.blocks.blocksConfig.custom_connected_block = {
6
- ...config.blocks.blocksConfig.custom_connected_block,
7
- blocks: {
8
- ...config.blocks.blocksConfig.custom_connected_block.blocks,
9
- habitats_banner: {
10
- view: HabitatsBannerView,
11
- getSchema: getSchema,
12
- title: 'Habitat banner',
13
- },
6
+ config.blocks.blocksConfig.habitats_banner = {
7
+ id: 'habitats_banner',
8
+ title: 'Habitats banner',
9
+ icon: worldSVG,
10
+ group: 'natura_2000',
11
+ edit: Edit,
12
+ view: View,
13
+ restricted: false,
14
+ mostUsed: false,
15
+ sidebarTab: 1,
16
+ blocks: {},
17
+ security: {
18
+ addPermission: [],
19
+ view: [],
14
20
  },
21
+ blockHasOwnFocusManagement: false,
15
22
  };
16
23
  return config;
17
24
  };
@@ -1,18 +1,77 @@
1
+ const SourceSchema = {
2
+ title: 'Source',
3
+
4
+ fieldsets: [
5
+ {
6
+ id: 'default',
7
+ title: 'Default',
8
+ fields: ['source', 'source_link'],
9
+ },
10
+ ],
11
+
12
+ properties: {
13
+ source: {
14
+ type: 'string',
15
+ title: 'Source',
16
+ },
17
+ source_link: {
18
+ type: 'string',
19
+ title: 'Link',
20
+ },
21
+ },
22
+
23
+ required: ['source'],
24
+ };
25
+
26
+ const DataProvidersSchema = {
27
+ title: 'Data provider',
28
+ fieldsets: [{ id: 'default', title: 'Default', fields: ['provider_url'] }],
29
+ properties: {
30
+ provider_url: {
31
+ title: 'Provider url',
32
+ widget: 'object_by_path',
33
+ },
34
+ },
35
+ };
36
+
1
37
  const getSchema = (props) => {
2
38
  return {
3
- title: 'Habitats banner',
4
-
39
+ title: 'Habitats Banner',
5
40
  fieldsets: [
6
41
  {
7
42
  id: 'default',
8
43
  title: 'Default',
9
- fields: [],
44
+ fields: ['providers', 'allowedParams'],
45
+ },
46
+ {
47
+ id: 'sources',
48
+ title: 'Sources',
49
+ fields: ['sources'],
10
50
  },
11
51
  ],
12
52
 
13
- properties: {},
53
+ properties: {
54
+ providers: {
55
+ title: 'Data provider',
56
+ schema: DataProvidersSchema,
57
+ widget: 'object_list',
58
+ },
59
+ allowedParams: {
60
+ title: 'Allowed params',
61
+ type: 'array',
62
+ creatable: true,
63
+ items: {
64
+ choices: [],
65
+ },
66
+ },
67
+ sources: {
68
+ title: 'Sources',
69
+ schema: SourceSchema,
70
+ widget: 'object_list',
71
+ },
72
+ },
14
73
 
15
- required: [],
74
+ required: ['url'],
16
75
  };
17
76
  };
18
77