@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.
@@ -154,7 +154,7 @@ const LandingPage = (props) => {
154
154
  return (
155
155
  <div className="landing-page-container">
156
156
  <div className="landing-page">
157
- <h3 className="browse-by">Browse by</h3>
157
+ <h4 className="browse-by">Browse by</h4>
158
158
 
159
159
  <div className="filters">
160
160
  {sections
@@ -173,50 +173,56 @@ const LandingPage = (props) => {
173
173
  );
174
174
  })}
175
175
  </div>
176
- <div className="ui cards">
177
- {sortedTiles(tiles, activeSectionConfig, appConfig).map((topic) => {
178
- const onClickHandler = () => {
179
- setFilter(
180
- activeSection,
181
- topic.value,
182
- activeSectionConfig.filterType || 'any',
183
- );
176
+ <div className="landing-page-cards">
177
+ <div className="ui cards">
178
+ {sortedTiles(tiles, activeSectionConfig, appConfig).map((topic) => {
179
+ const onClickHandler = () => {
180
+ setFilter(
181
+ activeSection,
182
+ topic.value,
183
+ activeSectionConfig.filterType || 'any',
184
+ );
185
+
186
+ // apply configured default values
187
+ appConfig.facets
188
+ .filter((f) => f.field !== activeSection && f.default)
189
+ .forEach((facet) => {
190
+ facet.default.values.forEach((value) =>
191
+ setFilter(
192
+ facet.field,
193
+ value,
194
+ facet.default.type || 'any',
195
+ ),
196
+ );
197
+ });
198
+ setSort(sortField, sortDirection);
199
+ setShowFacets(true);
200
+ };
184
201
 
185
- // apply configured default values
186
- appConfig.facets
187
- .filter((f) => f.field !== activeSection && f.default)
188
- .forEach((facet) => {
189
- facet.default.values.forEach((value) =>
190
- setFilter(facet.field, value, facet.default.type || 'any'),
191
- );
192
- });
193
- setSort(sortField, sortDirection);
194
- setShowFacets(true);
195
- };
196
-
197
- return (
198
- <div
199
- key={topic.value}
200
- tabIndex="-1"
201
- role="button"
202
- onKeyDown={onClickHandler}
203
- className="ui card"
204
- onClick={onClickHandler}
205
- >
206
- <div className="content">
207
- <div className="header">
208
- {icon ? <Icon {...icon} type={topic.value} /> : ''}
209
- <Term term={topic.value} field={activeSection} />
202
+ return (
203
+ <div
204
+ key={topic.value}
205
+ tabIndex="-1"
206
+ role="button"
207
+ onKeyDown={onClickHandler}
208
+ className="ui card"
209
+ onClick={onClickHandler}
210
+ >
211
+ <div className="content">
212
+ <div className="header">
213
+ {icon ? <Icon {...icon} type={topic.value} /> : ''}
214
+ <Term term={topic.value} field={activeSection} />
215
+ </div>
216
+ </div>
217
+ <div className="extra content">
218
+ <span className="count">
219
+ {topic.count} {topic.count === 1 ? 'item' : 'items'}
220
+ </span>
210
221
  </div>
211
222
  </div>
212
- <div className="extra content">
213
- <span className="count">
214
- {topic.count} {topic.count === 1 ? 'item' : 'items'}
215
- </span>
216
- </div>
217
- </div>
218
- );
219
- })}
223
+ );
224
+ })}
225
+ </div>
220
226
  </div>
