diff options
author | Sunil Shetye | 2025-05-07 11:20:33 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-05-07 11:20:33 +0530 |
commit | ca6360bcf7bdaa4e6518910a74d973e1a9c86cf3 (patch) | |
tree | 7119bd854fe56aa17aa14cb688bb89dd555a9cc8 | |
parent | 3afa9f40ed8607ddc3edebe9b29bf0f6ad2663b4 (diff) | |
download | Common-Interface-Project-ca6360bcf7bdaa4e6518910a74d973e1a9c86cf3.tar.gz Common-Interface-Project-ca6360bcf7bdaa4e6518910a74d973e1a9c86cf3.tar.bz2 Common-Interface-Project-ca6360bcf7bdaa4e6518910a74d973e1a9c86cf3.zip |
add no to the block name to exclude that block name
-rw-r--r-- | blocks/eda-frontend/src/pages/Gallery.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/blocks/eda-frontend/src/pages/Gallery.js b/blocks/eda-frontend/src/pages/Gallery.js index 648f511f..3328029e 100644 --- a/blocks/eda-frontend/src/pages/Gallery.js +++ b/blocks/eda-frontend/src/pages/Gallery.js @@ -226,6 +226,9 @@ const Gallery = () => { return GallerySchSample.filter((sch) => sch.book_id === selectedBookId) })() + const NOBLOCK = /^no./ + const SCE = /^(sce|sci|script)/ + const NOSCE = /^no(sce|sci|script)/ const terms = searchTerm.trim().toLowerCase().split(/\s+/).filter(Boolean) // Then, filter based on the search term (independent from book selection) @@ -236,10 +239,11 @@ const Gallery = () => { return terms.every((st) => sch.lcname.includes(st) || sch.lcdescription.includes(st) || - sch.blocks.includes(st) || + (!NOBLOCK.test(st) && (';' + sch.blocks).includes(';' + st)) || + (NOBLOCK.test(st) && !(';' + sch.blocks + ';').includes(';' + st.substring(2) + ';')) || sch.save_id.startsWith('gallery' + st) || - (/^(sce|sci|script)/.test(st) && sch.has_script) || - (/^no(sce|sci|script)/.test(st) && !sch.has_script) + (SCE.test(st) && sch.has_script) || + (NOSCE.test(st) && !sch.has_script) ) }) |