Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat: Enhance job filtering and display by adding discovery status handling

Khuram Niazd40c167f8c68
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index c60aa87..2e15380 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -60,11 +60,15 @@ export const getJobsList = async (
? {
jobType: filter,
}
- : {
- Status: {
- value: filter,
- },
- }
+ : filter === "accepted" || filter === "dismissed"
+ ? {
+ discoveryStatus: filter,
+ }
+ : {
+ Status: {
+ value: filter,
+ },
+ }
: {};
const whereClause: any = {
@@ -72,6 +76,16 @@ export const getJobsList = async (
...filterBy,
};
+ // Dismissed discovered jobs are kept only for dedup and shouldn't
+ // clutter the tracked jobs list unless explicitly filtered for.
+ if (filter !== "dismissed") {
+ whereClause.AND = [
+ {
+ OR: [{ discoveryStatus: null }, { discoveryStatus: { not: "dismissed" } }],
+ },
+ ];
+ }
+
if (companyValue) {
whereClause.Company = { value: companyValue };
}
@@ -128,6 +142,7 @@ export const getJobsList = async (
Resume: true,
CoverLetter: true,
matchScore: true,
+ discoveryStatus: true,
_count: { select: { Notes: true } },
},
orderBy: {
diff --git a/src/components/myjobs/JobsContainer.tsx b/src/components/myjobs/JobsContainer.tsx
index 68896cc..939f718 100644
--- a/src/components/myjobs/JobsContainer.tsx
+++ b/src/components/myjobs/JobsContainer.tsx
@@ -92,7 +92,7 @@ function JobsContainer({
const [jobs, setJobs] = useState<JobResponse[]>([]);
const [page, setPage] = useState(1);
const [totalJobs, setTotalJobs] = useState(0);
- const [filterKey, setFilterKey] = useState<string>();
+ const [filterKey, setFilterKey] = useState<string>("none");
const [searchTerm, setSearchTerm] = useState("");
const [editJob, setEditJob] = useState(null);
const [initialLoading, setInitialLoading] = useState(false);
@@ -164,7 +164,7 @@ function JobsContainer({
const { success, data, total, message } = await getJobsList(
page,
jobsPerPage,
- filter,
+ filter && filter !== "none" ? filter : undefined,
search,
companyFilter || undefined,
appliedFilter || undefined,
@@ -198,8 +198,8 @@ function JobsContainer({
const reloadJobs = useCallback(async () => {
await loadJobs(1, undefined, searchTerm || undefined);
- if (filterKey) {
- setFilterKey(undefined);
+ if (filterKey !== "none") {
+ setFilterKey("none");
}
}, [loadJobs, filterKey, searchTerm]);
@@ -311,13 +311,8 @@ function JobsContainer({
]);
const onFilterChange = (filterBy: string) => {
- if (filterBy === "none") {
- setFilterKey(undefined);
- loadJobs(1, undefined, searchTerm || undefined);
- } else {
- setFilterKey(filterBy);
- loadJobs(1, filterBy, searchTerm || undefined);
- }
+ setFilterKey(filterBy);
+ loadJobs(1, filterBy, searchTerm || undefined);
};
const downloadJobsList = async () => {
@@ -429,6 +424,8 @@ function JobsContainer({
<SelectItem value="draft">Draft</SelectItem>
<SelectItem value="rejected">Rejected</SelectItem>
<SelectItem value="PT">Part-time</SelectItem>
+ <SelectItem value="accepted">Accepted (discovered)</SelectItem>
+ <SelectItem value="dismissed">Dismissed (discovered)</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsx
index 0b0d7ee..8dfdb57 100644
--- a/src/components/myjobs/MyJobsTable.tsx
+++ b/src/components/myjobs/MyJobsTable.tsx
@@ -126,7 +126,14 @@ function MyJobsTable({
<span className="block truncate">{job.Location?.label}</span>
</TableCell>
<TableCell>
- {new Date() > job.dueDate && job.Status?.value === "draft" ? (
+ {job.discoveryStatus === "dismissed" ? (
+ <Badge
+ variant="outline"
+ className="w-[70px] justify-center text-muted-foreground"
+ >
+ Dismissed
+ </Badge>
+ ) : new Date() > job.dueDate && job.Status?.value === "draft" ? (
<Badge className="bg-red-500">Expired</Badge>
) : (
<Badge
diff --git a/src/models/job.model.ts b/src/models/job.model.ts
index 366014d..6260d8e 100644
--- a/src/models/job.model.ts
+++ b/src/models/job.model.ts
@@ -53,6 +53,7 @@ export interface JobResponse {
matchData?: string | null;
tags?: Tag[];
createdVia?: string | null;
+ discoveryStatus?: string | null;
_count?: { Notes?: number };
}