From 6d3ed5289ae441333ee65843d51a507490cc992c Mon Sep 17 00:00:00 2001 From: Giulia Ghisini <51911425+giuliaghisini@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:29:38 +0100 Subject: [PATCH] feat: enable dynamic footer generation from control panel (#509) * feat: enable dynamic footer generation from control panel * chore: updated release-md * fix: default value for show_in_footer in redurcer --- RELEASE.md | 7 +++++++ src/components/ItaliaTheme/Footer/FooterNavigation.jsx | 7 ++++++- src/customizations/volto/reducers/navigation/navigation.js | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 4915bf07e..f71a4d99c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -53,6 +53,13 @@ - Sistemata la gerarchia per i titoli dentro al blocco semplice + +## Versione x.x.x (xx/xx/xxxx) + +### Novità +- Nel pannello di controllo di 'Design plone' è stata aggiunta la possibilità di mostrare o meno il footer autogenerato. + + ## Versione 11.3.3 (30/01/2024) ### Migliorie diff --git a/src/components/ItaliaTheme/Footer/FooterNavigation.jsx b/src/components/ItaliaTheme/Footer/FooterNavigation.jsx index 6a6b4d81c..f34eb012d 100644 --- a/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +++ b/src/components/ItaliaTheme/Footer/FooterNavigation.jsx @@ -23,6 +23,9 @@ const messages = defineMessages({ const FooterNavigation = () => { const intl = useIntl(); const items = useSelector((state) => state.navigation.items, isEqual); + const show_navigation = useSelector( + (state) => state.navigation.show_in_footer, + ); // DEPRECATED: isFooterCollapsed to be removed in version 12 if (config.settings.isFooterCollapsed) { @@ -32,7 +35,7 @@ const FooterNavigation = () => { ); } - return ( + return show_navigation ? ( <> {items && ( @@ -87,6 +90,8 @@ const FooterNavigation = () => { )} + ) : ( + <> ); }; diff --git a/src/customizations/volto/reducers/navigation/navigation.js b/src/customizations/volto/reducers/navigation/navigation.js index feb1cea99..6f1f8a2ca 100644 --- a/src/customizations/volto/reducers/navigation/navigation.js +++ b/src/customizations/volto/reducers/navigation/navigation.js @@ -23,6 +23,7 @@ import { const initialState = { error: null, items: [], + show_in_footer: false, loaded: false, loading: false, }; @@ -69,6 +70,8 @@ export default function navigation(state = initialState, action = {}) { return { ...state, error: null, + show_in_footer: + action.result['@components'].navigation.show_in_footer, items: getRecursiveItems( action.result['@components'].navigation.items, ), @@ -86,6 +89,8 @@ export default function navigation(state = initialState, action = {}) { return { ...state, error: null, + show_in_footer: + action.result['@components'].navigation.show_in_footer, items: getRecursiveItems(action.result.items), loaded: true, loading: false, @@ -97,6 +102,7 @@ export default function navigation(state = initialState, action = {}) { ...state, error: action.error, items: [], + show_in_footer: false, loaded: false, loading: false, };