better filters user experience
This commit is contained in:
@ -84,7 +84,7 @@ function ContactsPage({ allPublishers }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let filtered = allPublishers.filter(publisher =>
|
let filtered = publishers.filter(publisher =>
|
||||||
(publisher.firstName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
(publisher.firstName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
publisher.lastName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
publisher.lastName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
publisher.email.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
publisher.email.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
@ -116,7 +116,7 @@ function ContactsPage({ allPublishers }) {
|
|||||||
}
|
}
|
||||||
setFilteredPublishers(filtered);
|
setFilteredPublishers(filtered);
|
||||||
setPubWithAssignmentsCount(filtered.filter(publisher => publisher.currentMonthAvailabilityHoursCount && publisher.currentMonthAvailabilityHoursCount > 0).length);
|
setPubWithAssignmentsCount(filtered.filter(publisher => publisher.currentMonthAvailabilityHoursCount && publisher.currentMonthAvailabilityHoursCount > 0).length);
|
||||||
}, [searchQuery, publisherType, sortField, sortOrder, allPublishers, hideEmptyFields]);
|
}, [searchQuery, publisherType, sortField, sortOrder, allPublishers, hideEmptyFields, selectedMonth]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isMounted.current) {
|
if (isMounted.current) {
|
||||||
@ -127,8 +127,8 @@ function ContactsPage({ allPublishers }) {
|
|||||||
const response = await axiosInstance.get(`/api/?action=getAllPublishersWithStatistics&date=${filterDate.toISOString()}&noEndDate=false`);
|
const response = await axiosInstance.get(`/api/?action=getAllPublishersWithStatistics&date=${filterDate.toISOString()}&noEndDate=false`);
|
||||||
setPublishers(response.data);
|
setPublishers(response.data);
|
||||||
setFilteredPublishers(response.data);
|
setFilteredPublishers(response.data);
|
||||||
|
|
||||||
setPubWithAssignmentsCount(response.data.filter(publisher => publisher.currentMonthAvailabilityHoursCount && publisher.currentMonthAvailabilityHoursCount > 0).length);
|
setPubWithAssignmentsCount(response.data.filter(publisher => publisher.currentMonthAvailabilityHoursCount && publisher.currentMonthAvailabilityHoursCount > 0).length);
|
||||||
|
setHideEmptyFields({ availability: 'off', assignments: 'off', lastLogin: false, notifiications: false })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch publishers data:', error);
|
console.error('Failed to fetch publishers data:', error);
|
||||||
// Optionally, handle errors more gracefully here
|
// Optionally, handle errors more gracefully here
|
||||||
|
Reference in New Issue
Block a user