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(jobs): make Salary Range optional free text, surface it on job details, widen the preset bands

Khuram Niaz9b99a1ec3999
diff --git a/__tests__/AddJob.spec.tsx b/__tests__/AddJob.spec.tsx
index c0a5052..6acab54 100644
--- a/__tests__/AddJob.spec.tsx
+++ b/__tests__/AddJob.spec.tsx
@@ -187,12 +187,26 @@ describe("AddJob Component", () => {
expect(options.length).toBeGreaterThan(0);
expect(options[0].textContent).toBe("Indeed");
});
- it("should load and show the salary range select list", async () => {
- const salaryRangeSelect = screen.getByLabelText("Salary Range");
- await user.click(salaryRangeSelect);
+ it("should load and show the salary range suggestions", async () => {
+ const salaryRangeCombobox = screen.getByLabelText("Salary Range");
+ await user.click(salaryRangeCombobox);
const options = screen.getAllByRole("option");
expect(options.length).toBeGreaterThan(0);
- expect(options[0].textContent).toBe("0 - 10,000");
+ expect(options[0].textContent).toBe("Under 50,000");
+ expect(options.at(-1)!.textContent).toBe("300,000+");
+ });
+
+ it("should accept a typed salary that is not in the suggestions", async () => {
+ const salaryRangeCombobox = screen.getByLabelText("Salary Range");
+ await user.click(salaryRangeCombobox);
+ const input = screen.getByPlaceholderText("Create or Search Salary Range");
+ await user.type(input, "$185k - $210k{Enter}");
+
+ await waitFor(() =>
+ expect(screen.getByLabelText("Salary Range")).toHaveTextContent(
+ "$185k - $210k",
+ ),
+ );
});
it("should load and show the status select list", async () => {
const statusSelect = screen.getByLabelText("Status");
@@ -259,7 +273,7 @@ describe("AddJob Component", () => {
status: "d7ba200a-6dc1-4ea8-acff-29ebb0d4676a",
dueDate: expect.any(Date),
dateApplied: undefined,
- salaryRange: "1",
+ salaryRange: "",
jobDescription: "<p>New Job Description</p>",
jobUrl: "",
applied: false,
@@ -387,13 +401,13 @@ describe("AddJob Component - Edit Mode", () => {
createdAt: new Date("2024-06-01"),
appliedDate: new Date("2024-06-05"),
dueDate: new Date("2024-06-20"),
- salaryRange: "2",
+ salaryRange: "100,000 - 110,000",
description: "<p>Existing job description</p>",
jobUrl: "https://example.com/job",
applied: true,
} as unknown as JobResponse;
- async function renderEditMode() {
+ async function renderEditMode(overrides: Partial<JobResponse> = {}) {
const mockCompanies = (await getMockList(1, 10, "companies")).data;
const mockJobTitles = (await getMockList(1, 10, "jobTitles")).data;
const mockLocations = (await getMockList(1, 10, "locations")).data;
@@ -406,7 +420,7 @@ describe("AddJob Component - Edit Mode", () => {
locations={mockLocations}
jobSources={mockJobSources}
tags={[]}
- editJob={editJob}
+ editJob={{ ...editJob, ...overrides }}
resetEditJob={mockResetEditJob}
/>,
);
@@ -428,11 +442,22 @@ describe("AddJob Component - Edit Mode", () => {
expect(screen.getByLabelText("Job URL")).toHaveValue(
"https://example.com/job",
);
+ expect(screen.getByLabelText("Salary Range")).toHaveTextContent(
+ "100,000 - 110,000",
+ );
const appliedSwitch = screen.getByRole("switch");
expect(appliedSwitch).toBeChecked();
});
+ it("pre-fills a free-text salary that matches no suggestion", async () => {
+ await renderEditMode({ salaryRange: "$190k – $220k" } as Partial<JobResponse>);
+
+ expect(screen.getByLabelText("Salary Range")).toHaveTextContent(
+ "$190k – $220k",
+ );
+ });
+
it("leaves workplace type unselected when editing a job with no workplaceType", async () => {
await renderEditMode();
diff --git a/__tests__/ComboBox.spec.tsx b/__tests__/ComboBox.spec.tsx
index ba30f9a..275c5e6 100644
--- a/__tests__/ComboBox.spec.tsx
+++ b/__tests__/ComboBox.spec.tsx
@@ -49,11 +49,15 @@ function Harness({
creatable = true,
name = "company",
options = companies,
+ freeText = false,
+ label,
}: {
onChange: (v: string) => void;
creatable?: boolean;
name?: string;
options?: { id: string; value: string; label: string }[];
+ freeText?: boolean;
+ label?: string;
}) {
const form = useForm({ defaultValues: { [name]: "" } });
return (
@@ -73,6 +77,8 @@ function Harness({
},
}}
creatable={creatable}
+ freeText={freeText}
+ label={label}
/>
</FormItem>
)}
@@ -343,3 +349,127 @@ describe("Combobox Enter key", () => {
});
});
});
+
+describe("Combobox freeText", () => {
+ const salaries = [
+ { id: "Under 50,000", value: "Under 50,000", label: "Under 50,000" },
+ {
+ id: "100,000 - 110,000",
+ value: "100,000 - 110,000",
+ label: "100,000 - 110,000",
+ },
+ ];
+
+ it("stores typed text as the value and calls no create action", async () => {
+ const { user, input, onChange } = await openCombobox({
+ name: "salaryRange",
+ options: salaries,
+ freeText: true,
+ });
+
+ await user.type(input, "$120k - $150k CAD{Enter}");
+
+ await waitFor(() =>
+ expect(onChange).toHaveBeenCalledWith("$120k - $150k CAD")
+ );
+ expect(addCompany).not.toHaveBeenCalled();
+ expect(createJobTitle).not.toHaveBeenCalled();
+ expect(createLocation).not.toHaveBeenCalled();
+ expect(createJobSource).not.toHaveBeenCalled();
+ expect(createActivityType).not.toHaveBeenCalled();
+ });
+
+ it("stores the preset text when a suggestion is picked", async () => {
+ const { user, onChange } = await openCombobox({
+ name: "salaryRange",
+ options: salaries,
+ freeText: true,
+ });
+
+ await user.click(screen.getByRole("option", { name: "100,000 - 110,000" }));
+
+ await waitFor(() =>
+ expect(onChange).toHaveBeenCalledWith("100,000 - 110,000")
+ );
+ });
+
+ it("displays a value that matches no option", async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ render(
+ <Harness
+ onChange={onChange}
+ name="salaryRange"
+ options={salaries}
+ freeText
+ />
+ );
+
+ await user.click(screen.getByRole("combobox"));
+ const input = screen.getByPlaceholderText(/Search salaryRange/i);
+ await user.type(input, "$190k - $220k{Enter}");
+
+ await waitFor(() =>
+ expect(screen.getByRole("combobox")).toHaveTextContent("$190k - $220k")
+ );
+ });
+
+ it("trims typed text before storing it", async () => {
+ const { user, input, onChange } = await openCombobox({
+ name: "salaryRange",
+ options: salaries,
+ freeText: true,
+ });
+
+ // CommandEmpty's onClick passes the raw input, unlike the Enter path
+ await user.type(input, " Negotiable ");
+ await user.click(screen.getByText("Negotiable", { selector: "p" }));
+
+ await waitFor(() => expect(onChange).toHaveBeenCalledWith("Negotiable"));
+ });
+
+ it("still renders blank for an unknown value without freeText", async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ render(<Harness onChange={onChange} options={companies} />);
+
+ await user.click(screen.getByRole("combobox"));
+ const input = screen.getByPlaceholderText(/Search company/i);
+ await user.type(input, "Zebra{Enter}");
+
+ // options.unshift doesn't survive the re-render, so the created entry has
+ // no label to find — the trigger must stay blank, never show the raw id.
+ await waitFor(() => expect(onChange).toHaveBeenCalledWith("new-id"));
+ expect(screen.getByRole("combobox")).not.toHaveTextContent("new-id");
+ });
+});
+
+describe("Combobox label", () => {
+ it("uses the label prop in both placeholders", async () => {
+ const user = userEvent.setup();
+ render(
+ <Harness onChange={vi.fn()} name="salaryRange" label="Salary Range" />
+ );
+
+ const trigger = screen.getByRole("combobox");
+ expect(trigger).toHaveTextContent("Select Salary Range");
+
+ await user.click(trigger);
+ expect(
+ screen.getByPlaceholderText("Create or Search Salary Range")
+ ).toBeInTheDocument();
+ });
+
+ it("falls back to the field name when no label is given", async () => {
+ const user = userEvent.setup();
+ render(<Harness onChange={vi.fn()} />);
+
+ const trigger = screen.getByRole("combobox");
+ expect(trigger).toHaveTextContent("Select company");
+
+ await user.click(trigger);
+ expect(
+ screen.getByPlaceholderText("Create or Search company")
+ ).toBeInTheDocument();
+ });
+});
diff --git a/__tests__/JobDetails.spec.tsx b/__tests__/JobDetails.spec.tsx
index 2df4cf5..f4837e7 100644
--- a/__tests__/JobDetails.spec.tsx
+++ b/__tests__/JobDetails.spec.tsx
@@ -79,7 +79,7 @@ const makeJob = (overrides: Partial<JobResponse> = {}): JobResponse => ({
createdAt: new Date("2025-01-01"),
appliedDate: new Date("2025-01-15"),
dueDate: new Date("2099-12-31"), // far future — not expired
- salaryRange: "3",
+ salaryRange: "100,000 - 110,000",
description: "<p>Job description</p>",
jobUrl: "",
applied: true,
@@ -145,6 +145,31 @@ describe("JobDetails – skill badges", () => {
});
});
+describe("JobDetails – salary range", () => {
+ it("renders the salary range in the header line", () => {
+ render(<JobDetails {...baseProps} job={makeJob()} />);
+
+ expect(screen.getByText(/100,000 - 110,000/)).toBeInTheDocument();
+ });
+
+ it("renders a free-text salary verbatim", () => {
+ render(
+ <JobDetails {...baseProps} job={makeJob({ salaryRange: "$190k – $220k" })} />
+ );
+
+ expect(screen.getByText(/\$190k – \$220k/)).toBeInTheDocument();
+ });
+
+ it("renders no salary segment when the job has none", () => {
+ const { container } = render(
+ <JobDetails {...baseProps} job={makeJob({ salaryRange: null })} />
+ );
+
+ expect(container.textContent).not.toContain("100,000 - 110,000");
+ expect(screen.getByText("Frontend Developer")).toBeInTheDocument();
+ });
+});
+
describe("JobDetails – match data display", () => {
beforeEach(() => {
vi.clearAllMocks();
diff --git a/e2e/add-job.spec.ts b/e2e/add-job.spec.ts
index 64696c6..ecc2b7d 100644
--- a/e2e/add-job.spec.ts
+++ b/e2e/add-job.spec.ts
@@ -104,17 +104,22 @@ test.describe("Add New Job", () => {
);
});
- test("should persist selected salary range after saving", async ({
+ test("should persist a typed salary range after saving", async ({
page,
cleanup,
}) => {
const jobText = uniqueName("developer test title salary");
+ const salary = "$185k - $210k";
await createNewJob(page, jobText, cleanup, {
beforeSave: async (page) => {
- await page.getByLabel("Select Salary Range").click();
- await page
- .getByRole("option", { name: "40,000 - 50,000", exact: true })
- .click();
+ await page.getByLabel("Salary Range").click();
+ const input = page.getByPlaceholder("Create or Search Salary Range");
+ await input.fill(salary);
+ // Same target as the shared selectOrCreate helper: CommandEmpty splits
+ // "Create: " and the typed text across two <p>s, so match the wrapper
+ // by text rather than by an option role it does not have.
+ await page.getByText(`Create: ${salary}`).click();
+ await expect(input).not.toBeVisible({ timeout: 15000 });
},
});
await expect(page.getByRole("row", { name: jobText }).first()).toBeVisible();
@@ -125,9 +130,7 @@ test.describe("Add New Job", () => {
.first()
.click();
await page.getByRole("menuitem", { name: "Edit Job" }).click();
- await expect(page.getByLabel("Select Salary Range")).toContainText(
- "40,000 - 50,000",
- );
+ await expect(page.getByLabel("Salary Range")).toContainText(salary);
});
test("should persist selected workplace type after saving", async ({
diff --git a/src/actions/job/mutations.ts b/src/actions/job/mutations.ts
index 00d7d26..3bf6ded 100644
--- a/src/actions/job/mutations.ts
+++ b/src/actions/job/mutations.ts
@@ -38,7 +38,7 @@ export const addJob = async (
locationId: location,
statusId: status,
jobSourceId: source,
- salaryRange,
+ salaryRange: salaryRange || null,
dueDate,
appliedDate: dateApplied,
description: jobDescription,
@@ -101,7 +101,7 @@ export const updateJob = async (
locationId: location,
statusId: status,
jobSourceId: source,
- salaryRange: salaryRange,
+ salaryRange: salaryRange || null,
createdAt: new Date(),
dueDate: dueDate,
appliedDate: dateApplied,
diff --git a/src/actions/mock.actions.ts b/src/actions/mock.actions.ts
index 5a5eeca..03e014d 100644
--- a/src/actions/mock.actions.ts
+++ b/src/actions/mock.actions.ts
@@ -542,7 +542,7 @@ export const generateMockJobsAction = async (): Promise<any> => {
const description =
mockJobDescriptions[getRandomInt(0, mockJobDescriptions.length - 1)];
const salaryRange =
- SALARY_RANGES[getRandomInt(0, SALARY_RANGES.length - 1)].id;
+ SALARY_RANGES[getRandomInt(0, SALARY_RANGES.length - 1)].value;
const dueDate = subDays(now, daysAgo - getRandomInt(7, 21));
const jobType = mockJobTypes[getRandomInt(0, mockJobTypes.length - 1)];
const workplaceType =
diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsx
index 825685d..4f4787f 100644
--- a/src/components/ComboBox.tsx
+++ b/src/components/ComboBox.tsx
@@ -33,9 +33,19 @@ interface ComboboxProps {
options: any[];
field: ControllerRenderProps<any, any>;
creatable?: boolean;
+ freeText?: boolean;
+ label?: string;
}
-export function Combobox({ options, field, creatable }: ComboboxProps) {
+export function Combobox({
+ options,
+ field,
+ creatable,
+ freeText,
+ label,
+}: ComboboxProps) {
+ // Placeholder text only; the accessible name comes from FormLabel/FormControl
+ const displayName = label ?? field.name;
const [newOption, setNewOption] = useState<string>("");
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false);
@@ -61,6 +71,14 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
};
const onCreateOption = (label: string) => {
if (!label) return;
+ // A free-text field has no reference record behind it — the typed text is
+ // itself the stored value, so there is nothing to create server-side.
+ if (freeText) {
+ // CommandEmpty's onClick passes the raw input; only Enter pre-trims
+ field.onChange(label.trim());
+ setIsPopoverOpen(false);
+ return;
+ }
startTransition(async () => {
let response;
switch (field.name) {
@@ -113,8 +131,9 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
>
<span className="min-w-0 truncate">
{field.value
- ? options.find((option) => option.id === field.value)?.label
- : `Select ${field.name}`}
+ ? (options.find((option) => option.id === field.value)?.label ??
+ (freeText ? field.value : null))
+ : `Select ${displayName}`}
</span>
{isPending ? (
@@ -134,7 +153,7 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
<CommandInput
value={newOption}
onValueChange={(val: string) => setNewOption(val)}
- placeholder={`${creatable ? "Create or " : ""}Search ${field.name}`}
+ placeholder={`${creatable ? "Create or " : ""}Search ${displayName}`}
onKeyDown={(e) => handleEnterKey(e)}
/>
<CommandList>
diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsx
index cde4183..a6f5704 100644
--- a/src/components/myjobs/AddJob.tsx
+++ b/src/components/myjobs/AddJob.tsx
@@ -120,7 +120,7 @@ export function AddJob({
workplaceType: "ONSITE",
dueDate: addDays(new Date(), 3),
status: jobStatuses[0]?.id,
- salaryRange: "1",
+ salaryRange: "",
jobUrl: "",
jobDescription: "N/A",
location: locations.find((l) => l.id === lastLocationId)?.id,
@@ -171,7 +171,7 @@ export function AddJob({
source: editJob.JobSource?.id,
status: editJob.Status.id,
dueDate: editJob.dueDate,
- salaryRange: editJob.salaryRange,
+ salaryRange: editJob.salaryRange ?? "",
jobDescription: editJob.description,
applied: editJob.applied,
jobUrl: editJob.jobUrl ?? "",
@@ -547,13 +547,13 @@ export function AddJob({
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>Salary Range</FormLabel>
- <FormControl>
- <SelectFormCtrl
- label="Salary Range"
- options={SALARY_RANGES}
- field={field}
- />
- </FormControl>
+ <Combobox
+ options={SALARY_RANGES}
+ field={field}
+ creatable
+ freeText
+ label="Salary Range"
+ />
<FormMessage />
</FormItem>
)}
diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsx
index 13441cc..1208652 100644
--- a/src/components/myjobs/JobDetails.tsx
+++ b/src/components/myjobs/JobDetails.tsx
@@ -290,6 +290,7 @@ function JobDetails({
{job?.Location?.label && `${job.Location.label} - `}
{getJobType(job?.jobType)}
{job?.workplaceType && ` · ${getWorkplaceTypeLabel(job.workplaceType)}`}
+ {job?.salaryRange && ` · ${job.salaryRange}`}
</CardDescription>
</div>
<div className="flex flex-col items-end gap-2">
diff --git a/src/lib/data/salaryRangeData.ts b/src/lib/data/salaryRangeData.ts
index 3fb3900..27f1706 100644
--- a/src/lib/data/salaryRangeData.ts
+++ b/src/lib/data/salaryRangeData.ts
@@ -1,16 +1,12 @@
-export const SALARY_RANGES = [
- { id: "1", value: "0 - 10,000" },
- { id: "2", value: "10,000 - 20,000" },
- { id: "3", value: "20,000 - 30,000" },
- { id: "4", value: "30,000 - 40,000" },
- { id: "5", value: "40,000 - 50,000" },
- { id: "6", value: "50,000 - 60,000" },
- { id: "7", value: "60,000 - 70,000" },
- { id: "8", value: "70,000 - 80,000" },
- { id: "9", value: "80,000 - 90,000" },
- { id: "10", value: "90,000 - 100,000" },
- { id: "11", value: "100,000 - 110,000" },
- { id: "12", value: "120,000 - 130,000" },
- { id: "13", value: "130,000 - 140,000" },
- { id: "14", value: "> 150,000" },
-];
+// 10,000-wide bands: the cmdk filter is a plain includes(), so a typed
+// number lands on a suggestion instead of falling through to "Create:".
+const MID_BANDS = Array.from(
+ { length: 25 },
+ (_, i) => `${50 + i * 10},000 - ${60 + i * 10},000`,
+);
+
+// id === value === label so a picked preset stores its own text through
+// Combobox's normal select path.
+export const SALARY_RANGES = ["Under 50,000", ...MID_BANDS, "300,000+"].map(
+ (range) => ({ id: range, value: range, label: range }),
+);
diff --git a/src/models/addJobForm.schema.ts b/src/models/addJobForm.schema.ts
index 8be1264..3776805 100644
--- a/src/models/addJobForm.schema.ts
+++ b/src/models/addJobForm.schema.ts
@@ -49,7 +49,7 @@ export const AddJobFormSchema = z.object({
*/
//
dateApplied: z.date().optional(),
- salaryRange: z.string(),
+ salaryRange: z.string().optional(),
jobDescription: z
.string({
error: "Job description is required.",
diff --git a/src/models/job.model.ts b/src/models/job.model.ts
index 5e3d580..da89d58 100644
--- a/src/models/job.model.ts
+++ b/src/models/job.model.ts
@@ -11,7 +11,7 @@ export interface JobForm {
status: string;
dueDate: Date;
dateApplied?: Date;
- salaryRange: string;
+ salaryRange?: string;
jobDescription: string;
jobUrl?: string;
applied: boolean;
@@ -43,7 +43,7 @@ export interface JobResponse {
createdAt: Date;
appliedDate: Date;
dueDate: Date;
- salaryRange: string;
+ salaryRange: string | null;
description: string;
jobUrl: string;
applied: boolean;
diff --git a/wiki/getting-started.md b/wiki/getting-started.md
index ce9ce12..305cddf 100644
--- a/wiki/getting-started.md
+++ b/wiki/getting-started.md
@@ -23,7 +23,7 @@ Nothing AI-powered works until a provider *and* a model are both set — resume
## How do I add my first job?
-Click **Jobs** in the sidebar, then the **Add Job** button in the top-right of the Jobs card. Job Title, Company, Job Location and Job Source are the fields you have to fill in yourself. Job Type, Workplace Type, Status, Due Date, Salary Range and Job Description are also required, but the form arrives with them already filled — Due Date three days out and Job Description the placeholder `N/A` — so you can change them but not leave them empty. Job URL, Date Applied, a resume, a cover letter and skills are the genuinely optional ones, and you can add them later.
+Click **Jobs** in the sidebar, then the **Add Job** button in the top-right of the Jobs card. Job Title, Company, Job Location and Job Source are the fields you have to fill in yourself. Job Type, Workplace Type, Status, Due Date and Job Description are also required, but the form arrives with them already filled — Due Date three days out and Job Description the placeholder `N/A` — so you can change them but not leave them empty. Job URL, Salary Range, Date Applied, a resume, a cover letter and skills are the genuinely optional ones, and you can add them later.
There is a faster route once an AI provider is set: click **Chat AI** in the header, paste the full text of a job posting into the chat, and the assistant extracts the details and shows you exactly what it found before anything is saved. Nothing is written until you approve it.
diff --git a/wiki/jobs.md b/wiki/jobs.md
index 74804dc..4161831 100644
--- a/wiki/jobs.md
+++ b/wiki/jobs.md
@@ -15,7 +15,7 @@ stale_after: 2027-08-31
Open **Jobs** in the sidebar and click **Add Job** at the top-right of the Jobs card. Job Title, Company, Job Location and Job Source are the fields you must fill in — each is a combo box that either picks an existing entry or creates a new one as you type, and Location and Source come pre-selected with whatever you used on your last job.
-Job Type, Workplace Type, Status, Due Date, Salary Range and Job Description are required too, but the form opens with them already set — Job Type on its first option, Workplace Type on Onsite, Status on Draft, Due Date three days from today, Salary Range `1` and Job Description the placeholder `N/A`. You can change any of them; you cannot clear them. Genuinely optional are Job URL, the Applied switch, Date Applied, a resume and cover letter to attach, and skills.
+Job Type, Workplace Type, Status, Due Date and Job Description are required too, but the form opens with them already set — Job Type on its first option, Workplace Type on Onsite, Status on Draft, Due Date three days from today and Job Description the placeholder `N/A`. You can change any of them; you cannot clear them. Genuinely optional are Job URL, Salary Range, the Applied switch, Date Applied, a resume and cover letter to attach, and skills. Salary Range is free text: pick one of the 10,000-wide suggestions from `Under 50,000` to `300,000+`, or type your own — `$120k – $150k`, `Negotiable` — and it is saved exactly as typed and shown on the job's details page.
Paste the full posting text into Job Description if you have it. The AI features — resume review, job match and cover letter generation — read that field, and a job saved with only a title and a salary gives them almost nothing to work from.