Fix search input filtering across JobFeeds and ApplicationsTracker with whitespace trimming, multi-attribute matching, and Reset buttons
This commit is contained in:
@@ -48,11 +48,17 @@ export const ApplicationsTracker: React.FC<ApplicationsTrackerProps> = ({
|
|||||||
|
|
||||||
// Filtered applications
|
// Filtered applications
|
||||||
const filteredApps = applications.filter(app => {
|
const filteredApps = applications.filter(app => {
|
||||||
const matchesSearch =
|
const term = searchTerm.toLowerCase().trim();
|
||||||
app.company.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
if (!term && statusFilter === 'ALL' && platformFilter === 'ALL' && !autoOnlyFilter) return true;
|
||||||
app.role.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
||||||
app.location.toLowerCase().includes(searchTerm.toLowerCase());
|
|
||||||
|
|
||||||
|
const companyMatch = (app.company || '').toLowerCase().includes(term);
|
||||||
|
const roleMatch = (app.role || '').toLowerCase().includes(term);
|
||||||
|
const locationMatch = (app.location || '').toLowerCase().includes(term);
|
||||||
|
const platformStrMatch = (app.platform || '').toLowerCase().includes(term);
|
||||||
|
const notesMatch = (app.notes || '').toLowerCase().includes(term);
|
||||||
|
const descMatch = (app.jobDescription || '').toLowerCase().includes(term);
|
||||||
|
|
||||||
|
const matchesSearch = !term || companyMatch || roleMatch || locationMatch || platformStrMatch || notesMatch || descMatch;
|
||||||
const matchesStatus = statusFilter === 'ALL' || app.status === statusFilter;
|
const matchesStatus = statusFilter === 'ALL' || app.status === statusFilter;
|
||||||
const matchesPlatform = platformFilter === 'ALL' || app.platform === platformFilter;
|
const matchesPlatform = platformFilter === 'ALL' || app.platform === platformFilter;
|
||||||
const matchesAuto = !autoOnlyFilter || app.autoApplied === true;
|
const matchesAuto = !autoOnlyFilter || app.autoApplied === true;
|
||||||
@@ -208,6 +214,19 @@ export const ApplicationsTracker: React.FC<ApplicationsTrackerProps> = ({
|
|||||||
<span>Export CSV</span>
|
<span>Export CSV</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{(searchTerm || statusFilter !== 'ALL' || platformFilter !== 'ALL' || autoOnlyFilter) && (
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setSearchTerm('');
|
||||||
|
setStatusFilter('ALL');
|
||||||
|
setPlatformFilter('ALL');
|
||||||
|
setAutoOnlyFilter(false);
|
||||||
|
}}
|
||||||
|
className="px-3 py-2 rounded-xl bg-indigo-950 border border-indigo-500/40 text-indigo-300 text-xs font-semibold hover:bg-indigo-900 transition-all"
|
||||||
|
>
|
||||||
|
Reset Filters
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user