From 692896fec531729cd97969f9a4cf953d7e0ef9ef Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 9 Feb 2023 18:09:28 +0000 Subject: [PATCH] fix lint. --- .../Components/Workflow/ComponentModal.tsx | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/CommonUI/src/Components/Workflow/ComponentModal.tsx b/CommonUI/src/Components/Workflow/ComponentModal.tsx index 5e607b6288..aa1b6eea59 100644 --- a/CommonUI/src/Components/Workflow/ComponentModal.tsx +++ b/CommonUI/src/Components/Workflow/ComponentModal.tsx @@ -34,58 +34,56 @@ const ComponentsModal: FunctionComponent = ( const [components, setComponents] = useState>([]); const [categories, setCategories] = useState>([]); - const [componentsToShow, setComponentsToShow] = useState>([]); + const [componentsToShow, setComponentsToShow] = useState>( + [] + ); const [isSearching, setIsSearching] = useState(false); useEffect(() => { - - let initComponents: Array = []; - let initCategories: Array = [ - ...Categories - ]; - + let initComponents: Array = []; + const initCategories: Array = [...Categories]; initComponents = initComponents.concat(Components); - for(const model of Entities){ - initComponents = initComponents.concat(BaseModelComponentFactory.getComponents(new model())); + for (const model of Entities) { + initComponents = initComponents.concat( + BaseModelComponentFactory.getComponents(new model()) + ); initCategories.push({ name: new model().singularName || 'Model', - description: `Interact with ${new model().singularName} in your workflow.`, - icon: new model().icon || IconProp.Database - }) + description: `Interact with ${ + new model().singularName + } in your workflow.`, + icon: new model().icon || IconProp.Database, + }); } - initComponents = initComponents.filter((component: Component) => { return component.componentType === props.componentsType; - }) + }); - setComponents( - initComponents - ); + setComponents(initComponents); - setComponentsToShow([...initComponents]) + setComponentsToShow([...initComponents]); setCategories(initCategories); }, []); useEffect(() => { - - if(!isSearching){ - return; + if (!isSearching) { + return; } if (!search) { - setComponentsToShow( - [...components.filter((component: Component) => { + setComponentsToShow([ + ...components.filter((component: Component) => { return component.componentType === props.componentsType; - })] - ); + }), + ]); } - setComponentsToShow( - [...components.filter((component: Component) => { + setComponentsToShow([ + ...components.filter((component: Component) => { return ( component.componentType === props.componentsType && (component.title @@ -98,8 +96,8 @@ const ComponentsModal: FunctionComponent = ( .toLowerCase() .includes(search.trim().toLowerCase())) ); - })] - ); + }), + ]); }, [search]); return (