@eeacms/volto-datahub 0.1.4 → 0.1.5
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,8 +4,20 @@ 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.5](https://github.com/eea/volto-datahub/compare/0.1.4...0.1.5)
|
|
8
|
+
|
|
9
|
+
- Fix merge [`6a8f3d4`](https://github.com/eea/volto-datahub/commit/6a8f3d4f3bfaacb8e0938929d8038f9e31a26ced)
|
|
10
|
+
- Fix layout [`129d480`](https://github.com/eea/volto-datahub/commit/129d4802a63aa346d11ae8e54b323580213c0a71)
|
|
11
|
+
- Fix merge [`3df3a81`](https://github.com/eea/volto-datahub/commit/3df3a8189448dcdd052692b6f5d835a1ea752a50)
|
|
12
|
+
- Add back to search [`b80ce25`](https://github.com/eea/volto-datahub/commit/b80ce250d326fa75c8451d70fe366148f7d49abb)
|
|
13
|
+
- Change datahubitem path [`7ccdbf0`](https://github.com/eea/volto-datahub/commit/7ccdbf0619e45a99e85b096dcdfb2e645e3ecc90)
|
|
14
|
+
- Integrate the Breadcrumb [`bccae64`](https://github.com/eea/volto-datahub/commit/bccae6445b3c46d4715743558343a14b08c7c07f)
|
|
15
|
+
|
|
7
16
|
#### [0.1.4](https://github.com/eea/volto-datahub/compare/0.1.3...0.1.4)
|
|
8
17
|
|
|
18
|
+
> 28 July 2022
|
|
19
|
+
|
|
20
|
+
- Develop [`#5`](https://github.com/eea/volto-datahub/pull/5)
|
|
9
21
|
- Improve temporal coverage [`d0483d4`](https://github.com/eea/volto-datahub/commit/d0483d46259b956a96a66268b9ec305d27456f88)
|
|
10
22
|
- Fix warning message [`305d2d6`](https://github.com/eea/volto-datahub/commit/305d2d61123d1ee23e8a4baf837b1aadc5d9a41f)
|
|
11
23
|
- Hide readingTime for now [`5e508d3`](https://github.com/eea/volto-datahub/commit/5e508d3c2bfd97bcc01dca59894a4f9ad582284b)
|
package/package.json
CHANGED
|
@@ -20,15 +20,48 @@ import {
|
|
|
20
20
|
import { DateTime } from '@eeacms/search';
|
|
21
21
|
import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
|
|
22
22
|
import { Callout } from '@eeacms/volto-eea-design-system/ui';
|
|
23
|
+
import { useDispatch } from 'react-redux';
|
|
23
24
|
import config from '@plone/volto/registry';
|
|
25
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
24
26
|
|
|
25
27
|
const appName = 'datahub';
|
|
26
28
|
|
|
27
29
|
function ItemView(props) {
|
|
28
|
-
const { docid } = props;
|
|
30
|
+
const { docid, location } = props;
|
|
31
|
+
const { fromPathname, fromSearch } = location?.state || {};
|
|
32
|
+
const dispatch = useDispatch();
|
|
33
|
+
// const content = useSelector((state) => state.content.data);
|
|
29
34
|
const result = useResult(null, docid);
|
|
30
|
-
const item = result ? result._result :
|
|
31
|
-
const { title, description, raw_value, event, issued, time_coverage } =
|
|
35
|
+
const item = result ? result._result : null;
|
|
36
|
+
const { title, description, raw_value, event, issued, time_coverage } =
|
|
37
|
+
item || {}; // readingTime
|
|
38
|
+
const rawTitle = title?.raw || '';
|
|
39
|
+
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
const handler = async () => {
|
|
42
|
+
if (item) {
|
|
43
|
+
const action = {
|
|
44
|
+
type: 'GET_BREADCRUMBS_SUCCESS',
|
|
45
|
+
result: {
|
|
46
|
+
items: [
|
|
47
|
+
{
|
|
48
|
+
title: 'Datahub',
|
|
49
|
+
'@id': '/en/datahub',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: rawTitle,
|
|
53
|
+
'@id': `/en/datahub/view/${docid}`,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
await dispatch({ type: 'GET_BREADCRUMBS_PENDING' }); // satisfy content load protection
|
|
59
|
+
await dispatch(action);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
handler();
|
|
64
|
+
}, [item, dispatch, docid, rawTitle]);
|
|
32
65
|
const {
|
|
33
66
|
// contactForResource,
|
|
34
67
|
// contact,
|
|
@@ -54,7 +87,6 @@ function ItemView(props) {
|
|
|
54
87
|
|
|
55
88
|
setActiveIndex(newIndex);
|
|
56
89
|
};
|
|
57
|
-
|
|
58
90
|
// console.log('result', result?._result);
|
|
59
91
|
|
|
60
92
|
const panes = [
|
|
@@ -83,6 +115,18 @@ function ItemView(props) {
|
|
|
83
115
|
</Portal>
|
|
84
116
|
|
|
85
117
|
<div className="dataset-container">
|
|
118
|
+
{location?.state && (
|
|
119
|
+
<Link
|
|
120
|
+
className="search-link"
|
|
121
|
+
to={{
|
|
122
|
+
pathname: fromPathname,
|
|
123
|
+
search: fromSearch,
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<i class="ri-arrow-go-back-line"></i>
|
|
127
|
+
Back to search
|
|
128
|
+
</Link>
|
|
129
|
+
)}
|
|
86
130
|
<div className="dataset-header">
|
|
87
131
|
<h1>{title?.raw}</h1>
|
|
88
132
|
<div className="dataset-header-bottom">
|
|
@@ -95,8 +139,8 @@ function ItemView(props) {
|
|
|
95
139
|
Last modified: <DateTime format="DATE_MED" value={changeDate} />
|
|
96
140
|
</span>
|
|
97
141
|
{/*<span className="header-data">
|
|
98
|
-
|
|
99
|
-
|
|
142
|
+
Reading time: {readingTime?.raw}
|
|
143
|
+
</span>*/}
|
|
100
144
|
</div>
|
|
101
145
|
</div>
|
|
102
146
|
<Callout>{description?.raw}</Callout>
|
|
@@ -149,7 +193,7 @@ function ItemView(props) {
|
|
|
149
193
|
<Icon className="ri-arrow-down-s-line" />
|
|
150
194
|
</Accordion.Title>
|
|
151
195
|
<Accordion.Content active={activeIndex.includes(0)}>
|
|
152
|
-
{item
|
|
196
|
+
{!!item?.rod && (
|
|
153
197
|
<div>
|
|
154
198
|
Reporting obligations (ROD):
|
|
155
199
|
<ul>
|
|
@@ -166,7 +210,7 @@ function ItemView(props) {
|
|
|
166
210
|
</div>
|
|
167
211
|
)}
|
|
168
212
|
|
|
169
|
-
{item?.organisation && (
|
|
213
|
+
{!!item?.organisation && (
|
|
170
214
|
<div>
|
|
171
215
|
Organisation:
|
|
172
216
|
<ul>
|
|
@@ -307,6 +351,7 @@ function ItemView(props) {
|
|
|
307
351
|
}
|
|
308
352
|
|
|
309
353
|
function DatahubItemView(props) {
|
|
354
|
+
const location = useLocation();
|
|
310
355
|
const [isClient, setIsClient] = React.useState();
|
|
311
356
|
React.useEffect(() => setIsClient(true), []);
|
|
312
357
|
|
|
@@ -339,7 +384,7 @@ function DatahubItemView(props) {
|
|
|
339
384
|
return (
|
|
340
385
|
<AppConfigContext.Provider value={appConfigContext}>
|
|
341
386
|
<SearchContext.Provider value={params}>
|
|
342
|
-
<ItemView docid={docid} />
|
|
387
|
+
<ItemView docid={docid} location={location} />
|
|
343
388
|
</SearchContext.Provider>
|
|
344
389
|
</AppConfigContext.Provider>
|
|
345
390
|
);
|
|
@@ -40,7 +40,7 @@ const DatahubCardItem = (props) => {
|
|
|
40
40
|
const { topic } = result._result || [];
|
|
41
41
|
const [hovered, setHovered] = React.useState(false);
|
|
42
42
|
|
|
43
|
-
//
|
|
43
|
+
// const { pathname, search } = useLocation();
|
|
44
44
|
|
|
45
45
|
let metaType = result.metaTypes || '';
|
|
46
46
|
if (metaType.length === 0) {
|
|
@@ -48,11 +48,12 @@ const DatahubCardItem = (props) => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const classColLeft = result.hasImage ? 'col-left' : 'col-left no-image';
|
|
51
|
+
const [resultId] = (result.href || '').split('/').reverse();
|
|
51
52
|
|
|
52
53
|
// const { width } = useWindowDimensions();
|
|
53
54
|
// const isSmallScreen = width < 1000;
|
|
54
55
|
// const clusters = result.clusterInfo;
|
|
55
|
-
|
|
56
|
+
// console.log('result', result.metaTypes, result._result);
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
59
|
<div
|
|
@@ -75,7 +76,16 @@ const DatahubCardItem = (props) => {
|
|
|
75
76
|
[EEA]
|
|
76
77
|
</div>
|
|
77
78
|
<h3>
|
|
78
|
-
<Link
|
|
79
|
+
<Link
|
|
80
|
+
to={{
|
|
81
|
+
pathname: `/en/datahub/datahubitem-view/${resultId}`,
|
|
82
|
+
state: {
|
|
83
|
+
fromPathname: window.location.pathname,
|
|
84
|
+
fromSearch: window.location.search,
|
|
85
|
+
},
|
|
86
|
+
}}
|
|
87
|
+
title={result.title}
|
|
88
|
+
>
|
|
79
89
|
{firstWords(result.title, 12)}
|
|
80
90
|
</Link>
|
|
81
91
|
{result.isNew && (
|
package/src/index.js
CHANGED
|
@@ -30,10 +30,10 @@ const applyConfig = (config) => {
|
|
|
30
30
|
datahub.requestBodyModifiers.push(tweakForNLPService);
|
|
31
31
|
// datahub.resultViews[0].factories.item = "DatahubListingViewItem"
|
|
32
32
|
|
|
33
|
-
config.settings.nonContentRoutes.push(
|
|
33
|
+
config.settings.nonContentRoutes.push(/datahubitem-view\/(.*)/); // \/(.*)\/
|
|
34
34
|
config.addonRoutes = [
|
|
35
35
|
{
|
|
36
|
-
path: '
|
|
36
|
+
path: '*/datahubitem-view/:id',
|
|
37
37
|
component: DatahubItemView,
|
|
38
38
|
},
|
|
39
39
|
|