221
227
  {hasOverflow ? (
222
228
  <div className="info">
@@ -225,24 +231,26 @@ const LandingPage = (props) => {
225
231
  ) : null}
226
232
  {children}
227
233
  <hr></hr>
228
- <div className="ui cards">
229
- <div
230
- key="all_series"
231
- tabIndex="-1"
232
- role="button"
233
- onKeyDown={fixedOnClickHandler}
234
- className="ui card"
235
- onClick={fixedOnClickHandler}
236
- >
237
- <div className="content">
238
- <div className="header">
239
- <Term term={all_series.value} field="cluster_name" />
234
+ <div className="landing-page-cards">
235
+ <div className="ui cards">
236
+ <div
237
+ key="all_series"
238
+ tabIndex="-1"
239
+ role="button"
240
+ onKeyDown={fixedOnClickHandler}
241
+ className="ui card"
242
+ onClick={fixedOnClickHandler}
243
+ >
244
+ <div className="content">
245
+ <div className="header">
246
+ <Term term={all_series.value} field="cluster_name" />
247
+ </div>
248
+ </div>
249
+ <div className="extra content">
250
+ <span className="count">
251
+ {all_series.count} {all_series.count === 1 ? 'item' : 'items'}
252
+ </span>
240
253
  </div>
241
- </div>
242
- <div className="extra content">
243
- <span className="count">
244
- {all_series.count} {all_series.count === 1 ? 'item' : 'items'}
245
- </span>
246
254
  </div>
247
255
  </div>
248
256
  </div>
@@ -1,31 +1,43 @@
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
43
  // console.log('result', result.metaTypes, result._result);
@@ -37,9 +49,9 @@ const DatahubCardItem = (props) => {
37
49
 
38
50
  const classColLeft = result.hasImage ? 'col-left' : 'col-left no-image';
39
51
 
40
- const { width } = useWindowDimensions();
41
- const isSmallScreen = width < 1000;
42
- const clusters = result.clusterInfo;
52
+ // const { width } = useWindowDimensions();
53
+ // const isSmallScreen = width < 1000;
54
+ // const clusters = result.clusterInfo;
43
55
  const [resultId] = (result.href || '').split('/').reverse();
44
56
 
45
57
  return (
@@ -48,16 +60,20 @@ const DatahubCardItem = (props) => {
48
60
  onMouseEnter={() => setHovered(true)}
49
61
  onMouseLeave={() => setHovered(false)}
50
62
  >
51
- <div className="col-full">
63
+ {/*<div className="col-full">
52
64
  <div className="meta">
53
65
  <ContentClusters clusters={clusters} item={result} />
54
66
  <div className="tags-list">
55
67
  <TagsList value={result.tags} />
56
68
  </div>
57
69
  </div>
58
- </div>
70
+ </div>*/}
59
71
  <div className={classColLeft}>
60
72
  <div className="details">
73
+ <div className="result-info">
74
+ <span className="result-info-title">Author: </span>
75
+ [EEA]
76
+ </div>
61
77
  <h3>
62
78
  <Link to={`/datahub/view/${resultId}`} title={result.title}>
63
79
  {firstWords(result.title, 12)}
@@ -73,7 +89,13 @@ const DatahubCardItem = (props) => {
73
89
  </Label>
74
90
  )}
75
91
  </h3>
76
- <div className="source">
92
+ {/* <SegmentedBreadcrumb */}
93
+ {/* href={result.href} */}
94
+ {/* short={true} */}
95
+ {/* maxChars={40} */}
96
+ {/* /> */}
97
+
98
+ {/*<div className="source">
77
99
  <span>Source: </span>
78
100
  <Link to={`/datahub/view/${resultId}`} title={result.title}>
79
101
  <strong title={result.source} className="source">
@@ -86,11 +108,6 @@ const DatahubCardItem = (props) => {
86
108
  8,
87
109
  )}
88
110
  </strong>
89
- {/* <SegmentedBreadcrumb */}
90
- {/* href={result.href} */}
91
- {/* short={true} */}
92
- {/* maxChars={40} */}
93
- {/* /> */}
94
111
  </Link>
95
112
 
96
113
  {showControls && !isSmallScreen && (
@@ -114,9 +131,31 @@ const DatahubCardItem = (props) => {
114
131
  </Dropdown.Menu>
115
132
  </Dropdown>
116
133
  )}
117
- </div>
134
+ </div>*/}
118
135
 
119
136
  {props.children ? props.children : <ResultContext {...props} />}
137
+
138
+ <div className="result-bottom">
139
+ {topic ? (
140
+ <div className="result-info">
141
+ <span className="result-info-title">Topic: </span>
142
+ <StringList value={topic.raw} />
143
+ </div>
144
+ ) : null}
145
+ <div className="result-info">
146
+ <span className="result-info-title">Last modified: </span>
147
+ <FormattedDate
148
+ format="DATE_MED"
149
+ value={DateTime.fromISO(
150
+ result?._result.raw_value.raw.changeDate,
151
+ )}
152
+ />
153
+ </div>
154
+ <div className="result-info">
155
+ <span className="result-info-title">Available formats: </span>
156
+ [Icons]
157
+ </div>
158
+ </div>
120
159
  </div>
121
160
  {debugQuery && (
122
161
  <div>