@eeacms/volto-clms-theme 1.1.34 → 1.1.36

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,6 +4,17 @@ 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
+ ### [1.1.36](https://github.com/eea/volto-clms-theme/compare/1.1.35...1.1.36) - 30 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - extract the extra data to a specific component [Mikel Larreategi - [`8055764`](https://github.com/eea/volto-clms-theme/commit/8055764a7331c25a9bd9e30a512aae2edc80dc72)]
12
+ - new button class [Mikel Larreategi - [`4c3d256`](https://github.com/eea/volto-clms-theme/commit/4c3d256ab59b04f23becd4a17ad2688bc4413a8e)]
13
+ ### [1.1.35](https://github.com/eea/volto-clms-theme/compare/1.1.34...1.1.35) - 28 August 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - CLMS-2110 (Feat): Bookmark Dependencies [Urkorue - [`d613864`](https://github.com/eea/volto-clms-theme/commit/d6138641365461996e720bc6510578c7e607f20a)]
7
18
  ### [1.1.34](https://github.com/eea/volto-clms-theme/compare/1.1.33...1.1.34) - 24 August 2023
8
19
 
9
20
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.34",
3
+ "version": "1.1.36",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@eeacms/volto-accordion-block": "7.0.0",
39
39
  "@eeacms/volto-arcgis-block": "*",
40
- "@eeacms/volto-clms-utils": "0.1.10",
40
+ "@eeacms/volto-clms-utils": "0.1.12",
41
41
  "@eeacms/volto-columns-block": "6.0.2",
42
42
  "@eeacms/volto-embed": "5.0.1",
43
43
  "@eeacms/volto-metadata-block": "5.0.1",
@@ -18,6 +18,7 @@ function CclButton(props) {
18
18
  let buttonClass = classNames('ccl-button', {
19
19
  'ccl-button-green': mode === 'filled',
20
20
  'ccl-button--default': mode === 'default',
21
+ 'ccl-button-small': mode === 'small',
21
22
  });
22
23
 
23
24
  const flattern_url = flattenToAppURL(url);
@@ -15,6 +15,7 @@ import { portal_types_labels } from '../Blocks/CustomTemplates/VoltoSearchBlock'
15
15
  import PropTypes from 'prop-types';
16
16
  import { FormattedMessage } from 'react-intl';
17
17
  import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
18
+ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
18
19
 
19
20
  const CardImage = ({ card, size = 'preview', isCustomCard }) => {
20
21
  return card?.image_field ? (
@@ -102,6 +103,76 @@ const DocCard = ({ card, url, showEditor, children }) => {
102
103
  </>
103
104
  );
104
105
  };
106
+
107
+ const SearchResultExtras = (props) => {
108
+ const { content } = props;
109
+ const locale = useSelector((state) => state.intl.locale);
110
+ const isLoggedIn = useSelector((state) => state.userSession?.token);
111
+ const isAuxiliary = content?.mapviewer_viewservice
112
+ ? content?.mapviewer_viewservice
113
+ .toLowerCase()
114
+ .startsWith(
115
+ 'https://trial.discomap.eea.europa.eu/arcgis/services/clms/worldcountries/mapserver/wmsserver',
116
+ )
117
+ : false;
118
+
119
+ return (
120
+ <div className="card-doc-extrametadata">
121
+ {content?.['@type'] === 'DataSet' && (
122
+ <>
123
+ <br />
124
+ <CclButton mode="small" url={content['@id']}>
125
+ <FormattedMessage id="View more" defaultMessage="View more" />
126
+ </CclButton>
127
+ &nbsp; &nbsp; &nbsp;
128
+ </>
129
+ )}
130
+
131
+ {content?.downloadable_dataset &&
132
+ content?.['@type'] === 'DataSet' &&
133
+ isLoggedIn && (
134
+ <>
135
+ <CclButton mode="small" url={`${content['@id']}#download`}>
136
+ <FormattedMessage id="Download" defaultMessage="Download" />
137
+ </CclButton>
138
+ &nbsp; &nbsp; &nbsp;
139
+ </>
140
+ )}
141
+
142
+ {content?.downloadable_dataset &&
143
+ content?.['@type'] === 'DataSet' &&
144
+ !isLoggedIn && (
145
+ <>
146
+ <CclLoginModal
147
+ otherPath={`${content['@id']}#download`}
148
+ triggerComponent={() => (
149
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
150
+ <CclButton mode="small">
151
+ <FormattedMessage id="Download" defaultMessage="Download" />
152
+ </CclButton>
153
+ )}
154
+ />
155
+ &nbsp; &nbsp; &nbsp;
156
+ </>
157
+ )}
158
+
159
+ {content?.mapviewer_viewservice?.length > 0 &&
160
+ !isAuxiliary &&
161
+ content?.['@type'] === 'DataSet' && (
162
+ <CclButton
163
+ mode="small"
164
+ url={'/' + locale + '/map-viewer?dataset=' + content.UID}
165
+ >
166
+ <FormattedMessage
167
+ id="View in the data viewer"
168
+ defaultMessage="View in the data viewer"
169
+ />
170
+ </CclButton>
171
+ )}
172
+ </div>
173
+ );
174
+ };
175
+
105
176
  function CclCard(props) {
106
177
  const {
107
178
  type,
@@ -148,9 +219,6 @@ function CclCard(props) {
148
219
  ? 'line card-line-no-description'
149
220
  : type || 'line');
150
221
 
151
- const locale = useSelector((state) => state.intl.locale);
152
- const isLoggedIn = useSelector((state) => state.userSession?.token);
153
-
154
222
  return (
155
223
  <CardLink
156
224
  url={url}
@@ -237,6 +305,8 @@ function CclCard(props) {
237
305
  </Label>
238
306
  <DocCard card={card} url={url} showEditor={showEditor}>
239
307
  {children}
308
+
309
+ <SearchResultExtras content={card} />
240
310
  </DocCard>
241
311
  </>
242
312
  )}
@@ -342,59 +412,7 @@ function CclCard(props) {
342
412
  )}
343
413
  {children}
344
414
 
345
- <div className="card-doc-extrametadata">
346
- {card?.['@type'] === 'DataSet' && (
347
- <>
348
- <br />
349
- <Link to={'/' + locale + '/map-viewer?dataset=' + card.UID}>
350
- <FormattedMessage
351
- id="View in the data viewer"
352
- defaultMessage="View in the data viewer"
353
- />
354
- </Link>
355
- &nbsp; &nbsp; &nbsp;
356
- </>
357
- )}
358
-
359
- {card?.['@type'] === 'DataSet' && isLoggedIn && (
360
- <>
361
- <Link to={`${card['@id']}#download`}>
362
- <FormattedMessage
363
- id="Download"
364
- defaultMessage="Download"
365
- />
366
- </Link>
367
- &nbsp; &nbsp; &nbsp;
368
- </>
369
- )}
370
-
371
- {card?.['@type'] === 'DataSet' && !isLoggedIn && (
372
- <>
373
- <CclLoginModal
374
- otherPath={`${card['@id']}#download`}
375
- triggerComponent={() => (
376
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
377
- <Link>
378
- <FormattedMessage
379
- id="Download"
380
- defaultMessage="Download"
381
- />
382
- </Link>
383
- )}
384
- />
385
- &nbsp; &nbsp; &nbsp;
386
- </>
387
- )}
388
-
389
- {card?.['@type'] === 'DataSet' && (
390
- <Link to={card['@id']}>
391
- <FormattedMessage
392
- id="View more"
393
- defaultMessage="View more"
394
- />
395
- </Link>
396
- )}
397
- </div>
415
+ <SearchResultExtras content={card} />
398
416
  </div>
399
417
  </>
400
418
  )}
@@ -31,6 +31,17 @@
31
31
  color: @clmsGreen;
32
32
  }
33
33
 
34
+ .ccl-button.ccl-button-small {
35
+ border: solid 1px fade(@clmsGreen, 20%);
36
+ padding: 0.3rem 1rem;
37
+ font-size: 0.85rem;
38
+ }
39
+
40
+ .ccl-button.ccl-button-small:hover {
41
+ background-color: @clmsGreen;
42
+ color: white;
43
+ }
44
+
34
45
  .ccl-button[disabled] {
35
46
  border-color: @clmsGreen;
36
47
  color: @clmsGreen;