Clear button is working at filter.

This commit is contained in:
Kartik sharma 2025-06-27 16:04:15 +05:30
parent 9396caea57
commit 92ad8485f6

View File

@ -30,7 +30,7 @@ const DirectoryPageHeader = ({
const [allCreators, setAllCreators] = useState([]);
const [allOrganizations, setAllOrganizations] = useState([]);
const [filteredOrganizations, setFilteredOrganizations] = useState([]);
const [selectedCreators, setSelectedCreators] = useState([]); // Corrected to setSelectedCreators
const [selectedCreators, setSelectedCreators] = useState([]);
const [selectedOrgs, setSelectedOrgs] = useState([]);
useEffect(() => {
@ -287,20 +287,16 @@ const DirectoryPageHeader = ({
style={{ width: "200px" }}
/>
{/* Moved the "Filter by" dropdown to be triggered by the funnel icon */}
{/* Filter by funnel icon for Notes view */}
{viewType === "notes" && (
<div className="dropdown" style={{ width: "500px" }}>
<div className="dropdown" style={{ width: "fit-content", minWidth: "400px" }}> {/* Added minWidth here */}
<a
className="dropdown-toggle hide-arrow cursor-pointer d-flex align-items-center position-relative"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i className={`fa-solid fa-filter ms-1 fs-5 ${selectedCreators.length > 0 || selectedOrgs.length > 0 ? "text-primary" : "text-muted"}`}></i>
{(selectedCreators.length > 0 || selectedOrgs.length > 0) && (
<span className="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-warning" style={{ fontSize: "0.4rem" }}>
{selectedCreators.length + selectedOrgs.length}
</span>
)}
{/* Removed the numerical badge for notes filter */}
</a>
<div className="dropdown-menu p-3" style={{ width: "300px", maxHeight: "400px", overflowY: "auto" }}>
@ -343,7 +339,8 @@ const DirectoryPageHeader = ({
setSelectedCreators([]);
setSelectedOrgs([]);
setFilteredOrganizations(allOrganizations);
applyCombinedFilter();
setFilterAppliedNotes(notesForFilter);
}}
>
Clear
@ -378,6 +375,7 @@ const DirectoryPageHeader = ({
</div>
)}
{/* Filter by funnel icon for Contacts view (retains numerical badge) */}
{viewType !== "notes" && (
<div className="dropdown-center" style={{ width: "fit-content" }}>
<a