forked from italia/design-comuni-plone-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: view release logs for io-comune and io-comune addons
- Loading branch information
1 parent
3d5bcc4
commit 22872e8
Showing
8 changed files
with
232 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!--- 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 | ||
### 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 | ||
### Migliorie | ||
- ... | ||
### Novità | ||
- ... [`Istruzioni`](url della documentazione relativa alla novità) | ||
### Fix | ||
- ... | ||
--> | ||
|
||
## Versione x.x.x | ||
|
||
### Novità | ||
|
||
- ciao |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
h2 { | ||
border-top: 1px solid grey; | ||
font-weight: 600 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className="public-ui"> | ||
<Helmet title="Release LOG" /> | ||
<Helmet> | ||
<meta name="robots" content="noindex" /> | ||
</Helmet> | ||
<Container className="px-4 my-4"> | ||
<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> | ||
</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-comune' ? ( | ||
logDCPT | ||
) : log.name == 'io-cittadino' ? ( | ||
logIoCittadino | ||
) : log.name == 'io-prenoto' ? ( | ||
logIoPrenoto | ||
) : ( | ||
<div></div> | ||
), | ||
}} | ||
></div> | ||
</TabPane> | ||
))} | ||
</TabContent> | ||
</Container> | ||
</div> | ||
); | ||
}; | ||
|
||
export default injectLazyLibs(['marked'])(ReleaseLog); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters