@eeacms/volto-datahub 0.1.3 → 0.1.6

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.
@@ -1,34 +1,46 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
- import { Label, Button, Dropdown } from 'semantic-ui-react';
3
+ import {
4
+ Label,
5
+ // Button,
6
+ // Dropdown
7
+ } from 'semantic-ui-react';
8
+ import { DateTime as FormattedDate, StringList } from '@eeacms/search';
9
+ import { DateTime } from 'luxon';
4
10
  // import { useAppConfig, useWindowDimensions } from '@eeacms/search/lib/hocs';
5
11
  // import { TagsList } from '@eeacms/search/components'; // SegmentedBreadcrumb,
6
12
  // import { firstWords, getTermDisplayValue } from '@eeacms/search/lib/utils';
7
-
8
13
  // import MoreLikeThisTrigger from '@eeacms/search/components/Result/MoreLikeThisTrigger';
9
14
  // import ExternalLink from '@eeacms/search/components/Result/ExternalLink';
10
15
  // import ResultContext from '@eeacms/search/components/Result/ResultContext';
11
16
  // import ContentClusters from '@eeacms/search/components/Result/ContentClusters';
12
17
  import {
13
18
  useAppConfig,
14
- useWindowDimensions,
15
- ContentClusters,
16
- MoreLikeThisTrigger,
17
- TagsList,
18
- // ExternalLink,
19
19
  ResultContext,
20
20
  firstWords,
21
- getTermDisplayValue,
21
+ // ContentClusters,
22
+ // useWindowDimensions,
23
+ // MoreLikeThisTrigger,
24
+ // TagsList,
25
+ // ExternalLink,
26
+ // getTermDisplayValue,
22
27
  } from '@eeacms/search';
23
28
  import { Link } from 'react-router-dom';
24
29
 
25
30
  const DatahubCardItem = (props) => {
26
- const { result, showControls = true } = props;
31
+ const {
32
+ result,
33
+ // showControls = true
34
+ } = props;
27
35
  const { appConfig } = useAppConfig();
28
- const { vocab = {}, debugQuery } = appConfig;
36
+ const {
37
+ // vocab = {},
38
+ debugQuery,
39
+ } = appConfig;
40
+ const { topic } = result._result || [];
29
41
  const [hovered, setHovered] = React.useState(false);
30
42
 
31
- // console.log('result', result.metaTypes, result._result);
43
+ // const { pathname, search } = useLocation();
32
44
 
33
45
  let metaType = result.metaTypes || '';
34
46
  if (metaType.length === 0) {
@@ -36,30 +48,44 @@ const DatahubCardItem = (props) => {
36
48
  }
37
49
 
38
50
  const classColLeft = result.hasImage ? 'col-left' : 'col-left no-image';
39
-
40
- const { width } = useWindowDimensions();
41
- const isSmallScreen = width < 1000;
42
- const clusters = result.clusterInfo;
43
51
  const [resultId] = (result.href || '').split('/').reverse();
44
52
 
53
+ // const { width } = useWindowDimensions();
54
+ // const isSmallScreen = width < 1000;
55
+ // const clusters = result.clusterInfo;
56
+ // console.log('result', result.metaTypes, result._result);
57
+
45
58
  return (
46
59
  <div
47
60
  className={cx('search-result', { hovered })}
48
61
  onMouseEnter={() => setHovered(true)}
49
62
  onMouseLeave={() => setHovered(false)}
50
63
  >
51
- <div className="col-full">
64
+ {/*<div className="col-full">
52
65
  <div className="meta">
53
66
  <ContentClusters clusters={clusters} item={result} />
54
67
  <div className="tags-list">
55
68
  <TagsList value={result.tags} />
56
69
  </div>
57
70
  </div>
58
- </div>
71
+ </div>*/}
59
72
  <div className={classColLeft}>
60
73
  <div className="details">
74
+ <div className="result-info">
75
+ <span className="result-info-title">Author: </span>
76
+ [EEA]
77
+ </div>
61
78
  <h3>
62
- <Link to={`/datahub/view/${resultId}`} title={result.title}>
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
+ >
63
89
  {firstWords(result.title, 12)}
64
90
  </Link>
65
91
  {result.isNew && (
@@ -73,7 +99,13 @@ const DatahubCardItem = (props) => {
73
99
  </Label>
74
100
  )}
75
101
  </h3>
76
- <div className="source">
102
+ {/* <SegmentedBreadcrumb */}
103
+ {/* href={result.href} */}
104
+ {/* short={true} */}
105
+ {/* maxChars={40} */}
106
+ {/* /> */}
107
+
108
+ {/*<div className="source">
77
109
  <span>Source: </span>
78
110
  <Link to={`/datahub/view/${resultId}`} title={result.title}>
79
111
  <strong title={result.source} className="source">
@@ -86,11 +118,6 @@ const DatahubCardItem = (props) => {
86
118
  8,
87
119
  )}
88
120
  </strong>
89
- {/* <SegmentedBreadcrumb */}
90
- {/* href={result.href} */}
91
- {/* short={true} */}
92
- {/* maxChars={40} */}
93
- {/* /> */}
94
121
  </Link>
95
122
 
96
123
  {showControls && !isSmallScreen && (
@@ -114,9 +141,31 @@ const DatahubCardItem = (props) => {
114
141
  </Dropdown.Menu>
115
142
  </Dropdown>
116
143
  )}
117
- </div>
144
+ </div>*/}
118
145
 
119
146
  {props.children ? props.children : <ResultContext {...props} />}
147
+
148
+ <div className="result-bottom">
149
+ {topic ? (
150
+ <div className="result-info">
151
+ <span className="result-info-title">Topic: </span>
152
+ <StringList value={topic.raw} />
153
+ </div>
154
+ ) : null}
155
+ <div className="result-info">
156
+ <span className="result-info-title">Last modified: </span>
157
+ <FormattedDate
158
+ format="DATE_MED"
159
+ value={DateTime.fromISO(
160
+ result?._result.raw_value.raw.changeDate,
161
+ )}
162
+ />
163
+ </div>
164
+ <div className="result-info">
165
+ <span className="result-info-title">Available formats: </span>
166
+ [Icons]
167
+ </div>
168
+ </div>
120
169
  </div>
121
170
  {debugQuery && (
122
171
  <div>