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(automation): add the watched-boards group and batch add to the wizard picker, plus its spec and wiki entries

Khuram Niaz586e8e02bd28
diff --git a/__tests__/AtsSearchStep.spec.tsx b/__tests__/AtsSearchStep.spec.tsx
new file mode 100644
index 0000000..efb6ed3
--- /dev/null
+++ b/__tests__/AtsSearchStep.spec.tsx
@@ -0,0 +1,139 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { AtsSearchStep } from "@/components/automations/AtsSearchStep";
+import { toastInfo } from "@/lib/toast";
+
+vi.mock("@/actions/atsCompany.actions", () => ({
+ searchAtsCompanies: vi
+ .fn()
+ .mockResolvedValue({ companies: [], hasMore: false }),
+ getAtsCompanyCount: vi.fn().mockResolvedValue(0),
+ resolveAtsBoard: vi.fn(),
+}));
+
+vi.mock("@/actions/company.actions", () => ({
+ getWatchedBoards: vi.fn().mockResolvedValue([
+ { id: "1", name: "Acme", token: "acme", provider: "greenhouse" },
+ { id: "2", name: "Beta", token: "beta", provider: "greenhouse" },
+ { id: "3", name: "Gamma", token: "gamma", provider: "greenhouse" },
+ ]),
+}));
+
+// TargetingFields pulls four entity actions for its chip inputs; all four must
+// be mocked or the module throws at import.
+vi.mock("@/actions/jobtitle.actions", () => ({
+ getAllJobTitles: vi.fn().mockResolvedValue([]),
+ createJobTitle: vi.fn(),
+}));
+
+vi.mock("@/actions/tag.actions", () => ({
+ getAllTags: vi.fn().mockResolvedValue([]),
+ createTag: vi.fn(),
+}));
+
+vi.mock("@/actions/jobLocation.actions", () => ({
+ getAllJobLocations: vi.fn().mockResolvedValue([]),
+}));
+
+vi.mock("@/actions/job.actions", () => ({
+ createLocation: vi.fn(),
+}));
+
+vi.mock("@/lib/toast", () => ({
+ toastInfo: vi.fn(),
+ toastError: vi.fn(),
+ toastSuccess: vi.fn(),
+}));
+
+// Required by Radix UI Popover / Command components
+window.HTMLElement.prototype.scrollIntoView = vi.fn();
+window.HTMLElement.prototype.hasPointerCapture = vi.fn();
+
+document.createRange = () => {
+ const range = new Range();
+ range.getBoundingClientRect = vi.fn().mockReturnValue({
+ bottom: 0,
+ height: 0,
+ left: 0,
+ right: 0,
+ top: 0,
+ width: 0,
+ });
+ range.getClientRects = () => ({
+ item: () => null,
+ length: 0,
+ [Symbol.iterator]: vi.fn(),
+ });
+ return range;
+};
+
+describe("AtsSearchStep batch add", () => {
+ const user = userEvent.setup();
+
+ const openPicker = async (companies: any[] = []) => {
+ const onChange = vi.fn();
+ render(
+ <AtsSearchStep
+ provider="greenhouse"
+ value={{ companies } as any}
+ onChange={onChange}
+ />,
+ );
+ await user.click(screen.getByRole("button", { name: /search companies/i }));
+ return onChange;
+ };
+
+ const clickAddAll = async () => {
+ await user.click(
+ await screen.findByRole("button", { name: /add all watched/i }),
+ );
+ };
+
+ it("adds every watched board in exactly one onChange", async () => {
+ const onChange = await openPicker();
+
+ await clickAddAll();
+
+ expect(onChange).toHaveBeenCalledTimes(1);
+ expect(onChange.mock.calls[0][0].companies).toHaveLength(3);
+ expect(onChange.mock.calls[0][0].companies.map((c: any) => c.token)).toEqual(
+ ["acme", "beta", "gamma"],
+ );
+ });
+
+ it("dedupes against the current selection by token", async () => {
+ const onChange = await openPicker([{ name: "Acme", token: "acme" }]);
+
+ await clickAddAll();
+
+ expect(onChange).toHaveBeenCalledTimes(1);
+ expect(onChange.mock.calls[0][0].companies.map((c: any) => c.token)).toEqual(
+ ["acme", "beta", "gamma"],
+ );
+ });
+
+ it("slices to the remaining slots at the 25 cap", async () => {
+ const existing = Array.from({ length: 24 }, (_, i) => ({
+ name: `C${i}`,
+ token: `c${i}`,
+ }));
+ const onChange = await openPicker(existing);
+
+ await clickAddAll();
+
+ expect(onChange).toHaveBeenCalledTimes(1);
+ expect(onChange.mock.calls[0][0].companies).toHaveLength(25);
+ });
+
+ it("reports how many were skipped at the cap", async () => {
+ const existing = Array.from({ length: 24 }, (_, i) => ({
+ name: `C${i}`,
+ token: `c${i}`,
+ }));
+ await openPicker(existing);
+
+ await clickAddAll();
+
+ expect(toastInfo).toHaveBeenCalledWith(expect.stringMatching(/2 skipped/i));
+ });
+});
diff --git a/src/components/automations/AtsSearchStep.tsx b/src/components/automations/AtsSearchStep.tsx
index 8f41498..ae3060e 100644
--- a/src/components/automations/AtsSearchStep.tsx
+++ b/src/components/automations/AtsSearchStep.tsx
@@ -24,6 +24,20 @@ export function AtsSearchStep({ provider, value, onChange }: AtsSearchStepProps)
onChange({ ...value, companies: [...companies, company] });
};
+ // A loop over addCompany cannot work: it reads `companies` from the render
+ // closure, so N calls all build from the same stale array and append one.
+ // Returns how many boards were dropped at the cap, for the caller's toast.
+ const addManyCompanies = (boards: LeverCompany[]) => {
+ const seen = new Set(companies.map((c) => c.token));
+ const fresh = boards.filter((b) => !seen.has(b.token));
+ const room = APP_CONSTANTS.ATS_MAX_COMPANIES - companies.length;
+ const added = fresh.slice(0, Math.max(room, 0));
+ if (added.length > 0) {
+ onChange({ ...value, companies: [...companies, ...added] });
+ }
+ return fresh.length - added.length;
+ };
+
const removeCompany = (token: string) => {
onChange({
...value,
@@ -37,6 +51,7 @@ export function AtsSearchStep({ provider, value, onChange }: AtsSearchStepProps)
provider={provider}
companies={companies}
onAdd={addCompany}
+ onAddMany={addManyCompanies}
onRemove={removeCompany}
/>
<TargetingFields value={value} onChange={onChange} />
diff --git a/src/components/automations/ats-search-step/CompanyPicker.tsx b/src/components/automations/ats-search-step/CompanyPicker.tsx
index ff98168..a613588 100644
--- a/src/components/automations/ats-search-step/CompanyPicker.tsx
+++ b/src/components/automations/ats-search-step/CompanyPicker.tsx
@@ -21,14 +21,17 @@ import { APP_CONSTANTS } from "@/lib/constants";
import { cn } from "@/lib/utils";
import type { JobBoard, LeverCompany } from "@/models/automation.model";
import { companyBoardUrl } from "@/lib/atsBoardUrl";
+import { toastInfo } from "@/lib/toast";
import { PROVIDER_META } from "./types";
import { useAtsCompanySearch } from "./useAtsCompanySearch";
+import { useWatchedBoards } from "./useWatchedBoards";
import { JobBoardUrlAdd } from "@/components/JobBoardUrlAdd";
interface CompanyPickerProps {
provider: JobBoard;
companies: LeverCompany[];
onAdd: (company: LeverCompany) => void;
+ onAddMany: (boards: LeverCompany[]) => number;
onRemove: (token: string) => void;
}
@@ -36,6 +39,7 @@ export function CompanyPicker({
provider,
companies,
onAdd,
+ onAddMany,
onRemove,
}: CompanyPickerProps) {
const meta = PROVIDER_META[provider] ?? PROVIDER_META.greenhouse;
@@ -52,6 +56,19 @@ export function CompanyPicker({
const atLimit = companies.length >= APP_CONSTANTS.ATS_MAX_COMPANIES;
+ const { watched } = useWatchedBoards(provider, open);
+ const resultTokens = new Set(results.map((r) => r.token));
+ const watchedOnly = watched.filter((w) => !resultTokens.has(w.token));
+
+ const addAllWatched = () => {
+ const skipped = onAddMany(watched);
+ if (skipped > 0) {
+ toastInfo(
+ `Added what fits — ${skipped} skipped at the ${APP_CONSTANTS.ATS_MAX_COMPANIES}-company limit.`,
+ );
+ }
+ };
+
const toggleCompany = (company: LeverCompany) => {
if (companies.some((c) => c.token === company.token)) {
onRemove(company.token);
@@ -107,6 +124,23 @@ export function CompanyPicker({
value={query}
onValueChange={handleQueryChange}
/>
+ {/* Outside the group heading: cmdk marks headings aria-hidden, */}
+ {/* which would hide this button from keyboard and screen readers. */}
+ {watched.length > 0 && (
+ <div className="flex items-center justify-between border-b px-3 py-1.5">
+ <span className="text-xs text-muted-foreground">
+ {watched.length} watched on this board
+ </span>
+ <button
+ type="button"
+ disabled={atLimit}
+ onClick={addAllWatched}
+ className="text-xs text-primary hover:underline disabled:opacity-50"
+ >
+ Add all watched
+ </button>
+ </div>
+ )}
<CommandList onScroll={handleListScroll}>
{isSearching && results.length === 0 && (
<div className="flex items-center gap-2 p-3 text-sm text-muted-foreground">
@@ -119,6 +153,34 @@ export function CompanyPicker({
No matches. Try &quot;Add by URL&quot; below.
</CommandEmpty>
)}
+ {watched.length > 0 && (
+ <CommandGroup heading={`Watched (${watched.length})`}>
+ {watchedOnly.map((c) => {
+ const selected = companies.some(
+ (sel) => sel.token === c.token,
+ );
+ return (
+ <CommandItem
+ key={`watched-${c.token}`}
+ value={`watched-${c.token}`}
+ disabled={!selected && atLimit}
+ onSelect={() => toggleCompany(c)}
+ >
+ <Check
+ className={cn(
+ "h-4 w-4 shrink-0",
+ selected ? "opacity-100" : "opacity-0",
+ )}
+ />
+ <span>{c.name}</span>
+ <span className="ml-2 text-xs text-muted-foreground">
+ {c.token}
+ </span>
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ )}
<CommandGroup>
{results.map((c) => {
const selected = companies.some(
diff --git a/src/components/automations/ats-search-step/useWatchedBoards.ts b/src/components/automations/ats-search-step/useWatchedBoards.ts
new file mode 100644
index 0000000..4a73c74
--- /dev/null
+++ b/src/components/automations/ats-search-step/useWatchedBoards.ts
@@ -0,0 +1,38 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { getWatchedBoards } from "@/actions/company.actions";
+import type { JobBoard, LeverCompany } from "@/models/automation.model";
+
+// Fetches the watched boards for one provider. Mapped to the wizard's
+// { name, token, host? } shape — the id and provider that getWatchedBoards
+// carries for the Library's Browse view are not wizard state.
+export function useWatchedBoards(provider: JobBoard, enabled: boolean) {
+ const [watched, setWatched] = useState<LeverCompany[]>([]);
+ const [loading, setLoading] = useState(false);
+
+ useEffect(() => {
+ if (!enabled) return;
+ let cancelled = false;
+ setLoading(true);
+ getWatchedBoards(provider)
+ .then((boards) => {
+ if (cancelled) return;
+ setWatched(
+ boards.map((b) => ({
+ name: b.name,
+ token: b.token,
+ ...(b.host ? { host: b.host } : {}),
+ })),
+ );
+ })
+ .finally(() => {
+ if (!cancelled) setLoading(false);
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [provider, enabled]);
+
+ return { watched, loading };
+}
diff --git a/wiki/automations.md b/wiki/automations.md
index 359533b..f13b65a 100644
--- a/wiki/automations.md
+++ b/wiki/automations.md
@@ -3,7 +3,7 @@ type: how-to
title: Automations
description: Setting up a scheduled ATS search over company job boards, filling in the filters and resume skills that make it return good matches, and handling the jobs it discovers.
feature: automations
-tags: [automations, job search, scheduled search, greenhouse, lever, ashby, ats, company boards, discovered jobs, match score, keywords, target titles, locations, resume skills, filters]
+tags: [automations, job search, scheduled search, greenhouse, lever, ashby, ats, company boards, watchlist, discovered jobs, match score, keywords, target titles, locations, resume skills, filters]
aliases: [automated job search, job discovery, scheduled job search, job scraper, run a search, discovered jobs]
status: stable
stale_after: 2027-09-30
@@ -32,12 +32,18 @@ Open **Automations** in the sidebar and click **Create Automation**. The wizard
At least one company is required. Everything else has a working default, but defaults alone will not give you good results.
+If you have built a watchlist, the company picker in step 2 shows a **Watched** group at the top listing the companies you watch on that automation's job board, with an **Add all watched** button that selects them in one click. Only companies on the matching board appear — a watchlist spanning all three providers contributes a different subset to each automation.
+
## Which companies can I track, and how many?
Up to **25 companies** per automation. In the Search step, open the company picker and type a name — JobSync searches an indexed directory of known Greenhouse, Lever and Ashby boards for that provider and you tick the ones you want. The count next to the label shows how many of your 25 slots are used.
If a company is not in the directory, add it by hand: paste its board URL (for example `https://boards.greenhouse.io/acme` or `https://jobs.lever.co/acme`) or just its board token into the field below the picker, and press **+**. JobSync resolves it, checks the board really exists, and adds it as a chip. Remove any company with the **×** on its chip.
+You can also build a shortlist ahead of time. Open **Library → Companies**, switch the scope dropdown from **My Companies** to **Greenhouse**, **Lever** or **Ashby** under *Browse boards*, and you get the full directory of boards JobSync knows about for that provider — search it, and click **Watch** on any company you care about. Watched companies collect under the **Watchlist** scope, where each row links straight to the live board so you can check whether it is still posting.
+
+Watching a company adds it to your Library, so a company you already track just gains its board link — JobSync asks you to confirm that first. Unwatching only removes it from the watchlist; the company stays in your Library along with any jobs attached to it.
+
## How do I set up filters so the automation returns good results?
**Fill in the filters. This is the single biggest factor in whether an automation is useful.** A company board can carry hundreds of listings across every department; the filters are what turn that into a short list worth your attention.