File tree Expand file tree Collapse file tree
src/components/UserProfile/TeamsAndProjects Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ const AddProjectPopup = React.memo(props => {
2626 const [ searchText , onInputChange ] = useState ( '' ) ;
2727 const [ allProjects , setAllProjects ] = useState ( props . projects ) ;
2828
29+ const formatText = result =>
30+ result
31+ . toLowerCase ( )
32+ . trim ( )
33+ . replace ( / \s + / g, '' ) ;
34+
2935 useEffect ( ( ) => {
3036 const categoriesProjects = props . projects . map ( item => item . category ) ;
3137 const uniqueCategoriesProjects = Array . from ( new Set ( categoriesProjects ) ) ;
@@ -140,6 +146,7 @@ const AddProjectPopup = React.memo(props => {
140146 searchText = { searchText }
141147 onInputChange = { onInputChange }
142148 isSetUserIsNotSelectedAutoComplete = { isSetUserIsNotSelectedAutoComplete }
149+ formatText = { formatText }
143150 />
144151 < Button
145152 color = { isOpenDropdown ? 'success' : 'primary' }
Original file line number Diff line number Diff line change @@ -39,7 +39,10 @@ const AddProjectsAutoComplete = React.memo(props => {
3939 >
4040 { props . projectsData
4141 . filter ( project => {
42- if ( project . projectName . toLowerCase ( ) . indexOf ( props . searchText . toLowerCase ( ) ) > - 1 ) {
42+ if (
43+ //prettier-ignore
44+ props . formatText ( project . projectName ) . indexOf ( props . formatText ( props . searchText ) ) > - 1
45+ ) {
4346 return project ;
4447 }
4548 } )
@@ -59,7 +62,7 @@ const AddProjectsAutoComplete = React.memo(props => {
5962 ) ) }
6063
6164 { props . projectsData . every (
62- item => item . projectName . toLowerCase ( ) !== props . searchText . toLowerCase ( ) ,
65+ item => props . formatText ( item . projectName ) !== props . formatText ( props . searchText ) ,
6366 ) && (
6467 < div
6568 className = "project-auto-complete"
You can’t perform that action at this time.
0 commit comments