design-comuni-plone-theme 11.20.0 → 11.20.2

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.
@@ -50,13 +50,28 @@ const Dates = ({ content, show_image, moment: momentlib, rrule }) => {
50
50
  let recurrenceText = null;
51
51
 
52
52
  if (content.recurrence) {
53
+ const isRecurrenceByDay = content.recurrence.includes('BYDAY=+');
54
+ const isWeekdaySunday = content.recurrence
55
+ .split('BYDAY')[1]
56
+ ?.includes('SU');
53
57
  const RRULE_LANGUAGE = rrulei18n(intl, moment);
54
58
  rruleSet = rrulestr(content.recurrence, {
55
59
  compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
56
60
  forceset: true,
57
61
  });
62
+
58
63
  recurrenceText = rruleSet.rrules()[0]?.toText(
59
64
  (t) => {
65
+ if (moment.locale(intl.locale) === 'it' && isRecurrenceByDay) {
66
+ RRULE_LANGUAGE.strings.th = '°';
67
+ RRULE_LANGUAGE.strings.nd = '°';
68
+ RRULE_LANGUAGE.strings.rd = '°';
69
+ RRULE_LANGUAGE.strings.st = '°';
70
+
71
+ if (isWeekdaySunday) {
72
+ RRULE_LANGUAGE.strings['on the'] = 'la';
73
+ }
74
+ }
60
75
  return RRULE_LANGUAGE.strings[t];
61
76
  },
62
77
  RRULE_LANGUAGE,
@@ -24,17 +24,9 @@ export {
24
24
 
25
25
  /********* ICONS ********* */
26
26
  export getItemIcon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/common/common';
27
- export const Icon = loadable(() =>
28
- import(
29
- /* webpackChunkName: "DCPTIcons" */ 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon'
30
- ),
31
- );
27
+ export Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';
32
28
  export SectionIcon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/SectionIcon';
33
- export const FontAwesomeIcon = loadable(() =>
34
- import(
35
- /* webpackChunkName: "DCPTIcons" */ 'design-comuni-plone-theme/components/ItaliaTheme/Icons/FontAwesomeIcon'
36
- ),
37
- );
29
+ export FontAwesomeIcon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/FontAwesomeIcon';
38
30
 
39
31
  /********* COMMONS ********* */
40
32
  export CardCategory from 'design-comuni-plone-theme/components/ItaliaTheme/Cards/CardCategory';
@@ -56,25 +48,29 @@ export SubsiteHeader from 'design-comuni-plone-theme/components/ItaliaTheme/Head
56
48
  export ParentSiteMenu from 'design-comuni-plone-theme/components/ItaliaTheme/Header/ParentSiteMenu';
57
49
  export HeaderSearch from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSearch/HeaderSearch';
58
50
  export SearchModal from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSearch/SearchModal';
59
- export const SearchTopics = loadable(() =>
60
- import(
61
- /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchTopics'
62
- ),
51
+ export const SearchTopics = loadable(
52
+ () =>
53
+ import(
54
+ /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchTopics'
55
+ ),
63
56
  );
64
- export const SearchCTs = loadable(() =>
65
- import(
66
- /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchCTs'
67
- ),
57
+ export const SearchCTs = loadable(
58
+ () =>
59
+ import(
60
+ /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchCTs'
61
+ ),
68
62
  );
69
- export const SearchResultItem = loadable(() =>
70
- import(
71
- /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/ResultItem'
72
- ),
63
+ export const SearchResultItem = loadable(
64
+ () =>
65
+ import(
66
+ /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/ResultItem'
67
+ ),
73
68
  );
74
- export const SearchSections = loadable(() =>
75
- import(
76
- /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchSections'
77
- ),
69
+ export const SearchSections = loadable(
70
+ () =>
71
+ import(
72
+ /* webpackChunkName: "DCPTSearch" */ 'design-comuni-plone-theme/components/ItaliaTheme/Search/SearchSections'
73
+ ),
78
74
  );
79
75
  export MegaMenu from 'design-comuni-plone-theme/components/ItaliaTheme/MegaMenu/MegaMenu';
80
76
  export MenuSecondary from 'design-comuni-plone-theme/components/ItaliaTheme/MenuSecondary/MenuSecondary';
@@ -5,10 +5,11 @@ export const loadables = {
5
5
  reactSlick: loadable.lib(() => import('react-slick')),
6
6
  rrule: loadable.lib(() => import('rrule')),
7
7
  htmlDiffLib: loadable.lib(() => import('htmldiff-js')),
8
- fontAwesomeAliases: loadable.lib(() =>
9
- import(
10
- /* webpackChunkName: "DCPTIcons" */ 'design-comuni-plone-theme/helpers/IconWidget/IconAliasHelper'
11
- ),
8
+ fontAwesomeAliases: loadable.lib(
9
+ () =>
10
+ import(
11
+ /* webpackChunkName: "DCPTIcons" */ 'design-comuni-plone-theme/helpers/IconWidget/IconAliasHelper'
12
+ ),
12
13
  ),
13
14
  ...subsitesLoadables,
14
15
  };
@@ -27,7 +27,7 @@ defineMessages({
27
27
  },
28
28
  rrule_on_the: {
29
29
  id: 'rrule_on the',
30
- defaultMessage: 'di',
30
+ defaultMessage: 'il',
31
31
  },
32
32
  weekdays: {
33
33
  id: 'rrule_weekdays',
@@ -1,47 +0,0 @@
1
- name: Docker build for latest performance test version
2
- on:
3
- push:
4
- branches: [performance]
5
-
6
- jobs:
7
- build_develop:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - uses: actions/checkout@v3
11
-
12
- - name: Set up Docker Buildx
13
- uses: docker/setup-buildx-action@v2
14
-
15
- - name: Login to DockerHub
16
- uses: docker/login-action@v2
17
- with:
18
- username: ${{ secrets.DOCKERHUB_USERNAME }}
19
- password: ${{ secrets.DOCKERHUB_TOKEN }}
20
-
21
- - name: Build and push Docker images
22
- uses: docker/build-push-action@v4
23
- with:
24
- context: .
25
- file: ./dockerfiles/Dockerfile
26
- tags: redturtletech/io-comune-base:perf
27
- pull: true
28
- push: true
29
- cache-from: type=registry,ref=redturtletech/io-comune-base:perf
30
- cache-to: type=inline
31
- build-args: |
32
- ADDON_NAME=design-comuni-plone-theme
33
- ADDON_PATH=design-comuni-plone-theme
34
- VOLTO_VERSION=17.18.2
35
-
36
- - name: Deploy to rancher
37
- uses: redturtle/rancher-deploy-action@v0.2.0
38
- with:
39
- host: ${{ secrets.RANCHER_HOST }}
40
- api-username: ${{ secrets.RANCHER_API_USERNAME }}
41
- api-password: ${{ secrets.RANCHER_API_PASSWORD }}
42
- cluster-id: ${{ secrets.RANCHER_CLUSTER_ID }}
43
- project-id: ${{ secrets.RANCHER_PROJECT_ID }}
44
- namespace: ${{ secrets.RANCHER_NAMESPACE_DEVELOP }}
45
- workload: ${{ secrets.RANCHER_WORKLOAD_PERF }}
46
- image: redturtletech/io-comune-base:perf
47
- slack-hook-url: ${{ secrets.RANCHER_SLACK_HOOK_URL }}
@@ -1,353 +0,0 @@
1
- /**
2
- * View container.
3
- * @module components/theme/View/View
4
- * Customization:
5
- * - added logging of errors
6
- */
7
-
8
- import React, { Component } from 'react';
9
- import PropTypes from 'prop-types';
10
- import { connect } from 'react-redux';
11
- import { compose } from 'redux';
12
- import { Redirect } from 'react-router-dom';
13
- import { Portal } from 'react-portal';
14
- import { injectIntl } from 'react-intl';
15
- import qs from 'query-string';
16
-
17
- import loadable from '@loadable/component';
18
-
19
- import {
20
- ContentMetadataTags,
21
- Comments,
22
- Tags,
23
- Toolbar,
24
- } from '@plone/volto/components';
25
- import { listActions, getContent } from '@plone/volto/actions';
26
- import {
27
- BodyClass,
28
- getBaseUrl,
29
- flattenToAppURL,
30
- getLayoutFieldname,
31
- hasApiExpander,
32
- } from '@plone/volto/helpers';
33
-
34
- import config from '@plone/volto/registry';
35
-
36
- const sentryLibraries = {
37
- Sentry: loadable.lib(
38
- () => import(/* webpackChunkName: "s_entry-browser" */ '@sentry/browser'),
39
- ),
40
- };
41
-
42
- /**
43
- * View container class.
44
- * @class View
45
- * @extends Component
46
- */
47
- class View extends Component {
48
- /**
49
- * Property types.
50
- * @property {Object} propTypes Property types.
51
- * @static
52
- */
53
- static propTypes = {
54
- actions: PropTypes.shape({
55
- object: PropTypes.arrayOf(PropTypes.object),
56
- object_buttons: PropTypes.arrayOf(PropTypes.object),
57
- user: PropTypes.arrayOf(PropTypes.object),
58
- }),
59
- listActions: PropTypes.func.isRequired,
60
- /**
61
- * Action to get the content
62
- */
63
- getContent: PropTypes.func.isRequired,
64
- /**
65
- * Pathname of the object
66
- */
67
- pathname: PropTypes.string.isRequired,
68
- location: PropTypes.shape({
69
- search: PropTypes.string,
70
- pathname: PropTypes.string,
71
- }).isRequired,
72
- /**
73
- * Version id of the object
74
- */
75
- versionId: PropTypes.string,
76
- /**
77
- * Content of the object
78
- */
79
- content: PropTypes.shape({
80
- /**
81
- * Layout of the object
82
- */
83
- layout: PropTypes.string,
84
- /**
85
- * Allow discussion of the object
86
- */
87
- allow_discussion: PropTypes.bool,
88
- /**
89
- * Title of the object
90
- */
91
- title: PropTypes.string,
92
- /**
93
- * Description of the object
94
- */
95
- description: PropTypes.string,
96
- /**
97
- * Type of the object
98
- */
99
- '@type': PropTypes.string,
100
- /**
101
- * Subjects of the object
102
- */
103
- subjects: PropTypes.arrayOf(PropTypes.string),
104
- is_folderish: PropTypes.bool,
105
- }),
106
- error: PropTypes.shape({
107
- /**
108
- * Error type
109
- */
110
- status: PropTypes.number,
111
- }),
112
- };
113
-
114
- /**
115
- * Default properties.
116
- * @property {Object} defaultProps Default properties.
117
- * @static
118
- */
119
- static defaultProps = {
120
- actions: null,
121
- content: null,
122
- versionId: null,
123
- error: null,
124
- };
125
-
126
- state = {
127
- hasObjectButtons: null,
128
- isClient: false,
129
- };
130
-
131
- componentDidMount() {
132
- // Do not trigger the actions action if the expander is present
133
- if (!hasApiExpander('actions', getBaseUrl(this.props.pathname))) {
134
- this.props.listActions(getBaseUrl(this.props.pathname));
135
- }
136
-
137
- this.props.getContent(
138
- getBaseUrl(this.props.pathname),
139
- this.props.versionId,
140
- );
141
- this.setState({ isClient: true });
142
- }
143
-
144
- /**
145
- * Component will receive props
146
- * @method componentWillReceiveProps
147
- * @param {Object} nextProps Next properties
148
- * @returns {undefined}
149
- */
150
- UNSAFE_componentWillReceiveProps(nextProps) {
151
- if (nextProps.pathname !== this.props.pathname) {
152
- // Do not trigger the actions action if the expander is present
153
- if (!hasApiExpander('actions', getBaseUrl(nextProps.pathname))) {
154
- this.props.listActions(getBaseUrl(nextProps.pathname));
155
- }
156
-
157
- this.props.getContent(
158
- getBaseUrl(nextProps.pathname),
159
- this.props.versionId,
160
- );
161
- }
162
-
163
- if (nextProps.actions.object_buttons) {
164
- const objectButtons = nextProps.actions.object_buttons;
165
- this.setState({
166
- hasObjectButtons: !!objectButtons.length,
167
- });
168
- }
169
- }
170
-
171
- /**
172
- * Default fallback view
173
- * @method getViewDefault
174
- * @returns {string} Markup for component.
175
- */
176
- getViewDefault = () => config.views.defaultView;
177
-
178
- /**
179
- * Get view by content type
180
- * @method getViewByType
181
- * @returns {string} Markup for component.
182
- */
183
- getViewByType = () =>
184
- config.views.contentTypesViews[this.props.content['@type']] || null;
185
-
186
- /**
187
- * Get view by content layout property
188
- * @method getViewByLayout
189
- * @returns {string} Markup for component.
190
- */
191
- getViewByLayout = () =>
192
- config.views.layoutViews[
193
- this.props.content[getLayoutFieldname(this.props.content)]
194
- ] || null;
195
-
196
- /**
197
- * Cleans the component displayName (specially for connected components)
198
- * which have the Connect(componentDisplayName)
199
- * @method cleanViewName
200
- * @param {string} dirtyDisplayName The displayName
201
- * @returns {string} Clean displayName (no Connect(...)).
202
- */
203
- cleanViewName = (dirtyDisplayName) =>
204
- dirtyDisplayName
205
- .replace('Connect(', '')
206
- .replace('injectIntl(', '')
207
- .replace(')', '')
208
- .replace('connect(', '')
209
- .toLowerCase();
210
-
211
- // CUSTOMIZATION: added logging of errors
212
- notifySentry = (message) => {
213
- const loaders = Object.entries(sentryLibraries).map(
214
- ([name, Lib]) =>
215
- new Promise((resolve) =>
216
- Lib.load().then((mod) => resolve([name, mod])),
217
- ),
218
- );
219
- Promise.all(loaders).then((libs) => {
220
- const libraries = Object.assign(
221
- {},
222
- ...libs.map(([name, lib]) => ({ [name]: lib })),
223
- );
224
- class MaybeCorsError extends Error {
225
- constructor(...args) {
226
- super(...args);
227
- this.name = 'MaybeCorsError';
228
- }
229
- }
230
- libraries.Sentry.captureException(new MaybeCorsError(message), {
231
- contexts: {
232
- props: {
233
- isAnonymous: !this.props.token,
234
- ...this.props,
235
- },
236
- },
237
- });
238
- });
239
- };
240
-
241
- /**
242
- * Render method.
243
- * @method render
244
- * @returns {string} Markup for the component.
245
- */
246
- render() {
247
- const { views } = config;
248
- if (this.props.error && this.props.error.code === 301) {
249
- const redirect = flattenToAppURL(this.props.error.url).split('?')[0];
250
- return <Redirect to={`${redirect}${this.props.location.search}`} />;
251
- } else if (this.props.error && !this.props.connectionRefused) {
252
- let FoundView;
253
- if (this.props.error.status === undefined) {
254
- // For some reason, while development and if CORS is in place and the
255
- // requested resource is 404, it returns undefined as status, then the
256
- // next statement will fail
257
- // eslint-disable-next-line no-console
258
- console.error(
259
- 'DEV MODE CORS ERROR in View component: ',
260
- JSON.stringify(this.props, null, 2),
261
- );
262
- this.notifySentry('DEV MODE CORS ERROR in View component');
263
- FoundView = views.errorViews.corsError;
264
- } else {
265
- if (this.props.error.status.toString() === 'corsError') {
266
- // eslint-disable-next-line no-console
267
- console.error(
268
- 'CORS ERROR in View component: ',
269
- JSON.stringify(this.props, null, 2),
270
- );
271
- this.notifySentry('CORS ERROR in View component');
272
- }
273
- FoundView = views.errorViews[this.props.error.status.toString()];
274
- }
275
- if (!FoundView) {
276
- FoundView = views.errorViews['404']; // default to 404
277
- }
278
- return (
279
- <div id="view">
280
- <FoundView {...this.props} />
281
- </div>
282
- );
283
- }
284
- if (!this.props.content) {
285
- return <span />;
286
- }
287
- const RenderedView =
288
- this.getViewByLayout() || this.getViewByType() || this.getViewDefault();
289
-
290
- return (
291
- <div id="view">
292
- <ContentMetadataTags content={this.props.content} />
293
- {/* Body class if displayName in component is set */}
294
- <BodyClass
295
- className={
296
- RenderedView.displayName
297
- ? `view-${this.cleanViewName(RenderedView.displayName)}`
298
- : null
299
- }
300
- />
301
- <RenderedView
302
- key={this.props.content['@id']}
303
- content={this.props.content}
304
- location={this.props.location}
305
- token={this.props.token}
306
- history={this.props.history}
307
- />
308
- {config.settings.showTags &&
309
- this.props.content.subjects &&
310
- this.props.content.subjects.length > 0 && (
311
- <Tags tags={this.props.content.subjects} />
312
- )}
313
- {/* Add opt-in social sharing if required, disabled by default */}
314
- {/* In the future this might be parameterized from the app config */}
315
- {/* <SocialSharing
316
- url={typeof window === 'undefined' ? '' : window.location.href}
317
- title={this.props.content.title}
318
- description={this.props.content.description || ''}
319
- /> */}
320
- {this.props.content.allow_discussion && (
321
- <Comments pathname={this.props.pathname} />
322
- )}
323
- {this.state.isClient && (
324
- <Portal node={document.getElementById('toolbar')}>
325
- <Toolbar pathname={this.props.pathname} inner={<span />} />
326
- </Portal>
327
- )}
328
- </div>
329
- );
330
- }
331
- }
332
-
333
- export default compose(
334
- injectIntl,
335
- connect(
336
- (state, props) => ({
337
- actions: state.actions.actions,
338
- token: state.userSession.token,
339
- content: state.content.data,
340
- error: state.content.get.error,
341
- apiError: state.apierror.error,
342
- connectionRefused: state.apierror.connectionRefused,
343
- pathname: props.location.pathname,
344
- versionId:
345
- qs.parse(props.location.search) &&
346
- qs.parse(props.location.search).version,
347
- }),
348
- {
349
- listActions,
350
- getContent,
351
- },
352
- ),
353
- )(View);