diff --git a/RELEASE.md b/RELEASE.md
new file mode 100644
index 000000000..8355a9787
--- /dev/null
+++ b/RELEASE.md
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+## Versione x.x.x
+
+### Novità
+
+- ciao
diff --git a/package.json b/package.json
index 4009ec496..3a9e0e352 100644
--- a/package.json
+++ b/package.json
@@ -117,6 +117,7 @@
"classnames": "^2.3.2",
"design-react-kit": "italia/design-react-kit#fc9b40257ba3cb613141faf217f1f5b806489740",
"htmldiff-js": "1.0.5",
+ "marked": "9.0.0",
"react-dropzone": "11.0.1",
"react-google-recaptcha-v3": "1.7.0",
"react-highlight-words": "0.18.0",
diff --git a/src/components/ReleaseLog/ReleaseLog.css b/src/components/ReleaseLog/ReleaseLog.css
new file mode 100644
index 000000000..4a7f52b22
--- /dev/null
+++ b/src/components/ReleaseLog/ReleaseLog.css
@@ -0,0 +1,4 @@
+h2 {
+ border-top: 1px solid grey;
+ font-weight: 600 !important;
+}
diff --git a/src/components/ReleaseLog/ReleaseLog.jsx b/src/components/ReleaseLog/ReleaseLog.jsx
new file mode 100644
index 000000000..43ce1131e
--- /dev/null
+++ b/src/components/ReleaseLog/ReleaseLog.jsx
@@ -0,0 +1,148 @@
+/**
+ * ReleaseLog component.
+ * @module components/ReleaseLog/ReleaseLog
+ */
+
+import React, { useState, useEffect } from 'react';
+
+import {
+ Container,
+ Nav,
+ NavItem,
+ NavLink,
+ TabContent,
+ TabPane,
+} from 'design-react-kit';
+import { Helmet } from '@plone/volto/helpers';
+import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
+
+import './ReleaseLog.css';
+
+const ReleaseLog = ({ marked }) => {
+ let ReleaseDCPT = null;
+ let ReleaseIoCittadino = null;
+ let ReleaseIoPrenoto = null;
+ try {
+ ReleaseDCPT = require('design-comuni-plone-theme/../RELEASE.md');
+ } catch {
+ console.log("design-comuni-plone-theme/../RELEASE.md doesn't exists");
+ }
+ try {
+ ReleaseIoCittadino = require('@redturtle/volto-io-cittadino/../RELEASE.md');
+ } catch {
+ console.log("@redturtle/volto-io-cittadino/../RELEASE.md doesn't exists");
+ }
+ try {
+ ReleaseIoPrenoto = require('@redturtle/volto-io-prenoto/../RELEASE.md');
+ } catch {
+ console.log("@redturtle/volto-io-prenoto/../RELEASE.md doesn't exists");
+ }
+
+ const LOGS_TO_VIEW = [
+ { name: 'io-comune', file: ReleaseDCPT },
+ {
+ name: 'io-cittadino',
+ file: ReleaseIoCittadino,
+ },
+ { name: 'io-prenoto', file: ReleaseIoPrenoto },
+ ];
+
+ const Markdown = marked.marked;
+ const [activeTab, toggleTab] = useState(LOGS_TO_VIEW[0].name);
+ const [logDCPT, setLogDCPT] = useState('');
+ const [logIoCittadino, setLogIoCittadino] = useState('');
+ const [logIoPrenoto, setLogIoPrenoto] = useState('');
+
+ useEffect(() => {
+ if (ReleaseDCPT) {
+ try {
+ fetch(ReleaseDCPT)
+ .then((res) => res.text())
+ .then((text) => {
+ setLogDCPT(Markdown(text));
+ });
+ } catch {
+ console.log(ReleaseDCPT + ' not found.');
+ }
+ }
+ if (ReleaseIoCittadino) {
+ try {
+ fetch(ReleaseIoCittadino)
+ .then((res) => res.text())
+ .then((text) => {
+ setLogIoCittadino(Markdown(text));
+ });
+ } catch {
+ console.log(ReleaseIoCittadino + ' not found.');
+ }
+ }
+ if (ReleaseIoPrenoto) {
+ try {
+ fetch(ReleaseIoPrenoto)
+ .then((res) => res.text())
+ .then((text) => {
+ setLogIoPrenoto(Markdown(text));
+ });
+ } catch {
+ console.log(ReleaseIoPrenoto + ' not found.');
+ }
+ }
+ }, []);
+
+ const viewTab = (tab) => {
+ if (activeTab !== tab) {
+ toggleTab(tab);
+ }
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+ {LOGS_TO_VIEW.filter((log) => log.file != null).map((log) => (
+
+
+ ),
+ }}
+ >
+
+ ))}
+
+
+
+ );
+};
+
+export default injectLazyLibs(['marked'])(ReleaseLog);
diff --git a/src/config/italiaConfig.js b/src/config/italiaConfig.js
index 50774585d..120638840 100644
--- a/src/config/italiaConfig.js
+++ b/src/config/italiaConfig.js
@@ -1,3 +1,4 @@
+import loadable from '@loadable/component';
import menuSVG from '@plone/volto/icons/menu.svg';
import menuAltSVG from '@plone/volto/icons/menu-alt.svg';
import navSVG from '@plone/volto/icons/nav.svg';
@@ -54,6 +55,7 @@ import faBuildingSVG from 'design-comuni-plone-theme/icons/building.svg';
import faFileDownloadSVG from 'design-comuni-plone-theme/icons/file-download.svg';
import faQuestionSVG from 'design-comuni-plone-theme/icons/question-solid.svg';
import bandoSVG from 'design-comuni-plone-theme/icons/bando.svg';
+import logSVG from 'design-comuni-plone-theme/icons/log.svg';
import applyRichTextConfig from 'design-comuni-plone-theme/config/RichTextEditor/config';
@@ -63,6 +65,10 @@ import { schemaListing } from 'design-comuni-plone-theme/components/ItaliaTheme/
import reducers from 'design-comuni-plone-theme/reducers';
+const ReleaseLog = loadable(() =>
+ import('design-comuni-plone-theme/components/ReleaseLog/ReleaseLog'),
+);
+
export default function applyConfig(voltoConfig) {
let config = applyRichTextConfig(voltoConfig);
@@ -155,6 +161,15 @@ export default function applyConfig(voltoConfig) {
great: 1200,
huge: 1600,
},
+ controlpanels: [
+ ...(config.settings.controlpanels ?? []),
+ {
+ '@id': '/release-log',
+ group: 'Generali',
+ title: 'Novità ultimi rilasci',
+ id: 'release-log',
+ },
+ ],
controlPanelsIcons: {
...config.settings.controlPanelsIcons,
'dropdown-menu-settings': menuSVG,
@@ -163,6 +178,7 @@ export default function applyConfig(voltoConfig) {
'design-plone-settings': contentSVG,
'bandi-settings': bookSVG,
'social-settings': shareSVG,
+ 'release-log': logSVG,
},
defaultBlockType: 'text',
defaultExcludedFromSearch: {
@@ -306,6 +322,7 @@ export default function applyConfig(voltoConfig) {
config.settings.nonContentRoutes = config.settings.nonContentRoutes.filter(
(route) => route !== '/contact-form',
);
+ config.settings.nonContentRoutes.push('/release-log');
/******************************************************************************
* VIEWS
@@ -462,10 +479,9 @@ export default function applyConfig(voltoConfig) {
},
};
// Remove Horizontal Menu variation of TOC Block
- config.blocks.blocksConfig.toc.variations =
- config.blocks.blocksConfig.toc.variations.filter(
- (v) => v.id !== 'horizontalMenu',
- );
+ config.blocks.blocksConfig.toc.variations = config.blocks.blocksConfig.toc.variations.filter(
+ (v) => v.id !== 'horizontalMenu',
+ );
// REDUCERS
config.addonReducers = {
@@ -484,6 +500,14 @@ export default function applyConfig(voltoConfig) {
path: ['/login', '/**/login'],
component: LoginAgid,
},
+ {
+ path: '/controlpanel/release-log',
+ component: ReleaseLog,
+ },
+ {
+ path: '/release-log',
+ component: ReleaseLog,
+ },
];
return config;
diff --git a/src/config/loadables.js b/src/config/loadables.js
index 7ee2213d3..c93944f79 100644
--- a/src/config/loadables.js
+++ b/src/config/loadables.js
@@ -5,5 +5,6 @@ export const loadables = {
reactSlick: loadable.lib(() => import('react-slick')),
rrule: loadable.lib(() => import('rrule')),
htmlDiffLib: loadable.lib(() => import('htmldiff-js')),
+ marked: loadable.lib(() => import('marked')), //read markdown files
...subsitesLoadables,
};
diff --git a/src/icons/log.svg b/src/icons/log.svg
new file mode 100644
index 000000000..f20d03c9e
--- /dev/null
+++ b/src/icons/log.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 45a706429..9b2caade4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4741,6 +4741,7 @@ __metadata:
htmldiff-js: 1.0.5
husky: 8.0.2
lint-staged: 13.0.3
+ marked: 9.0.0
prettier: 2.0.5
react-dropzone: 11.0.1
react-google-recaptcha-v3: 1.7.0
@@ -7942,6 +7943,15 @@ __metadata:
languageName: node
linkType: hard
+"marked@npm:9.0.0":
+ version: 9.0.0
+ resolution: "marked@npm:9.0.0"
+ bin:
+ marked: bin/marked.js
+ checksum: a8e6e7f84f3940259aeb3a2abdd0961cfe1052131a18dfa714fd8d050559f299920bba43c1aa6c4e60293af8da961e3ec96d8f799661fc2c9bcb93598770e942
+ languageName: node
+ linkType: hard
+
"masonry-layout@npm:^4.2.2":
version: 4.2.2
resolution: "masonry-layout@npm:4.2.2"