diff --git a/apps/potlock/widget/Components/ListSection.jsx b/apps/potlock/widget/Components/ListSection.jsx index 7f113ad7..a954d51f 100644 --- a/apps/potlock/widget/Components/ListSection.jsx +++ b/apps/potlock/widget/Components/ListSection.jsx @@ -1,4 +1,4 @@ -const { ownerId, removeProjectsFromCart, addProjectsToCart, setIsCartModalOpen, tab } = props; +const { ownerId, removeProjectsFromCart, addProjectsToCart, setIsCartModalOpen, tab, nav } = props; const filterList = [ "Newest to Oldest", "Oldest to Newest", @@ -257,14 +257,50 @@ const searchByWordsPots = (projects, searchTerm) => { setDisplayProject([]); setLastNumberOfProject(0); }; +const searchByWordsPot = (projects, searchTerm) => { + let findId = []; + const dataArr = props.items; + let alldata = []; + dataArr.forEach((item) => { + const data = Social.getr(`${item.project_id}/profile`); + alldata.push(data); + if (data) { + if ( + data.description.toLowerCase().includes(searchTerm.toLowerCase()) || + data.name.toLowerCase().includes(searchTerm.toLowerCase()) + ) { + findId.push(item.project_id); + } + } + }); + let projectFilterBySearch = []; + dataArr.forEach((project) => { + const data = Social.getr(`${project.project_id}/profile`); + findId.forEach((id) => { + if (tagSelected.length > 0) { + if (data.category == tagSelected[0]) { + if (project.project_id == id) { + projectFilterBySearch.push(project); + } + } + } else { + if (project.project_id == id) { + projectFilterBySearch.push(project); + } + } + }); + }); + setTotalProjects(projectFilterBySearch); + setDisplayProject([]); + setLastNumberOfProject(0); +}; const searchByWords = (projects, searchTerm) => { let findId = []; const dataArr = props.items; let alldata = []; dataArr.forEach((item) => { const data = Social.getr(`${item.id}/profile`); - console.log("data", data.category); alldata.push(data); if (data) { if ( @@ -275,7 +311,6 @@ const searchByWords = (projects, searchTerm) => { } } }); - let projectFilterBySearch = []; dataArr.forEach((project) => { const data = Social.getr(`${project.id}/profile`); @@ -413,7 +448,7 @@ const OnBottom = styled.div` return ( <> - {tab != "pots" && ( + {tab != "pots" && tab != "pot" && (
Featured projects @@ -446,15 +481,20 @@ return ( )}
- all projects {totalProjects.length} + + all {tab == "pots" ? "pots" : "projects"} {totalProjects.length} + {/* Search bar */} { tab == "pots" ? searchByWordsPots(totalProjects, value) + : tab == "pot" + ? searchByWordsPot(totalProjects, value) : searchByWords(totalProjects, value); setSearchTerm(value); }, @@ -463,7 +503,7 @@ return ( }, }} /> - {tab != "pots" && ( + {tab != "pots" && tab != "pot" && ( Tags: {tagsList.map((tag, key) => ( @@ -493,10 +533,9 @@ return ( ))} )} - ;
{displayProject} diff --git a/apps/potlock/widget/Pots/Projects.jsx b/apps/potlock/widget/Pots/Projects.jsx index c98bca82..2423b5e2 100644 --- a/apps/potlock/widget/Pots/Projects.jsx +++ b/apps/potlock/widget/Pots/Projects.jsx @@ -1,6 +1,5 @@ // get projects const { ownerId, potId, potDetail } = props; - const projects = Near.view(potId, "get_approved_applications", {}); if (!projects) return "Loading..."; diff --git a/apps/potlock/widget/Project/SearchBar.jsx b/apps/potlock/widget/Project/SearchBar.jsx index a03cae63..b6101112 100644 --- a/apps/potlock/widget/Project/SearchBar.jsx +++ b/apps/potlock/widget/Project/SearchBar.jsx @@ -1,5 +1,4 @@ const { projectLength, handleFilterChange, setSearchTerm } = props; - const filterList = [ "Newest to Oldest", "Oldest to Newest", @@ -57,7 +56,7 @@ const FilterIcon = styled.div` const FilterMenu = styled.div` position: absolute; - background: #FFF; + background: #fff; top: 100%; right: 0; padding: 8px; @@ -65,8 +64,9 @@ const FilterMenu = styled.div` flex-direction: column; gap: 8px; border-radius: 6px; - border: 1px solid rgba(41, 41, 41, 0.36); - box-shadow: 0px 12px 20px -4px rgba(123, 123, 123, 0.32), 0px 4px 8px -3px rgba(123, 123, 123, 0.20), 0px 0px 2px 0px rgba(123, 123, 123, 0.36); + border: 1px solid rgba(41, 41, 41, 0.36); + box-shadow: 0px 12px 20px -4px rgba(123, 123, 123, 0.32), + 0px 4px 8px -3px rgba(123, 123, 123, 0.2), 0px 0px 2px 0px rgba(123, 123, 123, 0.36); `; const FilterItem = styled.div` @@ -76,9 +76,9 @@ const FilterItem = styled.div` gap: 12px; white-space: nowrap; &:hover { - background: #dd3345; - color: #FFF; - border-radius: 6px; + background: #dd3345; + color: #fff; + border-radius: 6px; } `; @@ -101,13 +101,10 @@ return ( -
setOpenFilter(!openFilter)} - > +
setOpenFilter(!openFilter)}> Sort