@eeacms/volto-datahub 0.1.1 → 0.1.4

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,9 +4,36 @@ 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.4](https://github.com/eea/volto-datahub/compare/0.1.3...0.1.4)
8
+
9
+ - Improve temporal coverage [`d0483d4`](https://github.com/eea/volto-datahub/commit/d0483d46259b956a96a66268b9ec305d27456f88)
10
+ - Fix warning message [`305d2d6`](https://github.com/eea/volto-datahub/commit/305d2d61123d1ee23e8a4baf837b1aadc5d9a41f)
11
+ - Hide readingTime for now [`5e508d3`](https://github.com/eea/volto-datahub/commit/5e508d3c2bfd97bcc01dca59894a4f9ad582284b)
12
+ - ESlint fix [`dcfbab4`](https://github.com/eea/volto-datahub/commit/dcfbab4effa23ddcc3d4bf9a61d0b0d101c796b6)
13
+ - Set topics filter always visible [`1c062f4`](https://github.com/eea/volto-datahub/commit/1c062f473c123b5c04055fc6a52ea56bbd00e7b4)
14
+ - Update item view [`a53d297`](https://github.com/eea/volto-datahub/commit/a53d297916bb8d2c5d020acb9de600228e344982)
15
+ - Fix import [`bfa1cbc`](https://github.com/eea/volto-datahub/commit/bfa1cbc04c60009f949ac675278df894b4e1c892)
16
+ - WIP Update dataset's page based on new figma design [`01eecfa`](https://github.com/eea/volto-datahub/commit/01eecfacd482ca6abea81e4fd24eb7871e5365c9)
17
+ - Reconfigure datahub facets [`8636536`](https://github.com/eea/volto-datahub/commit/863653613d05faaa73101943896f05243055c696)
18
+ - Update result item based on new figma design [`eb618a0`](https://github.com/eea/volto-datahub/commit/eb618a0ce441cb9d797b39efad6bf98e4b07c728)
19
+
20
+ #### [0.1.3](https://github.com/eea/volto-datahub/compare/0.1.2...0.1.3)
21
+
22
+ > 30 June 2022
23
+
24
+
25
+ #### [0.1.2](https://github.com/eea/volto-datahub/compare/0.1.1...0.1.2)
26
+
27
+ > 30 June 2022
28
+
29
+ - Release [`#3`](https://github.com/eea/volto-datahub/pull/3)
30
+ - Hide questions & fix landing page [`a1ef303`](https://github.com/eea/volto-datahub/commit/a1ef3033df0e84f3a72dd0f984c8717dff2a771c)
31
+
7
32
  #### [0.1.1](https://github.com/eea/volto-datahub/compare/0.1.0...0.1.1)
8
33
 
9
- - Fix dependencies [`7fbd805`](https://github.com/eea/volto-datahub/commit/7fbd80557925a6c4de8ab8c8dc18f3860176a47c)
34
+ > 10 June 2022
35
+
36
+ - Fix dependencies [`#2`](https://github.com/eea/volto-datahub/pull/2)
10
37
 
11
38
  #### [0.1.0](https://github.com/eea/volto-datahub/compare/0.0.1...0.1.0)
12
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,22 +1,15 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  Container,
4
- Grid,
5
4
  Card,
6
5
  Image,
7
6
  Accordion,
8
7
  Icon,
8
+ Tab,
9
9
  } from 'semantic-ui-react';
10
10
  import { Toolbar } from '@plone/volto/components';
11
11
  import { BodyClass } from '@plone/volto/helpers';
12
12
  import { Portal } from 'react-portal';
13
- // import { useResult } from '@eeacms/search/lib/hocs';
14
- // import {
15
- // AppConfigContext,
16
- // SearchContext,
17
- // // useIsMounted,
18
- // } from '@eeacms/search/lib/hocs';
19
- // import { rebind, applyConfigurationSchema } from '@eeacms/search/lib/utils';
20
13
  import {
21
14
  useResult,
22
15
  AppConfigContext,
@@ -24,7 +17,8 @@ import {
24
17
  rebind,
25
18
  applyConfigurationSchema,
26
19
  } from '@eeacms/search';
27
- import { SearchProvider, WithSearch } from '@elastic/react-search-ui'; // ErrorBoundary,
20
+ import { DateTime } from '@eeacms/search';
21
+ import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
28
22
  import { Callout } from '@eeacms/volto-eea-design-system/ui';
29
23
  import config from '@plone/volto/registry';
30
24
 
@@ -34,12 +28,21 @@ function ItemView(props) {
34
28
  const { docid } = props;
35
29
  const result = useResult(null, docid);
36
30
  const item = result ? result._result : {};
37
- const { title, description, id, raw_value, event } = item;
38
- const { contactForResource, contact } = raw_value?.raw || {};
31
+ const { title, description, raw_value, event, issued, time_coverage } = item; // readingTime
32
+ const {
33
+ // contactForResource,
34
+ // contact,
35
+ // resourceTemporalDateRange,
36
+ changeDate,
37
+ } = raw_value?.raw || {};
38
+
39
39
  const relatedItemsData = event?.raw.original;
40
40
  const relatedDatasets =
41
41
  (relatedItemsData && JSON.parse(relatedItemsData)) || {};
42
42
  const { children } = relatedDatasets?.raw_value || {};
43
+ const startTempCoverage = parseInt(time_coverage?.raw.at(0));
44
+ const endTempCoverage = parseInt(time_coverage?.raw.at(-1));
45
+
43
46
  const [activeIndex, setActiveIndex] = React.useState([]);
44
47
 
45
48
  const toggleOpenAccordion = (e, titleProps) => {
@@ -52,212 +55,255 @@ function ItemView(props) {
52
55
  setActiveIndex(newIndex);
53
56
  };
54
57
 
55
- // console.log('datahub item', item);
56
- // console.log('related datasets', children);
58
+ // console.log('result', result?._result);
57
59
 
58
- return (
59
- <>
60
- {item ? (
61
- <div>
62
- <Portal node={document.getElementById('page-header')}>
63
- <div className="eea banner">
64
- <div className="gradient">
65
- <div className="ui container">
66
- <div className="content">
67
- <h1 className="documentFirstHeading">{title?.raw}</h1>
68
- </div>
69
- </div>
60
+ const panes = [
61
+ {
62
+ menuItem: 'European data',
63
+ render: () => <Tab.Pane attached={false}>Tab 1 Content</Tab.Pane>,
64
+ },
65
+ {
66
+ menuItem: 'Dataset definition',
67
+ render: () => <Tab.Pane attached={false}>Tab 2 Content</Tab.Pane>,
68
+ },
69
+ ];
70
+
71
+ return item ? (
72
+ <div className="dataset-view">
73
+ <Portal node={document.getElementById('page-header')}>
74
+ <div className="eea banner">
75
+ <div className="gradient">
76
+ <div className="ui container">
77
+ <div className="content">
78
+ <h1 className="documentFirstHeading">Datahub</h1>
70
79
  </div>
71
80
  </div>
72
- </Portal>
73
- <Callout>{description?.raw}</Callout>
74
- <h3>Tabular data</h3>
75
- <Accordion exclusive={false}>
76
- <Accordion.Title
77
- active={activeIndex.includes(0)}
78
- index={0}
79
- onClick={toggleOpenAccordion}
80
- >
81
- Distribution files
82
- <Icon className="ri-arrow-down-s-line" />
83
- </Accordion.Title>
84
- <Accordion.Content active={activeIndex.includes(0)}>
85
- <p></p>
86
- </Accordion.Content>
81
+ </div>
82
+ </div>
83
+ </Portal>
87
84
 
88
- <Accordion.Title
89
- active={activeIndex.includes(1)}
90
- index={1}
91
- onClick={toggleOpenAccordion}
92
- >
93
- Programmatic access (APIs)
94
- <Icon className="ri-arrow-down-s-line" />
95
- </Accordion.Title>
96
- <Accordion.Content active={activeIndex.includes(1)}>
97
- <a
98
- href="https://discodata.eea.europa.eu/#!/"
99
- title="DiscoData REST API call"
100
- rel="noopener noreferrer"
101
- >
102
- DiscoData
103
- </a>
104
- (REST API)
105
- </Accordion.Content>
85
+ <div className="dataset-container">
86
+ <div className="dataset-header">
87
+ <h1>{title?.raw}</h1>
88
+ <div className="dataset-header-bottom">
89
+ <span className="header-data">Prod-ID: [No data]</span>
90
+ <span className="header-data">
91
+ Created: <DateTime format="DATE_MED" value={issued?.raw} />
92
+ </span>
93
+ <span className="header-data">Published: [No data]</span>
94
+ <span className="header-data">
95
+ Last modified: <DateTime format="DATE_MED" value={changeDate} />
96
+ </span>
97
+ {/*<span className="header-data">
98
+ Reading time: {readingTime?.raw}
99
+ </span>*/}
100
+ </div>
101
+ </div>
102
+ <Callout>{description?.raw}</Callout>
106
103
 
107
- <Accordion.Title
108
- active={activeIndex.includes(2)}
109
- index={2}
110
- onClick={toggleOpenAccordion}
111
- >
112
- Additional information
113
- <Icon className="ri-arrow-down-s-line" />
114
- </Accordion.Title>
115
- <Accordion.Content active={activeIndex.includes(2)}>
116
- {description?.raw}
117
- </Accordion.Content>
104
+ <Tab
105
+ menu={{ secondary: true, pointing: true }}
106
+ panes={panes}
107
+ className="dataset-tab-setion"
108
+ />
109
+ </div>
118
110
 
119
- <Accordion.Title
120
- active={activeIndex.includes(3)}
121
- index={3}
122
- onClick={toggleOpenAccordion}
123
- >
124
- Metadata
125
- <Icon className="ri-arrow-down-s-line" />
126
- </Accordion.Title>
127
- <Accordion.Content active={activeIndex.includes(3)}>
128
- Topics:
129
- <ul>
130
- {raw_value?.raw['allKeywords.th_eea-topics.keywords']?.map(
131
- (topic, i) => {
132
- return (
133
- <li key={i}>
134
- <a href={topic.link} target="_blank" rel="noreferrer">
135
- {topic.default}
136
- </a>
137
- </li>
138
- );
139
- },
140
- )}
141
- </ul>
142
- </Accordion.Content>
143
- </Accordion>
111
+ <div className="info-wrapper">
112
+ <div className="info-content">
113
+ <div className="info-title">More Information for {title?.raw}.</div>
114
+ <p>{description?.raw}</p>
115
+ </div>
116
+ </div>
144
117
 
145
- <h3>Geospatial data</h3>
118
+ {children && children.length > 0 && (
119
+ <div className="related-wrapper">
120
+ <h2>Related content</h2>
121
+ <Card.Group itemsPerRow={4}>
122
+ {children.map((item, index) => {
123
+ return (
124
+ <Card
125
+ href={`/datahub/view/${item.metadataIdentifier}`}
126
+ key={index}
127
+ >
128
+ <Image src={item.overview[0].url} wrapped ui={false} />
129
+ <Card.Content>
130
+ <Card.Description>
131
+ {item.resourceTitleObject.default}
132
+ </Card.Description>
133
+ </Card.Content>
134
+ </Card>
135
+ );
136
+ })}
137
+ </Card.Group>
138
+ </div>
139
+ )}
140
+
141
+ <div className="below-content-wrapper">
142
+ <Accordion exclusive={false}>
143
+ <Accordion.Title
144
+ active={activeIndex.includes(0)}
145
+ index={0}
146
+ onClick={toggleOpenAccordion}
147
+ >
148
+ Metadata
149
+ <Icon className="ri-arrow-down-s-line" />
150
+ </Accordion.Title>
151
+ <Accordion.Content active={activeIndex.includes(0)}>
152
+ {item.rod && (
153
+ <div>
154
+ Reporting obligations (ROD):
155
+ <ul>
156
+ {Array.isArray(item.rod?.raw) ? (
157
+ <>
158
+ {item?.rod?.raw.map((item, i) => {
159
+ return <li key={i}>{item}</li>;
160
+ })}
161
+ </>
162
+ ) : (
163
+ <li>{item.rod?.raw}</li>
164
+ )}
165
+ </ul>
166
+ </div>
167
+ )}
146
168
 
147
- <h3>Additional information</h3>
148
- <Accordion exclusive={false}>
149
- <Accordion.Title
150
- active={activeIndex.includes(4)}
151
- index={4}
152
- onClick={toggleOpenAccordion}
153
- >
154
- About this dataset
155
- <Icon className="ri-arrow-down-s-line" />
156
- </Accordion.Title>
157
- <Accordion.Content active={activeIndex.includes(4)}>
158
- {description?.raw}
159
- </Accordion.Content>
169
+ {item?.organisation && (
170
+ <div>
171
+ Organisation:
172
+ <ul>
173
+ {Array.isArray(item?.organisation?.raw) ? (
174
+ <>
175
+ {item?.organisation?.raw.map((item, i) => {
176
+ return <li key={i}>{item}</li>;
177
+ })}
178
+ </>
179
+ ) : (
180
+ <li>{item?.organisation?.raw}</li>
181
+ )}
182
+ </ul>
183
+ </div>
184
+ )}
185
+ </Accordion.Content>
160
186
 
161
- <Accordion.Title
162
- active={activeIndex.includes(5)}
163
- index={5}
164
- onClick={toggleOpenAccordion}
165
- >
166
- Contact information
167
- <Icon className="ri-arrow-down-s-line" />
168
- </Accordion.Title>
169
- <Accordion.Content active={activeIndex.includes(5)}>
170
- {contactForResource ? (
171
- <>
172
- {contactForResource.map((c, i) => {
173
- return (
174
- <Grid key={i}>
175
- <Grid.Column width={4}>
176
- <p>{c.role}: </p>
177
- </Grid.Column>
178
- <Grid.Column width={8}>
179
- <a
180
- href="https://www.eea.europa.eu/"
181
- target="_blank"
182
- rel="noreferrer"
183
- >
184
- <strong>{c.organisation}</strong>
185
- </a>
186
- <p>{c.address}</p>
187
- <a href={'mailto:' + c.email}>{c.email}</a>
188
- </Grid.Column>
189
- </Grid>
190
- );
191
- })}
192
- </>
193
- ) : (
194
- <>
195
- {contact &&
196
- contact.length > 0 &&
197
- contact.map((c, i) => {
198
- return (
199
- <Grid key={i}>
200
- <Grid.Column width={4}>
201
- {/*<p>{contact.role}: </p>*/}
202
- <p>Point of contact:</p>
203
- </Grid.Column>
204
- <Grid.Column width={8}>
205
- <a
206
- href="https://www.eea.europa.eu/"
207
- target="_blank"
208
- rel="noreferrer"
209
- >
210
- <strong>{c.organisation}</strong>
211
- </a>
212
- <p>{c.address}</p>
213
- <a href={'mailto:' + c.email}>{c.email}</a>
214
- </Grid.Column>
215
- </Grid>
216
- );
187
+ <Accordion.Title
188
+ active={activeIndex.includes(1)}
189
+ index={1}
190
+ onClick={toggleOpenAccordion}
191
+ >
192
+ Permalinks
193
+ <Icon className="ri-arrow-down-s-line" />
194
+ </Accordion.Title>
195
+ <Accordion.Content active={activeIndex.includes(1)}>
196
+ [No data]
197
+ </Accordion.Content>
198
+
199
+ <Accordion.Title
200
+ active={activeIndex.includes(2)}
201
+ index={2}
202
+ onClick={toggleOpenAccordion}
203
+ >
204
+ Geographic coverage
205
+ <Icon className="ri-arrow-down-s-line" />
206
+ </Accordion.Title>
207
+ <Accordion.Content active={activeIndex.includes(2)}>
208
+ {item.spatial && (
209
+ <div className="geotags">
210
+ {Array.isArray(item?.spatial?.raw) ? (
211
+ <>
212
+ {item?.spatial?.raw.map((item, i) => {
213
+ return <span key={i}>{item}</span>;
217
214
  })}
218
- </>
219
- )}
220
- </Accordion.Content>
221
- </Accordion>
215
+ </>
216
+ ) : (
217
+ <span>{item?.spatial?.raw}</span>
218
+ )}
219
+ </div>
220
+ )}
221
+ </Accordion.Content>
222
222
 
223
- <h3>Related datasets</h3>
224
- {children && children.length > 0 && (
225
- <Card.Group itemsPerRow={3}>
226
- {children.map((item, index) => {
223
+ <Accordion.Title
224
+ active={activeIndex.includes(3)}
225
+ index={3}
226
+ onClick={toggleOpenAccordion}
227
+ >
228
+ Temporal coverage
229
+ <Icon className="ri-arrow-down-s-line" />
230
+ </Accordion.Title>
231
+ <Accordion.Content active={activeIndex.includes(3)}>
232
+ {/*<ul>
233
+ {resourceTemporalDateRange?.map((temp, i) => {
227
234
  return (
228
- <Card
229
- href={`/datahub/view/${item.metadataIdentifier}`}
230
- key={index}
231
- >
232
- <Image src={item.overview[0].url} wrapped ui={false} />
233
- <Card.Content>
234
- <Card.Header>
235
- {item.resourceTitleObject.default}
236
- </Card.Header>
237
- </Card.Content>
238
- </Card>
235
+ <li key={i}>
236
+ <DateTime format="DATE_MED" value={temp.gte} /> -
237
+ <DateTime format="DATE_MED" value={temp.lte} />
238
+ </li>
239
239
  );
240
240
  })}
241
- </Card.Group>
242
- )}
241
+ </ul>*/}
242
+ {time_coverage?.raw.length > 0 && (
243
+ <div className="temporal-coverage">
244
+ <div className="side-temp">{`${startTempCoverage - 1}`}</div>
245
+ <div className="time-range">
246
+ <span>{startTempCoverage}</span> -
247
+ <span>{endTempCoverage}</span>
248
+ </div>
249
+ <div className="side-temp">{`${endTempCoverage + 1}`}</div>
250
+ </div>
251
+ )}
252
+ </Accordion.Content>
243
253
 
244
- <p>
245
- Source: SDI record{' '}
246
- <a
247
- href={
248
- 'https://galliwasp.eea.europa.eu/catalogue/srv/eng/catalog.search#/metadata/' +
249
- id
250
- }
251
- >
252
- {id}
253
- </a>
254
- </p>
255
- </div>
256
- ) : (
257
- ''
258
- )}
259
- </>
260
- );
254
+ <Accordion.Title
255
+ active={activeIndex.includes(4)}
256
+ index={4}
257
+ onClick={toggleOpenAccordion}
258
+ >
259
+ Topics
260
+ <Icon className="ri-arrow-down-s-line" />
261
+ </Accordion.Title>
262
+ <Accordion.Content active={activeIndex.includes(4)}>
263
+ {item.topic && (
264
+ <>
265
+ {Array.isArray(item?.topic?.raw) ? (
266
+ <>
267
+ {item?.topic?.raw.map((item, i) => {
268
+ return (
269
+ <span className="tag-item" key={i}>
270
+ {item}
271
+ </span>
272
+ );
273
+ })}
274
+ </>
275
+ ) : (
276
+ <span className="tag-item">{item?.topic?.raw}</span>
277
+ )}
278
+ </>
279
+ )}
280
+ </Accordion.Content>
281
+
282
+ <Accordion.Title
283
+ active={activeIndex.includes(5)}
284
+ index={5}
285
+ onClick={toggleOpenAccordion}
286
+ >
287
+ Tags
288
+ <Icon className="ri-arrow-down-s-line" />
289
+ </Accordion.Title>
290
+ <Accordion.Content active={activeIndex.includes(5)}>
291
+ <div className="dataset-tags">
292
+ {raw_value?.raw['allKeywords.th_EEAkeywordlist.keywords']?.map(
293
+ (tag, i) => {
294
+ return (
295
+ <span className="tag-item" key={i}>
296
+ {tag.default}
297
+ </span>
298
+ );
299
+ },
300
+ )}
301
+ </div>
302
+ </Accordion.Content>
303
+ </Accordion>
304
+ </div>
305
+ </div>
306
+ ) : null;
261
307
  }
262
308
 
263
309
  function DatahubItemView(props) {