@eeacms/volto-datahub 0.1.4 → 0.1.7
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 +35 -0
- package/package.json +1 -1
- package/src/components/ItemView/ItemView.jsx +318 -245
- package/src/components/ItemView/TemporalCoverage.jsx +33 -0
- package/src/components/ItemView/banner.svg +4570 -0
- package/src/components/ItemView/icons/services.svg +3 -0
- package/src/components/Result/DatahubCardItem.jsx +16 -6
- package/src/index.js +2 -2
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Container,
|
|
4
|
-
Card,
|
|
5
|
-
Image,
|
|
6
|
-
Accordion,
|
|
7
|
-
Icon,
|
|
8
|
-
Tab,
|
|
9
|
-
} from 'semantic-ui-react';
|
|
2
|
+
import { Container, Accordion, Icon, List } from 'semantic-ui-react';
|
|
10
3
|
import { Toolbar } from '@plone/volto/components';
|
|
11
4
|
import { BodyClass } from '@plone/volto/helpers';
|
|
12
5
|
import { Portal } from 'react-portal';
|
|
@@ -19,70 +12,116 @@ import {
|
|
|
19
12
|
} from '@eeacms/search';
|
|
20
13
|
import { DateTime } from '@eeacms/search';
|
|
21
14
|
import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
|
|
22
|
-
import { Callout } from '@eeacms/volto-eea-design-system/ui';
|
|
15
|
+
import { Callout, Banner } from '@eeacms/volto-eea-design-system/ui';
|
|
16
|
+
import { useDispatch } from 'react-redux';
|
|
23
17
|
import config from '@plone/volto/registry';
|
|
18
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
19
|
+
import bannerBG from './banner.svg';
|
|
20
|
+
import servicesSVG from './icons/services.svg';
|
|
24
21
|
|
|
25
22
|
const appName = 'datahub';
|
|
26
23
|
|
|
24
|
+
const SVGIcon = ({ name, size, color, className, title, onClick }) => {
|
|
25
|
+
return (
|
|
26
|
+
<svg
|
|
27
|
+
xmlns={name.attributes && name.attributes.xmlns}
|
|
28
|
+
viewBox={name.attributes && name.attributes.viewBox}
|
|
29
|
+
style={{ height: size, width: 'auto', fill: color || 'currentColor' }}
|
|
30
|
+
className={className ? `icon ${className}` : 'icon'}
|
|
31
|
+
onClick={onClick}
|
|
32
|
+
dangerouslySetInnerHTML={{
|
|
33
|
+
__html: title ? `<title>${title}</title>${name.content}` : name.content,
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
27
39
|
function ItemView(props) {
|
|
28
|
-
const { docid } = props;
|
|
40
|
+
const { docid, location } = props;
|
|
41
|
+
const { fromPathname, fromSearch } = location?.state || {};
|
|
42
|
+
const dispatch = useDispatch();
|
|
43
|
+
// const content = useSelector((state) => state.content.data);
|
|
29
44
|
const result = useResult(null, docid);
|
|
30
|
-
const item = result ? result._result :
|
|
31
|
-
const { title, description, raw_value,
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
changeDate,
|
|
37
|
-
} = raw_value?.raw || {};
|
|
45
|
+
const item = result ? result._result : null;
|
|
46
|
+
const { title, description, raw_value, issued, time_coverage } = item || {}; // readingTime
|
|
47
|
+
const { changeDate, children } = raw_value?.raw || {};
|
|
48
|
+
const startTempCoverage = time_coverage?.raw.at(0);
|
|
49
|
+
const endTempCoverage = time_coverage?.raw.at(-1);
|
|
50
|
+
const rawTitle = title?.raw || '';
|
|
38
51
|
|
|
39
|
-
const
|
|
40
|
-
const relatedDatasets =
|
|
41
|
-
(relatedItemsData && JSON.parse(relatedItemsData)) || {};
|
|
42
|
-
const { children } = relatedDatasets?.raw_value || {};
|
|
43
|
-
const startTempCoverage = parseInt(time_coverage?.raw.at(0));
|
|
44
|
-
const endTempCoverage = parseInt(time_coverage?.raw.at(-1));
|
|
52
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const toggleOpenAccordion = (e, titleProps) => {
|
|
54
|
+
function handleClick(e, titleProps) {
|
|
49
55
|
const { index } = titleProps;
|
|
50
|
-
const newIndex =
|
|
51
|
-
activeIndex.indexOf(index) === -1
|
|
52
|
-
? [...activeIndex, index]
|
|
53
|
-
: activeIndex.filter((item) => item !== index);
|
|
54
|
-
|
|
56
|
+
const newIndex = activeIndex === index ? -1 : index;
|
|
55
57
|
setActiveIndex(newIndex);
|
|
56
|
-
}
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
const handler = async () => {
|
|
62
|
+
if (item) {
|
|
63
|
+
const action = {
|
|
64
|
+
type: 'GET_BREADCRUMBS_SUCCESS',
|
|
65
|
+
result: {
|
|
66
|
+
items: [
|
|
67
|
+
{
|
|
68
|
+
title: 'Datahub',
|
|
69
|
+
'@id': '/en/datahub',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: rawTitle,
|
|
73
|
+
'@id': `/en/datahub/view/${docid}`,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
await dispatch({ type: 'GET_BREADCRUMBS_PENDING' }); // satisfy content load protection
|
|
79
|
+
await dispatch(action);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
handler();
|
|
84
|
+
}, [item, dispatch, docid, rawTitle]);
|
|
85
|
+
|
|
86
|
+
const datasets = React.useMemo(
|
|
87
|
+
() =>
|
|
88
|
+
(children || []).sort(
|
|
89
|
+
(a, b) =>
|
|
90
|
+
new Date(b.publicationDateForResource).getTime() -
|
|
91
|
+
new Date(a.publicationDateForResource).getTime(),
|
|
92
|
+
),
|
|
93
|
+
[children],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// console.log('result', result?._result);
|
|
70
97
|
|
|
71
98
|
return item ? (
|
|
72
99
|
<div className="dataset-view">
|
|
73
100
|
<Portal node={document.getElementById('page-header')}>
|
|
74
|
-
<div className="
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
101
|
+
<div className="dataset">
|
|
102
|
+
<Banner image_url={bannerBG} image>
|
|
103
|
+
<Banner.Content>
|
|
104
|
+
<Banner.Title>Datahub</Banner.Title>
|
|
105
|
+
</Banner.Content>
|
|
106
|
+
</Banner>
|
|
82
107
|
</div>
|
|
83
108
|
</Portal>
|
|
84
109
|
|
|
85
110
|
<div className="dataset-container">
|
|
111
|
+
<Link
|
|
112
|
+
className="search-link"
|
|
113
|
+
to={
|
|
114
|
+
location?.state
|
|
115
|
+
? { pathname: fromPathname, search: fromSearch }
|
|
116
|
+
: {
|
|
117
|
+
pathname: '/en/datahub/',
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
>
|
|
121
|
+
<Icon className="ri-arrow-go-back-line" />
|
|
122
|
+
Back to search
|
|
123
|
+
</Link>
|
|
124
|
+
|
|
86
125
|
<div className="dataset-header">
|
|
87
126
|
<h1>{title?.raw}</h1>
|
|
88
127
|
<div className="dataset-header-bottom">
|
|
@@ -95,218 +134,252 @@ function ItemView(props) {
|
|
|
95
134
|
Last modified: <DateTime format="DATE_MED" value={changeDate} />
|
|
96
135
|
</span>
|
|
97
136
|
{/*<span className="header-data">
|
|
98
|
-
|
|
99
|
-
|
|
137
|
+
Reading time: {readingTime?.raw}
|
|
138
|
+
</span>*/}
|
|
100
139
|
</div>
|
|
101
140
|
</div>
|
|
102
|
-
<Callout>{description?.raw}</Callout>
|
|
103
141
|
|
|
104
|
-
<
|
|
105
|
-
menu={{ secondary: true, pointing: true }}
|
|
106
|
-
panes={panes}
|
|
107
|
-
className="dataset-tab-setion"
|
|
108
|
-
/>
|
|
109
|
-
</div>
|
|
142
|
+
<Callout>{description?.raw}</Callout>
|
|
110
143
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
{datasets && datasets.length > 0 && (
|
|
145
|
+
<>
|
|
146
|
+
<h2>Data</h2>
|
|
147
|
+
<Accordion>
|
|
148
|
+
{datasets.map((dataset, index) => {
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
<Accordion.Title
|
|
152
|
+
active={activeIndex === index}
|
|
153
|
+
index={index}
|
|
154
|
+
onClick={handleClick}
|
|
155
|
+
>
|
|
156
|
+
<span className="dataset-title">
|
|
157
|
+
<div>{dataset.resourceTitleObject.default}</div>
|
|
158
|
+
<span>
|
|
159
|
+
{(dataset.format || []).map((item, i) => {
|
|
160
|
+
return <span className="format-label">{item}</span>;
|
|
161
|
+
})}
|
|
162
|
+
</span>
|
|
163
|
+
</span>
|
|
164
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
165
|
+
</Accordion.Title>
|
|
166
|
+
<Accordion.Content active={activeIndex === index}>
|
|
167
|
+
{!!dataset.link && dataset.link.length > 0 ? (
|
|
168
|
+
<List divided relaxed>
|
|
169
|
+
{dataset.link
|
|
170
|
+
.filter((i) => i.protocol === 'WWW:URL')
|
|
171
|
+
.map((item, i) => {
|
|
172
|
+
return (
|
|
173
|
+
<List.Item>
|
|
174
|
+
<List.Content>
|
|
175
|
+
<div className="dataset-item">
|
|
176
|
+
<Icon className="download" />
|
|
177
|
+
<a href={item.url} className="item-link">
|
|
178
|
+
<span>{item.name}</span>
|
|
179
|
+
</a>
|
|
180
|
+
</div>
|
|
181
|
+
</List.Content>
|
|
182
|
+
{item.description && (
|
|
183
|
+
<span
|
|
184
|
+
className="item-description"
|
|
185
|
+
title={item.description}
|
|
186
|
+
>
|
|
187
|
+
{item.description}
|
|
188
|
+
</span>
|
|
189
|
+
)}
|
|
190
|
+
</List.Item>
|
|
191
|
+
);
|
|
192
|
+
})}
|
|
117
193
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
194
|
+
{dataset.link
|
|
195
|
+
.filter((i) => i.protocol === 'WWW:LINK')
|
|
196
|
+
.map((item, i) => {
|
|
197
|
+
return (
|
|
198
|
+
<List.Item>
|
|
199
|
+
<List.Content>
|
|
200
|
+
<div className="dataset-item">
|
|
201
|
+
<Icon className="download" />
|
|
202
|
+
{item.name ? (
|
|
203
|
+
<a
|
|
204
|
+
href={item.url}
|
|
205
|
+
className="item-link"
|
|
206
|
+
>
|
|
207
|
+
{item.name}
|
|
208
|
+
</a>
|
|
209
|
+
) : (
|
|
210
|
+
<a
|
|
211
|
+
href={item.url}
|
|
212
|
+
className="item-link"
|
|
213
|
+
>
|
|
214
|
+
Download link
|
|
215
|
+
</a>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
</List.Content>
|
|
219
|
+
</List.Item>
|
|
220
|
+
);
|
|
221
|
+
})}
|
|
140
222
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</>
|
|
162
|
-
) : (
|
|
163
|
-
<li>{item.rod?.raw}</li>
|
|
164
|
-
)}
|
|
165
|
-
</ul>
|
|
166
|
-
</div>
|
|
167
|
-
)}
|
|
223
|
+
{dataset.link
|
|
224
|
+
.filter(
|
|
225
|
+
(i) =>
|
|
226
|
+
i.protocol === 'EEA:FILEPATH' ||
|
|
227
|
+
i.protocol === 'EEA:FOLDERPATH',
|
|
228
|
+
)
|
|
229
|
+
.map((item, i) => {
|
|
230
|
+
return (
|
|
231
|
+
<List.Item>
|
|
232
|
+
<List.Content>
|
|
233
|
+
<div className="dataset-item">
|
|
234
|
+
<Icon className="download" />
|
|
235
|
+
<a href={item.url} className="item-link">
|
|
236
|
+
WebDAV: {item.name || item.function}
|
|
237
|
+
</a>
|
|
238
|
+
</div>
|
|
239
|
+
</List.Content>
|
|
240
|
+
</List.Item>
|
|
241
|
+
);
|
|
242
|
+
})}
|
|
168
243
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
244
|
+
{dataset.link
|
|
245
|
+
.filter(
|
|
246
|
+
(i) =>
|
|
247
|
+
i.protocol === 'ESRI:REST' ||
|
|
248
|
+
i.protocol === 'OGC:WMS',
|
|
249
|
+
)
|
|
250
|
+
.map((item, i) => {
|
|
251
|
+
return (
|
|
252
|
+
<List.Item>
|
|
253
|
+
<List.Content>
|
|
254
|
+
<SVGIcon name={servicesSVG} size="19" />{' '}
|
|
255
|
+
{(item.name || item.description) && (
|
|
256
|
+
<span className="item-protocol">
|
|
257
|
+
{item.protocol}:
|
|
258
|
+
</span>
|
|
259
|
+
)}
|
|
260
|
+
<a className="item-link" href={item.url}>
|
|
261
|
+
{item.name ||
|
|
262
|
+
item.description ||
|
|
263
|
+
item.protocol}
|
|
264
|
+
</a>
|
|
265
|
+
</List.Content>
|
|
266
|
+
</List.Item>
|
|
267
|
+
);
|
|
268
|
+
})}
|
|
186
269
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
270
|
+
{dataset.link
|
|
271
|
+
.filter((i) => i.protocol.includes('WWW:LINK'))
|
|
272
|
+
.map((item, i) => {
|
|
273
|
+
return (
|
|
274
|
+
<List.Item>
|
|
275
|
+
<List.Content>
|
|
276
|
+
<div className="dataset-item">
|
|
277
|
+
<Icon className="linkify" />
|
|
278
|
+
<a href={item.url} className="item-link">
|
|
279
|
+
<span>{item.name || item.url}</span>
|
|
280
|
+
</a>
|
|
281
|
+
</div>
|
|
282
|
+
</List.Content>
|
|
283
|
+
{item.description && (
|
|
284
|
+
<span className="item-description">
|
|
285
|
+
{item.description}
|
|
286
|
+
</span>
|
|
287
|
+
)}
|
|
288
|
+
</List.Item>
|
|
289
|
+
);
|
|
290
|
+
})}
|
|
198
291
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
292
|
+
{dataset.resourceType[0] !==
|
|
293
|
+
'nonGeographicDataset' && (
|
|
294
|
+
<List.Item>
|
|
295
|
+
<List.Content>
|
|
296
|
+
<div className="dataset-item">
|
|
297
|
+
<Icon className="file pdf" />
|
|
298
|
+
<a
|
|
299
|
+
className="item-link"
|
|
300
|
+
target="_blank"
|
|
301
|
+
rel="noreferrer"
|
|
302
|
+
href={`https://sdi.eea.europa.eu/catalogue/srv/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
|
|
303
|
+
>
|
|
304
|
+
PDF Factsheet
|
|
305
|
+
</a>
|
|
306
|
+
</div>
|
|
307
|
+
</List.Content>
|
|
308
|
+
</List.Item>
|
|
309
|
+
)}
|
|
310
|
+
</List>
|
|
311
|
+
) : (
|
|
312
|
+
''
|
|
313
|
+
)}
|
|
314
|
+
</Accordion.Content>
|
|
215
315
|
</>
|
|
216
|
-
) : (
|
|
217
|
-
<span>{item?.spatial?.raw}</span>
|
|
218
|
-
)}
|
|
219
|
-
</div>
|
|
220
|
-
)}
|
|
221
|
-
</Accordion.Content>
|
|
222
|
-
|
|
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) => {
|
|
234
|
-
return (
|
|
235
|
-
<li key={i}>
|
|
236
|
-
<DateTime format="DATE_MED" value={temp.gte} /> -
|
|
237
|
-
<DateTime format="DATE_MED" value={temp.lte} />
|
|
238
|
-
</li>
|
|
239
316
|
);
|
|
240
317
|
})}
|
|
241
|
-
</
|
|
242
|
-
|
|
243
|
-
|
|
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>
|
|
253
|
-
|
|
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>
|
|
318
|
+
</Accordion>
|
|
319
|
+
</>
|
|
320
|
+
)}
|
|
281
321
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
>
|
|
287
|
-
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
322
|
+
{(item?.rod || item?.organisation || time_coverage?.raw.length > 0) && (
|
|
323
|
+
<h2>SDI Metadata Catalogue</h2>
|
|
324
|
+
)}
|
|
325
|
+
{!!item?.rod && (
|
|
326
|
+
<div>
|
|
327
|
+
<h5>Reporting obligations (ROD)</h5>
|
|
328
|
+
<ul>
|
|
329
|
+
{Array.isArray(item.rod?.raw) ? (
|
|
330
|
+
<>
|
|
331
|
+
{item?.rod?.raw.map((item, i) => {
|
|
332
|
+
return <li key={i}>{item}</li>;
|
|
333
|
+
})}
|
|
334
|
+
</>
|
|
335
|
+
) : (
|
|
336
|
+
<li>{item.rod?.raw}</li>
|
|
337
|
+
)}
|
|
338
|
+
</ul>
|
|
339
|
+
</div>
|
|
340
|
+
)}
|
|
341
|
+
{!!item?.organisation && (
|
|
342
|
+
<div>
|
|
343
|
+
<h5>Organisation</h5>
|
|
344
|
+
<ul>
|
|
345
|
+
{Array.isArray(item?.organisation?.raw) ? (
|
|
346
|
+
<>
|
|
347
|
+
{item?.organisation?.raw.map((item, i) => {
|
|
348
|
+
return <li key={i}>{item}</li>;
|
|
349
|
+
})}
|
|
350
|
+
</>
|
|
351
|
+
) : (
|
|
352
|
+
<li>{item?.organisation?.raw}</li>
|
|
300
353
|
)}
|
|
301
|
-
</
|
|
302
|
-
</
|
|
303
|
-
|
|
354
|
+
</ul>
|
|
355
|
+
</div>
|
|
356
|
+
)}
|
|
357
|
+
{time_coverage?.raw && time_coverage?.raw.length > 0 && (
|
|
358
|
+
<>
|
|
359
|
+
<h5>Temporal coverage</h5>
|
|
360
|
+
{Array.isArray(time_coverage?.raw) ? (
|
|
361
|
+
<span>
|
|
362
|
+
{startTempCoverage} - {endTempCoverage}
|
|
363
|
+
</span>
|
|
364
|
+
) : (
|
|
365
|
+
<span>{time_coverage?.raw}</span>
|
|
366
|
+
)}
|
|
367
|
+
</>
|
|
368
|
+
)}
|
|
304
369
|
</div>
|
|
370
|
+
|
|
371
|
+
{/* <div className="info-wrapper">
|
|
372
|
+
<div className="info-content">
|
|
373
|
+
<div className="info-title">More Information for {title?.raw}.</div>
|
|
374
|
+
<p>{description?.raw}</p>
|
|
375
|
+
</div>
|
|
376
|
+
</div> */}
|
|
305
377
|
</div>
|
|
306
378
|
) : null;
|
|
307
379
|
}
|
|
308
380
|
|
|
309
381
|
function DatahubItemView(props) {
|
|
382
|
+
const location = useLocation();
|
|
310
383
|
const [isClient, setIsClient] = React.useState();
|
|
311
384
|
React.useEffect(() => setIsClient(true), []);
|
|
312
385
|
|
|
@@ -339,7 +412,7 @@ function DatahubItemView(props) {
|
|
|
339
412
|
return (
|
|
340
413
|
<AppConfigContext.Provider value={appConfigContext}>
|
|
341
414
|
<SearchContext.Provider value={params}>
|
|
342
|
-
<ItemView docid={docid} />
|
|
415
|
+
<ItemView docid={docid} location={location} />
|
|
343
416
|
</SearchContext.Provider>
|
|
344
417
|
</AppConfigContext.Provider>
|
|
345
418
|
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const TemporalCoverage = (props) => {
|
|
4
|
+
const { temporalCoverage } = props;
|
|
5
|
+
const startTempCoverage = temporalCoverage.at(0);
|
|
6
|
+
const endTempCoverage = temporalCoverage.at(-1);
|
|
7
|
+
|
|
8
|
+
return temporalCoverage && temporalCoverage.length > 0 ? (
|
|
9
|
+
<>
|
|
10
|
+
{Array.isArray(temporalCoverage) ? (
|
|
11
|
+
<div className="temporal-coverage">
|
|
12
|
+
<div className="side-year">{parseInt(startTempCoverage) - 1}</div>
|
|
13
|
+
<div className="time-range">
|
|
14
|
+
<span>
|
|
15
|
+
{startTempCoverage} - {endTempCoverage}
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
<div className="side-year">{parseInt(endTempCoverage) + 1}</div>
|
|
19
|
+
</div>
|
|
20
|
+
) : (
|
|
21
|
+
<div className="temporal-coverage">
|
|
22
|
+
<div className="side-year">{parseInt(temporalCoverage) - 1}</div>
|
|
23
|
+
<div className="time-range">
|
|
24
|
+
<span>{temporalCoverage}</span>
|
|
25
|
+
</div>
|
|
26
|
+
<div className="side-year">{parseInt(temporalCoverage) + 1}</div>
|
|
27
|
+
</div>
|
|
28
|
+
)}
|
|
29
|
+
</>
|
|
30
|
+
) : null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default TemporalCoverage;
|