Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added release log in control panel #69

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--- RELEASE file. La cura di questo file è in carico ai dev.
Qui vanno inserite tutte le novità e bugfix, spiegati in un linguaggio comprensibile anche ai non dev.
Se ci sono delle migliorie/novità per cui è stato aggiunto qualcosa nel manuale, linkarlo come nell'esempio sotto.
-->

<!--- -----------------------------------------------------------------
Esempio:
---------------------------------------------------------------------

## Versione 7.10.9 (12/09/2023)

### Migliorie

- Fissato il layout di stampa per pagine con Accordion

### Novità

- Nuovo blocco "Informazioni" [`Istruzioni`](https://docs.google.com/document/d/1SThuxa_ah0BuNXukWs564kKPfprK41WLQE8Mome-0xg/edit#heading=h.7ty110jumgmd)

### Fix

- il numero di telefono dentro card ufficio adesso è visibile anche senza indirizzo
-->

<!--- -----------------------------------------------------------------
TEMPLATE PER RELEASE
----------------------------------------------------------------------

## Versione X.X.X (dd/mm/yyyy)

### Migliorie

- ...

### Novità

- ...

### Fix

- ...
-->

## Versione X.X.X (dd/mm/yyyy)

### Novità

- Aggiunto RELEASE.md
- Aggiornato piattaforma a Volto 18.4.0
5 changes: 5 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
5 changes: 5 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
5 changes: 5 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
5 changes: 5 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
5 changes: 5 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
7 changes: 6 additions & 1 deletion locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-11-26T09:46:11.558Z\n"
"POT-Creation-Date: 2025-02-03T16:50:25.181Z\n"
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -1272,6 +1272,11 @@ msgstr ""
msgid "cta_linkTitle"
msgstr ""

#. Default: "attivo"
#: components/ReleaseLog/ReleaseLog
msgid "currentActive"
msgstr ""

#. Default: "dal {dateStart} fino a conclusione"
#: components/View/commons/PageHeader/PageHeaderEventDates
msgid "dal {dateStart} fino a conclusione"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@release-it/conventional-changelog": "^9.0.3",
"bootstrap-italia": "2.8.7",
"design-react-kit": "5.0.0-10",
"marked": "9.0.0",
"react-focus-lock": "2.12.1",
"react-highlight-words": "0.20.0",
"react-slick": "0.30.2",
Expand Down
4 changes: 4 additions & 0 deletions src/components/ReleaseLog/ReleaseLog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.release-log h2 {
border-top: 1px solid grey;
font-weight: 600 !important;
}
107 changes: 107 additions & 0 deletions src/components/ReleaseLog/ReleaseLog.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* ReleaseLog component.
* @module components/ReleaseLog/ReleaseLog
*/

import React, { useState, useEffect } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import {
Container,
Nav,
NavItem,
NavLink,
TabContent,
TabPane,
} from 'design-react-kit';
import { Helmet } from '@plone/volto/helpers';
import { marked } from 'marked';

import './ReleaseLog.css';
const messages = defineMessages({
current: {
id: 'currentActive',
defaultMessage: 'attivo',
},
});
const ReleaseLog = () => {
const intl = useIntl();
let ReleaseIoSanita = null;
try {
ReleaseIoSanita = require('io-sanita-theme/../RELEASE.md');
} catch {
console.log("io-sanita-theme/../RELEASE.md doesn't exists");
}

const LOGS_TO_VIEW = [{ name: 'io-Sanita', file: ReleaseIoSanita }];

const [activeTab, toggleTab] = useState(LOGS_TO_VIEW[0].name);
const [logIST, setLogIST] = useState('');

useEffect(() => {
if (ReleaseIoSanita) {
try {
fetch(ReleaseIoSanita)
.then((res) => res.text())
.then((text) => {
setLogIST(marked(text));
});
} catch {
console.log(ReleaseIoSanita + ' not found.');
}
}
}, []);

const viewTab = (tab) => {
if (activeTab !== tab) {
toggleTab(tab);
}
};

return (
<div className="public-ui">
<Helmet title="Release LOG" />
<Helmet>
<meta name="robots" content="noindex" />
</Helmet>
<Container className="px-4 my-4 release-log">
<h1>Lista degli aggiornamenti</h1>
<Nav tabs className="mb-3">
{LOGS_TO_VIEW.filter((log) => log.file != null).map((log) => (
<NavItem key={log.name}>
<NavLink
href="#"
active={activeTab === log.name}
onClick={() => viewTab(log.name)}
>
<span>{log.name}</span>
{activeTab === log.name && (
<span className="visually-hidden">
{intl.formatMessage(messages.current)}
</span>
)}
</NavLink>
</NavItem>
))}
</Nav>

<TabContent activeTab={activeTab}>
{LOGS_TO_VIEW.filter((log) => log.file != null).map((log) => (
<TabPane
tabId={log.name}
className="p-3"
key={log.name + 'tabcontent'}
>
<div
dangerouslySetInnerHTML={{
__html: log.name === 'io-Sanita' ? logIST : <div></div>,
}}
></div>
</TabPane>
))}
</TabContent>
</Container>
</div>
);
};

export default ReleaseLog;
22 changes: 22 additions & 0 deletions src/config/ioSanitaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ import getIoSanitaWidgets from 'io-sanita-theme/config/widgets/widgets';

export const AGGREGATION_PAGE_ARGOMENTO = '/argomento/';
export const AGGREGATION_PAGE_TIPOLOGIA_UTENTE = '/tipologia-utente/';

const ReleaseLog = loadable(() =>
import('io-sanita-theme/components/ReleaseLog/ReleaseLog'),
);

const messages = defineMessages({
search_brdc: {
id: 'search_brdc',
Expand Down Expand Up @@ -138,12 +143,22 @@ export default function applyConfig(config) {
Modulo: faFileDownloadSVG,
Faq: faQuestionSVG,
},
controlpanels: [
...(config.settings.controlpanels ?? []),
{
'@id': '/release-log',
group: 'General',
title: 'Novità ultimi rilasci',
id: 'release-log',
},
],
controlPanelsIcons: {
...config.settings.controlPanelsIcons,
'dropdown-menu-settings': menuSVG,
'secondary-menu-settings': menuAltSVG,
'subsites-settings': navSVG,
'social-settings': shareSVG,
'release-log': logSVG,
},
defaultExcludedFromSearch: {
portalTypes: ['Image', 'File'],
Expand Down Expand Up @@ -300,6 +315,10 @@ export default function applyConfig(config) {
path: ['/login', '/**/login'],
component: LoginAgid,
},
{
path: ['/controlpanel/release-log', '/release-log'],
component: ReleaseLog,
},
{
path: [AGGREGATION_PAGE_ARGOMENTO + ':id'],
component: AggregationPage,
Expand All @@ -320,6 +339,7 @@ export default function applyConfig(config) {
),
AGGREGATION_PAGE_ARGOMENTO,
AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
/\/release-log\/.*$/
///\/argomento\/.*$/,
///\/tipologia-utente\/.*$/,
];
Expand All @@ -328,5 +348,7 @@ export default function applyConfig(config) {
AGGREGATION_PAGE_ARGOMENTO,
AGGREGATION_PAGE_TIPOLOGIA_UTENTE,
];

console.log('super test');
return config;
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8769,6 +8769,7 @@ __metadata:
eslint-plugin-prettier: 5.0.0
eslint-plugin-react: 7.33.2
eslint-plugin-react-hooks: 4.6.0
marked: 9.0.0
postcss-less: 6.0.0
postcss-scss: 4.0.8
prettier: 3.0.3
Expand Down Expand Up @@ -9850,6 +9851,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"
Expand Down