From 4c5a39d842b3bd16a28f571b4cb76e03f22fdbfc Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 17 Jul 2024 12:16:29 +0200 Subject: [PATCH] adding keywords (WIP) --- .../grid-view/src/lib/remix-ui-grid-cell.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx index e6fc748b22..7a2c27e58d 100644 --- a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx +++ b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx @@ -34,14 +34,24 @@ export const RemixUIGridCell = (props: RemixUIGridCellProps) => { const [anyEnabled, setAnyEnabled] = useState(false) const [expand, setExpand] = useState(false) const [pinned, setPinned] = useState(props.pinned) - - useEffect(() => { - setAnyEnabled( + + /*setAnyEnabled( ( props.title.toLowerCase().includes(filterCon.filter.toLowerCase()) || props.searchKeywords?.map((keyword) => keyword.toLowerCase()).join(' ').includes(filterCon.filter.toLowerCase()) || props.tagList?.join(' ').includes(filterCon.filter.toLowerCase()) )) + */ + useEffect(() => { + // if tags are not used + if (!props.tagList || props.tagList.length == 0) setAnyEnabled(true) + // if at least one tag is matching or "no tag" is checked + else if (props.tagList) setAnyEnabled(props.tagList.some((key) => filterCon.keyValueMap[key]?.enabled) || filterCon?.keyValueMap['no tag']?.enabled) + + if (filterCon.filter != '') setAnyEnabled( + anyEnabled && ( + props.title.toLowerCase().includes(filterCon.filter.toLowerCase()) || + props.searchKeywords?.some(searchKeyword => filterCon.filter.includes(searchKeyword)))) }, [filterCon, props.tagList]) /*const listenOnExpand = (key) => {