From 1793fb1afcb99ea5870b2739d91126ba1ef9ba82 Mon Sep 17 00:00:00 2001 From: Wagner Trezub Date: Thu, 17 Aug 2023 15:15:23 +0200 Subject: [PATCH 1/3] fix: new condition create for type Link --- .../CartellaModulisticaView.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx index 89149b4da..dda797f71 100644 --- a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx +++ b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx @@ -68,21 +68,26 @@ const CartellaModulisticaView = ({ content }) => { ); }; + const filterItemsFN = (item) => { + return ( + item?.title.toLowerCase().indexOf((searchableText ?? '').toLowerCase()) >= + 0 + ); + }; + const filterModulistica = (section) => { if (section['@type'] === 'Document') { if (searchableText?.length > 0) { return (section?.items ?? []).filter(filterDocumento).length > 0; } return true; + } else if (section['@type'] === 'Link') { + return true; } else { return (section?.items ?? []).filter(filterItemsFN)?.length > 0; } }; - const filterItemsFN = (item) => - item?.title.toLowerCase().indexOf((searchableText ?? '').toLowerCase()) >= - 0; - return ( <>
@@ -132,11 +137,7 @@ const CartellaModulisticaView = ({ content }) => {
) : (
- +
); })} From c8b1090491624e39f164d2dc8023c60f0a433cb7 Mon Sep 17 00:00:00 2001 From: Wagner Trezub Date: Thu, 17 Aug 2023 16:03:14 +0200 Subject: [PATCH 2/3] chore: new search --- .../CartellaModulisticaView/CartellaModulisticaView.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx index dda797f71..1454752fd 100644 --- a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx +++ b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx @@ -82,7 +82,11 @@ const CartellaModulisticaView = ({ content }) => { } return true; } else if (section['@type'] === 'Link') { - return true; + return section.title + ? section.title + .toLowerCase() + .indexOf((searchableText ?? '').toLowerCase()) >= 0 + : true; } else { return (section?.items ?? []).filter(filterItemsFN)?.length > 0; } From 5f77adba2bce5c142a151ac8312e9dc6e4e1b939 Mon Sep 17 00:00:00 2001 From: Wagner Trezub Date: Thu, 17 Aug 2023 16:56:45 +0200 Subject: [PATCH 3/3] chore: filterItemsFN function --- .../CartellaModulisticaView/CartellaModulisticaView.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx index 1454752fd..a74b81722 100644 --- a/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx +++ b/src/components/ItaliaTheme/View/CartellaModulisticaView/CartellaModulisticaView.jsx @@ -69,10 +69,11 @@ const CartellaModulisticaView = ({ content }) => { }; const filterItemsFN = (item) => { - return ( - item?.title.toLowerCase().indexOf((searchableText ?? '').toLowerCase()) >= - 0 - ); + return item.title + ? item.title + .toLowerCase() + .indexOf((searchableText ?? '').toLowerCase()) >= 0 + : true; }; const filterModulistica = (section) => {