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(company): add watchlist and board-browse scopes to the Companies tab

Khuram Niaz3b3ca5d4c110
diff --git a/__tests__/BoardsTable.spec.tsx b/__tests__/BoardsTable.spec.tsx
new file mode 100644
index 0000000..f6e9ee1
--- /dev/null
+++ b/__tests__/BoardsTable.spec.tsx
@@ -0,0 +1,113 @@
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import BoardsTable from "@/components/admin/BoardsTable";
+import { setCompanyWatched, watchBoardCompany } from "@/actions/company.actions";
+
+vi.mock("@/actions/company.actions", () => ({
+ watchBoardCompany: vi.fn(),
+ setCompanyWatched: vi.fn(),
+}));
+
+describe("BoardsTable", () => {
+ const rows = [
+ { name: "Anthropic", token: "anthropic" },
+ { name: "Ramp", token: "ramp" },
+ ];
+ const user = userEvent.setup();
+
+ const renderTable = (overrides = {}) =>
+ render(
+ <BoardsTable
+ provider="ashby"
+ rows={rows}
+ watchedMap={new Map([["ramp", "company-ramp"]])}
+ onWatched={vi.fn()}
+ onUnwatched={vi.fn()}
+ onNeedsMerge={vi.fn()}
+ {...overrides}
+ />,
+ );
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("marks a row as watched by token, not by name", () => {
+ renderTable();
+ expect(
+ screen.getByRole("button", { name: /watch anthropic/i }),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", { name: /unwatch ramp/i }),
+ ).toBeInTheDocument();
+ });
+
+ it("links each row to its public board", () => {
+ renderTable();
+ const link = screen.getByRole("link", { name: /open anthropic job board/i });
+ expect(link).toHaveAttribute("href", "https://jobs.ashbyhq.com/anthropic");
+ expect(link).toHaveAttribute("rel", "noopener noreferrer");
+ });
+
+ it("marks a row watched optimistically on success", async () => {
+ const onWatched = vi.fn();
+ (watchBoardCompany as any).mockResolvedValue({
+ success: true,
+ data: { companyId: "new-id", merged: false },
+ });
+ renderTable({ onWatched });
+
+ await user.click(screen.getByRole("button", { name: /watch anthropic/i }));
+
+ await waitFor(() =>
+ expect(onWatched).toHaveBeenCalledWith("anthropic", "new-id"),
+ );
+ });
+
+ it("reverts the optimistic mark when the write fails", async () => {
+ const onWatched = vi.fn();
+ const onUnwatched = vi.fn();
+ (watchBoardCompany as any).mockResolvedValue({
+ success: false,
+ message: "boom",
+ });
+ renderTable({ onWatched, onUnwatched });
+
+ await user.click(screen.getByRole("button", { name: /watch anthropic/i }));
+
+ await waitFor(() => expect(onUnwatched).toHaveBeenCalledWith("anthropic"));
+ });
+
+ it("raises the merge prompt instead of writing", async () => {
+ const onNeedsMerge = vi.fn();
+ (watchBoardCompany as any).mockResolvedValue({
+ success: false,
+ needsConfirm: true,
+ existing: { id: "acme-id", label: "Anthropic PBC" },
+ });
+ renderTable({ onNeedsMerge });
+
+ await user.click(screen.getByRole("button", { name: /watch anthropic/i }));
+
+ await waitFor(() =>
+ expect(onNeedsMerge).toHaveBeenCalledWith({
+ provider: "ashby",
+ board: { name: "Anthropic", token: "anthropic" },
+ existing: { id: "acme-id", label: "Anthropic PBC" },
+ }),
+ );
+ });
+
+ it("unwatches in place from the watched cell", async () => {
+ const onUnwatched = vi.fn();
+ (setCompanyWatched as any).mockResolvedValue({ success: true });
+ renderTable({ onUnwatched });
+
+ await user.click(screen.getByRole("button", { name: /unwatch ramp/i }));
+
+ await waitFor(() => {
+ expect(setCompanyWatched).toHaveBeenCalledWith("company-ramp", false);
+ expect(onUnwatched).toHaveBeenCalledWith("ramp");
+ });
+ });
+});
diff --git a/__tests__/CompaniesContainer.spec.tsx b/__tests__/CompaniesContainer.spec.tsx
index 2d21a80..656670d 100644
--- a/__tests__/CompaniesContainer.spec.tsx
+++ b/__tests__/CompaniesContainer.spec.tsx
@@ -2,6 +2,16 @@ import CompaniesContainer from "@/components/admin/CompaniesContainer";
import { screen, render, waitFor, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { getCompanyList, getCompanyById } from "@/actions/company.actions";
+import { searchAtsCompanies } from "@/actions/atsCompany.actions";
+
+const mockPush = vi.fn();
+let mockParams = new URLSearchParams("");
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ push: mockPush }),
+ usePathname: () => "/dashboard/admin",
+ useSearchParams: () => mockParams,
+}));
vi.mock("@/actions/company.actions", () => ({
getCompanyList: vi.fn(),
@@ -9,6 +19,18 @@ vi.mock("@/actions/company.actions", () => ({
deleteCompanyById: vi.fn(),
addCompany: vi.fn(),
updateCompany: vi.fn(),
+ watchBoardCompany: vi.fn(),
+ setCompanyWatched: vi.fn(),
+ getWatchedBoards: vi.fn().mockResolvedValue([]),
+}));
+
+vi.mock("@/actions/atsCompany.actions", () => ({
+ searchAtsCompanies: vi.fn().mockResolvedValue({
+ companies: [{ name: "Anthropic", token: "anthropic" }],
+ hasMore: false,
+ }),
+ getAtsCompanyCount: vi.fn().mockResolvedValue(1860),
+ resolveAtsBoard: vi.fn(),
}));
let intersectionCallback: IntersectionObserverCallback | undefined;
@@ -33,6 +55,7 @@ describe("CompaniesContainer Search Functionality", () => {
vi.clearAllMocks();
vi.useFakeTimers({ shouldAdvanceTime: true });
intersectionCallback = undefined;
+ mockParams = new URLSearchParams("");
});
afterEach(() => {
@@ -131,7 +154,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
await waitFor(() => {
- expect(getCompanyList).toHaveBeenCalledWith(1, 25, "applied", "Amazon");
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 1,
+ 25,
+ "applied",
+ "Amazon",
+ "mine",
+ );
});
});
@@ -152,7 +181,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
expect(getCompanyList).toHaveBeenCalledTimes(1);
- expect(getCompanyList).toHaveBeenCalledWith(1, 25, "applied", undefined);
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 1,
+ 25,
+ "applied",
+ undefined,
+ "mine",
+ );
});
it("should trigger search when clearing search term after searching", async () => {
@@ -177,7 +212,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
await waitFor(() => {
- expect(getCompanyList).toHaveBeenCalledWith(1, 25, "applied", "Amazon");
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 1,
+ 25,
+ "applied",
+ "Amazon",
+ "mine",
+ );
});
await act(async () => {
@@ -193,6 +234,7 @@ describe("CompaniesContainer Search Functionality", () => {
25,
"applied",
undefined,
+ "mine",
);
});
});
@@ -250,7 +292,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
await waitFor(() => {
- expect(getCompanyList).toHaveBeenCalledWith(1, 25, "applied", "Amazon");
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 1,
+ 25,
+ "applied",
+ "Amazon",
+ "mine",
+ );
});
await act(async () => {
@@ -261,7 +309,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
await waitFor(() => {
- expect(getCompanyList).toHaveBeenCalledWith(2, 25, "applied", "Amazon");
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 2,
+ 25,
+ "applied",
+ "Amazon",
+ "mine",
+ );
});
});
});
@@ -289,7 +343,13 @@ describe("CompaniesContainer Search Functionality", () => {
});
await waitFor(() => {
- expect(getCompanyList).toHaveBeenCalledWith(2, 25, "applied", undefined);
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 2,
+ 25,
+ "applied",
+ undefined,
+ "mine",
+ );
expect(screen.getByText("Meta")).toBeInTheDocument();
expect(screen.getByText("Amazon")).toBeInTheDocument();
});
@@ -317,4 +377,34 @@ describe("CompaniesContainer Search Functionality", () => {
expect(getCompanyList).toHaveBeenCalledTimes(1);
});
});
+
+ describe("Scope", () => {
+ it("reads the scope from the URL and browses the seed instead of the database", async () => {
+ mockParams = new URLSearchParams("scope=board:ashby");
+ (getCompanyList as any).mockResolvedValue({ data: [], total: 0 });
+
+ render(<CompaniesContainer />);
+
+ expect(await screen.findByText("Anthropic")).toBeInTheDocument();
+ expect(searchAtsCompanies).toHaveBeenCalledWith("ashby", "", 0);
+ expect(getCompanyList).not.toHaveBeenCalled();
+ });
+
+ it("passes the watchlist scope through to getCompanyList", async () => {
+ mockParams = new URLSearchParams("scope=watchlist");
+ (getCompanyList as any).mockResolvedValue({ data: [], total: 0 });
+
+ render(<CompaniesContainer />);
+
+ await waitFor(() =>
+ expect(getCompanyList).toHaveBeenCalledWith(
+ 1,
+ 25,
+ "applied",
+ undefined,
+ "watchlist",
+ ),
+ );
+ });
+ });
});
diff --git a/src/actions/atsCompany.actions.ts b/src/actions/atsCompany.actions.ts
index c940471..aefa09d 100644
--- a/src/actions/atsCompany.actions.ts
+++ b/src/actions/atsCompany.actions.ts
@@ -21,10 +21,6 @@ type ResolveResult =
| { success: true; name: string; token: string; host?: LeverHost }
| { success: false; message: string };
-// Page size for the company typeahead/browse (infinite scroll loads a page at
-// a time so the popover never mounts the whole 1000+ seed at once).
-const ATS_COMPANY_PAGE_SIZE = 50;
-
// Typeahead over the seeded companies.json (server-side filter, paginated).
// An empty query browses the full list (alphabetical); `offset` drives the
// infinite-scroll load-more. Returns a page plus whether more remain.
@@ -47,7 +43,10 @@ export async function searchAtsCompanies(
c.token.toLowerCase().includes(q),
);
- const companies = matches.slice(offset, offset + ATS_COMPANY_PAGE_SIZE);
+ const companies = matches.slice(
+ offset,
+ offset + APP_CONSTANTS.ATS_COMPANY_PAGE_SIZE,
+ );
return { companies, hasMore: offset + companies.length < matches.length };
}
diff --git a/src/components/automations/ats-search-step/CompanyUrlAdd.tsx b/src/components/JobBoardUrlAdd.tsx
similarity index 91%
rename from src/components/automations/ats-search-step/CompanyUrlAdd.tsx
rename to src/components/JobBoardUrlAdd.tsx
index 0b7e15b..b9f1fbe 100644
--- a/src/components/automations/ats-search-step/CompanyUrlAdd.tsx
+++ b/src/components/JobBoardUrlAdd.tsx
@@ -7,21 +7,21 @@ import { Button } from "@/components/ui/button";
import { resolveAtsBoard } from "@/actions/atsCompany.actions";
import type { JobBoard, LeverCompany } from "@/models/automation.model";
-interface CompanyUrlAddProps {
+interface JobBoardUrlAddProps {
provider: JobBoard;
placeholder: string;
disabled: boolean;
onResolved: (company: LeverCompany) => void;
}
-// Adds a company by pasting its board URL or token, for boards the indexed
-// company search doesn't cover.
-export function CompanyUrlAdd({
+// Adds a board by pasting its ATS board URL or token, for boards the seeded
+// directory doesn't cover.
+export function JobBoardUrlAdd({
provider,
placeholder,
disabled,
onResolved,
-}: CompanyUrlAddProps) {
+}: JobBoardUrlAddProps) {
const [urlInput, setUrlInput] = useState("");
const [isResolving, setIsResolving] = useState(false);
const [urlError, setUrlError] = useState<string | null>(null);
diff --git a/src/components/RecordsCount.tsx b/src/components/RecordsCount.tsx
index 0b92cdf..a32dd92 100644
--- a/src/components/RecordsCount.tsx
+++ b/src/components/RecordsCount.tsx
@@ -2,7 +2,7 @@
type RecordsCountProps = {
count: number;
- total: number;
+ total?: number;
label?: string;
};
@@ -13,12 +13,14 @@ export function RecordsCount({
}: RecordsCountProps) {
return (
<div className="text-xs text-muted-foreground whitespace-nowrap">
- Showing{" "}
- <strong>
- 1 to {count}
- </strong>{" "}
- of
- <strong> {total}</strong> {label}
+ Showing <strong>1 to {count}</strong>
+ {total !== undefined && (
+ <>
+ {" "}
+ of<strong> {total}</strong>
+ </>
+ )}{" "}
+ {label}
</div>
);
}
diff --git a/src/components/admin/BoardsTable.tsx b/src/components/admin/BoardsTable.tsx
new file mode 100644
index 0000000..15a7ca1
--- /dev/null
+++ b/src/components/admin/BoardsTable.tsx
@@ -0,0 +1,153 @@
+"use client";
+
+import { useState } from "react";
+import { Check, ExternalLink } from "lucide-react";
+import { Button } from "../ui/button";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "../ui/table";
+import {
+ setCompanyWatched,
+ watchBoardCompany,
+} from "@/actions/company.actions";
+import { companyBoardUrl } from "@/lib/atsBoardUrl";
+import { toastError, toastSuccess } from "@/lib/toast";
+import { PROVIDER_META } from "@/components/automations/ats-search-step/types";
+import type { JobBoard, LeverCompany } from "@/models/automation.model";
+import type { PendingMerge } from "./WatchMergeDialog";
+
+type BoardsTableProps = {
+ provider: JobBoard;
+ rows: LeverCompany[];
+ watchedMap: Map<string, string>;
+ onWatched: (token: string, companyId: string) => void;
+ onUnwatched: (token: string) => void;
+ onNeedsMerge: (pending: PendingMerge) => void;
+};
+
+function BoardsTable({
+ provider,
+ rows,
+ watchedMap,
+ onWatched,
+ onUnwatched,
+ onNeedsMerge,
+}: BoardsTableProps) {
+ const [busy, setBusy] = useState<string | null>(null);
+
+ const watch = async (row: LeverCompany) => {
+ setBusy(row.token);
+ // Optimistic: the id is unknown until the write returns, so a placeholder
+ // holds the cell in its watched state and is replaced on success.
+ onWatched(row.token, "");
+ const res = await watchBoardCompany(provider, row);
+ setBusy(null);
+
+ if (res.success) {
+ onWatched(row.token, res.data.companyId);
+ toastSuccess(`${row.name} added to your watchlist`);
+ return;
+ }
+ onUnwatched(row.token);
+ if ("needsConfirm" in res) {
+ onNeedsMerge({ provider, board: row, existing: res.existing });
+ return;
+ }
+ toastError(res.message);
+ };
+
+ const unwatch = async (row: LeverCompany) => {
+ const companyId = watchedMap.get(row.token);
+ if (!companyId) return;
+ setBusy(row.token);
+ onUnwatched(row.token);
+ const res = await setCompanyWatched(companyId, false);
+ setBusy(null);
+
+ if (res.success) {
+ toastSuccess(`${row.name} removed from your watchlist`);
+ } else {
+ onWatched(row.token, companyId);
+ toastError(res.message);
+ }
+ };
+
+ return (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Name</TableHead>
+ <TableHead className="hidden sm:table-cell">Token</TableHead>
+ <TableHead className="hidden sm:table-cell">Provider</TableHead>
+ <TableHead>
+ <span className="sr-only">Board link</span>
+ </TableHead>
+ <TableHead className="text-right">Watch</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {rows.map((row) => {
+ const watched = watchedMap.has(row.token);
+ return (
+ <TableRow key={row.token}>
+ <TableCell className="font-medium">{row.name}</TableCell>
+ <TableCell className="hidden sm:table-cell text-muted-foreground">
+ {row.token}
+ </TableCell>
+ <TableCell className="hidden sm:table-cell text-muted-foreground">
+ {PROVIDER_META[provider].label}
+ </TableCell>
+ <TableCell>
+ <a
+ href={companyBoardUrl(provider, row)}
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label={`Open ${row.name} job board`}
+ title="Open job board"
+ className="text-muted-foreground hover:text-foreground"
+ >
+ <ExternalLink className="h-3.5 w-3.5" />
+ </a>
+ </TableCell>
+ <TableCell className="text-right">
+ {watched ? (
+ <Button
+ type="button"
+ size="sm"
+ variant="ghost"
+ disabled={busy === row.token}
+ aria-label={`Unwatch ${row.name}`}
+ onClick={() => unwatch(row)}
+ className="group text-emerald-600 dark:text-emerald-400"
+ >
+ <Check className="h-3.5 w-3.5 group-hover:hidden" />
+ <span className="group-hover:hidden">Watching</span>
+ <span className="hidden group-hover:inline">Unwatch</span>
+ </Button>
+ ) : (
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ disabled={busy === row.token}
+ aria-label={`Watch ${row.name}`}
+ onClick={() => watch(row)}
+ >
+ Watch
+ </Button>
+ )}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ );
+}
+
+export default BoardsTable;
diff --git a/src/components/admin/CompaniesContainer.tsx b/src/components/admin/CompaniesContainer.tsx
index 60a8b63..862fcac 100644
--- a/src/components/admin/CompaniesContainer.tsx
+++ b/src/components/admin/CompaniesContainer.tsx
@@ -1,86 +1,39 @@
"use client";
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useCallback, useState } from "react";
+import { Loader } from "lucide-react";
import AddCompany from "./AddCompany";
+import BoardsTable from "./BoardsTable";
import CompaniesTable from "./CompaniesTable";
+import { WatchMergeDialog, type PendingMerge } from "./WatchMergeDialog";
import { Card, CardContent, CardTitle } from "../ui/card";
import { ResponsiveCardHeader } from "../ResponsiveCardHeader";
-import { Company } from "@/models/job.model";
-import { getCompanyById, getCompanyList } from "@/actions/company.actions";
-import { APP_CONSTANTS } from "@/lib/constants";
import Loading from "../Loading";
-import { Loader } from "lucide-react";
import { RecordsCount } from "../RecordsCount";
import { SearchInput } from "../SearchInput";
-import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { JobBoardUrlAdd } from "../JobBoardUrlAdd";
+import { getCompanyById, watchBoardCompany } from "@/actions/company.actions";
+import { toastError, toastSuccess } from "@/lib/toast";
+import { PROVIDER_META } from "@/components/automations/ats-search-step/types";
+import { CompaniesScopeSelect } from "./companies-container/CompaniesScopeSelect";
+import { useBoardsBrowse } from "./companies-container/useBoardsBrowse";
+import { useCompaniesList } from "./companies-container/useCompaniesList";
+import {
+ boardProvider,
+ useCompanyScope,
+} from "./companies-container/useCompanyScope";
+import type { LeverCompany } from "@/models/automation.model";
function CompaniesContainer() {
- const [companies, setCompanies] = useState<Company[]>([]);
- const [totalCompanies, setTotalCompanies] = useState<number>(0);
- const [page, setPage] = useState<number>(1);
+ const { scope, setScope } = useCompanyScope();
+ const provider = boardProvider(scope);
+ const [searchTerm, setSearchTerm] = useState("");
const [dialogOpen, setDialogOpen] = useState(false);
const [editCompany, setEditCompany] = useState(null);
- const [initialLoading, setInitialLoading] = useState<boolean>(false);
- const [loadingMore, setLoadingMore] = useState<boolean>(false);
- const [searchTerm, setSearchTerm] = useState("");
- const hasSearched = useRef(false);
- const requestIdRef = useRef(0);
- const loadCompanies = useCallback(
- async (page: number, search?: string) => {
- const requestId = ++requestIdRef.current;
- if (page === 1) setInitialLoading(true);
- else setLoadingMore(true);
- const { data, total } = await getCompanyList(
- page,
- APP_CONSTANTS.RECORDS_PER_PAGE,
- "applied",
- search
- );
- if (requestId !== requestIdRef.current) return;
- if (data) {
- setCompanies((prev) => (page === 1 ? data : [...prev, ...data]));
- setTotalCompanies(total);
- setPage(page);
- }
- setInitialLoading(false);
- setLoadingMore(false);
- },
- []
- );
-
- const reloadCompanies = useCallback(async () => {
- await loadCompanies(1, searchTerm || undefined);
- }, [loadCompanies, searchTerm]);
-
- const resetEditCompany = () => {
- setEditCompany(null);
- };
-
- useEffect(() => {
- (async () => await loadCompanies(1))();
- }, [loadCompanies]);
-
- useEffect(() => {
- if (searchTerm !== "") {
- hasSearched.current = true;
- }
- if (searchTerm === "" && !hasSearched.current) return;
+ const [pendingMerge, setPendingMerge] = useState<PendingMerge | null>(null);
- const timer = setTimeout(() => {
- loadCompanies(1, searchTerm || undefined);
- }, 300);
- return () => clearTimeout(timer);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [searchTerm]);
-
- const hasMoreCompanies = companies.length < totalCompanies;
- const sentinelRef = useInfiniteScroll(
- hasMoreCompanies,
- initialLoading || loadingMore,
- useCallback(
- () => loadCompanies(page + 1, searchTerm || undefined),
- [loadCompanies, page, searchTerm]
- )
- );
+ const listScope = scope === "watchlist" ? "watchlist" : "mine";
+ const list = useCompaniesList(listScope, searchTerm, !provider);
+ const browse = useBoardsBrowse(provider, searchTerm);
const onEditCompany = async (companyId: string) => {
const company = await getCompanyById(companyId);
@@ -88,6 +41,42 @@ function CompaniesContainer() {
setDialogOpen(true);
};
+ const onUrlResolved = useCallback(
+ async (company: LeverCompany) => {
+ if (!provider) return;
+ const res = await watchBoardCompany(provider, company);
+ if (res.success) {
+ browse.markWatched(company.token, res.data.companyId);
+ toastSuccess(`${company.name} added to your watchlist`);
+ } else if ("needsConfirm" in res) {
+ setPendingMerge({ provider, board: company, existing: res.existing });
+ } else {
+ toastError(res.message);
+ }
+ },
+ [browse, provider],
+ );
+
+ const confirmMerge = async () => {
+ if (!pendingMerge) return;
+ const { provider: p, board } = pendingMerge;
+ const res = await watchBoardCompany(p, board, { confirmMerge: true });
+ setPendingMerge(null);
+ if (res.success) {
+ browse.markWatched(board.token, res.data.companyId);
+ toastSuccess(`${board.name} linked and added to your watchlist`);
+ } else if (!("needsConfirm" in res)) {
+ toastError(res.message);
+ }
+ };
+
+ const loading = provider ? browse.initialLoading : list.initialLoading;
+ const loadingMore = provider ? browse.loadingMore : list.loadingMore;
+ const hasMore = provider ? browse.hasMore : list.hasMore;
+ const sentinelRef = provider ? browse.sentinelRef : list.sentinelRef;
+ const shownCount = provider ? browse.rows.length : list.companies.length;
+ const shownTotal = provider ? browse.total : list.total;
+
return (
<>
<div className="col-span-3">
@@ -95,11 +84,16 @@ function CompaniesContainer() {
<ResponsiveCardHeader>
<div className="flex items-baseline gap-2">
<CardTitle>Companies</CardTitle>
- {!initialLoading && totalCompanies > 0 && (
- <RecordsCount count={companies.length} total={totalCompanies} label="companies" />
+ {!loading && shownCount > 0 && (
+ <RecordsCount
+ count={shownCount}
+ total={shownTotal}
+ label="companies"
+ />
)}
</div>
<div className="flex flex-wrap items-center justify-end gap-2 sm:ml-auto">
+ <CompaniesScopeSelect scope={scope} onScopeChange={setScope} />
<SearchInput
value={searchTerm}
onChange={setSearchTerm}
@@ -107,25 +101,45 @@ function CompaniesContainer() {
/>
<AddCompany
editCompany={editCompany}
- reloadCompanies={reloadCompanies}
- resetEditCompany={resetEditCompany}
+ reloadCompanies={list.reload}
+ resetEditCompany={() => setEditCompany(null)}
dialogOpen={dialogOpen}
setDialogOpen={setDialogOpen}
/>
</div>
</ResponsiveCardHeader>
<CardContent>
- {initialLoading && <Loading />}
- {companies.length > 0 && (
- <>
- <CompaniesTable
- companies={companies}
- reloadCompanies={reloadCompanies}
- editCompany={onEditCompany}
+ {provider && (
+ <div className="mb-4">
+ <JobBoardUrlAdd
+ provider={provider}
+ placeholder={PROVIDER_META[provider].urlHint}
+ disabled={false}
+ onResolved={onUrlResolved}
/>
- </>
+ </div>
)}
- {hasMoreCompanies && (
+ {loading && <Loading />}
+ {provider
+ ? browse.rows.length > 0 && (
+ <BoardsTable
+ provider={provider}
+ rows={browse.rows}
+ watchedMap={browse.watchedMap}
+ onWatched={browse.markWatched}
+ onUnwatched={browse.unmarkWatched}
+ onNeedsMerge={setPendingMerge}
+ />
+ )
+ : list.companies.length > 0 && (
+ <CompaniesTable
+ companies={list.companies}
+ reloadCompanies={list.reload}
+ editCompany={onEditCompany}
+ scope={listScope}
+ />
+ )}
+ {hasMore && (
<div ref={sentinelRef} className="flex justify-center p-4">
{loadingMore && (
<Loader className="h-5 w-5 animate-spin text-blue-500" />
@@ -135,6 +149,11 @@ function CompaniesContainer() {
</CardContent>
</Card>
</div>
+ <WatchMergeDialog
+ pending={pendingMerge}
+ onConfirm={confirmMerge}
+ onCancel={() => setPendingMerge(null)}
+ />
</>
);
}
diff --git a/src/components/admin/CompaniesTable.tsx b/src/components/admin/CompaniesTable.tsx
index c8e9c32..4987c1a 100644
--- a/src/components/admin/CompaniesTable.tsx
+++ b/src/components/admin/CompaniesTable.tsx
@@ -16,24 +16,67 @@ import {
TableRow,
} from "../ui/table";
import { Company } from "@/models/job.model";
-import { Briefcase, MoreVertical, Pencil, Trash } from "lucide-react";
+import {
+ Briefcase,
+ ExternalLink,
+ Eye,
+ EyeOff,
+ MoreVertical,
+ Pencil,
+ Trash,
+} from "lucide-react";
import { useState } from "react";
import Link from "next/link";
-import { deleteCompanyById } from "@/actions/company.actions";
+import { formatDistanceToNow } from "date-fns";
+import { deleteCompanyById, setCompanyWatched } from "@/actions/company.actions";
+import { companyBoardUrl } from "@/lib/atsBoardUrl";
+import { PROVIDER_META } from "@/components/automations/ats-search-step/types";
import { toastSuccess, toastError } from "@/lib/toast";
import { DeleteAlertDialog } from "../DeleteAlertDialog";
import { AlertDialog } from "@/models/alertDialog.model";
+import type { JobBoard, LeverHost } from "@/models/automation.model";
type CompaniesTableProps = {
companies: Company[];
reloadCompanies: () => void;
editCompany: (id: string) => void;
+ scope?: "mine" | "watchlist";
};
+// A watched row may have no board (a company watched from the Library), so the
+// cell degrades to an em dash rather than building a URL from a null token.
+function BoardCell({ company }: { company: Company }) {
+ if (!company.atsToken || !company.atsProvider) {
+ return <span className="text-muted-foreground">—</span>;
+ }
+ const provider = company.atsProvider as JobBoard;
+ return (
+ <span className="flex items-center gap-1.5">
+ <span className="text-muted-foreground">
+ {PROVIDER_META[provider].label} {company.atsToken}
+ </span>
+ <a
+ href={companyBoardUrl(provider, {
+ token: company.atsToken,
+ host: (company.atsHost as LeverHost) ?? undefined,
+ })}
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label={`Open ${company.label} job board`}
+ title="Open job board"
+ className="text-muted-foreground hover:text-foreground"
+ >
+ <ExternalLink className="h-3.5 w-3.5" />
+ </a>
+ </span>
+ );
+}
+
function CompaniesTable({
companies,
reloadCompanies,
editCompany,
+ scope = "mine",
}: CompaniesTableProps) {
const [alert, setAlert] = useState<AlertDialog>({
openState: false,
@@ -60,6 +103,21 @@ function CompaniesTable({
}
};
+ const toggleWatch = async (company: Company) => {
+ const next = !company.watched;
+ const res = await setCompanyWatched(company.id, next);
+ if (res.success) {
+ toastSuccess(
+ next
+ ? `${company.label} added to your watchlist`
+ : `${company.label} removed from your watchlist. It stays in your Library.`,
+ );
+ reloadCompanies();
+ } else {
+ toastError(res.message);
+ }
+ };
+
const deleteCompany = async (companyId: string | undefined) => {
if (companyId) {
const { res, success, message } = await deleteCompanyById(companyId);
@@ -81,10 +139,20 @@ function CompaniesTable({
<span className="sr-only">Company Logo</span>
</TableHead>
<TableHead>Company Name</TableHead>
- <TableHead className="hidden sm:table-cell">Value</TableHead>
- <TableHead>Total Jobs</TableHead>
- <TableHead>Jobs Applied</TableHead>
- <TableHead>Rejected</TableHead>
+ {scope === "watchlist" ? (
+ <>
+ <TableHead>Board</TableHead>
+ <TableHead>Jobs</TableHead>
+ <TableHead>Watched</TableHead>
+ </>
+ ) : (
+ <>
+ <TableHead className="hidden sm:table-cell">Value</TableHead>
+ <TableHead>Total Jobs</TableHead>
+ <TableHead>Jobs Applied</TableHead>
+ <TableHead>Rejected</TableHead>
+ </>
+ )}
<TableHead>Actions</TableHead>
<TableHead>
<span className="sr-only">Actions</span>
@@ -107,37 +175,72 @@ function CompaniesTable({
}}
/>
</TableCell>
- <TableCell className="font-medium">{company.label}</TableCell>
- <TableCell className="font-medium hidden sm:table-cell">
- {company.value}
- </TableCell>
<TableCell className="font-medium">
- {company._count?.jobsTotal ? (
- <Link
- href={`/dashboard/myjobs?company=${encodeURIComponent(company.value)}`}
- className="text-primary underline-offset-4 hover:underline"
- >
- {company._count.jobsTotal}
- </Link>
- ) : (
- (company._count?.jobsTotal ?? 0)
- )}
- </TableCell>
- <TableCell className="font-medium">
- {company._count?.jobsApplied ? (
- <Link
- href={`/dashboard/myjobs?company=${encodeURIComponent(company.value)}&applied=true`}
- className="text-primary underline-offset-4 hover:underline"
- >
- {company._count.jobsApplied}
- </Link>
- ) : (
- (company._count?.jobsApplied ?? 0)
- )}
- </TableCell>
- <TableCell className="font-medium">
- {company._count?.jobsRejected ?? 0}
+ <span className="flex items-center gap-1.5">
+ {company.label}
+ {company.watched && (
+ <span
+ title="On your watchlist"
+ className="text-emerald-600 dark:text-emerald-400"
+ >
+ <Eye className="h-3.5 w-3.5" />
+ </span>
+ )}
+ {scope !== "watchlist" && company.atsToken && (
+ <BoardCell company={company} />
+ )}
+ </span>
</TableCell>
+ {scope === "watchlist" ? (
+ <>
+ <TableCell>
+ <BoardCell company={company} />
+ </TableCell>
+ <TableCell className="font-medium">
+ {company._count?.jobsTotal ?? 0}
+ </TableCell>
+ <TableCell className="text-muted-foreground">
+ {company.watchedAt
+ ? formatDistanceToNow(new Date(company.watchedAt), {
+ addSuffix: true,
+ })
+ : "—"}
+ </TableCell>
+ </>
+ ) : (
+ <>
+ <TableCell className="font-medium hidden sm:table-cell">
+ {company.value}
+ </TableCell>
+ <TableCell className="font-medium">
+ {company._count?.jobsTotal ? (
+ <Link
+ href={`/dashboard/myjobs?company=${encodeURIComponent(company.value)}`}
+ className="text-primary underline-offset-4 hover:underline"
+ >
+ {company._count.jobsTotal}
+ </Link>
+ ) : (
+ (company._count?.jobsTotal ?? 0)
+ )}
+ </TableCell>
+ <TableCell className="font-medium">
+ {company._count?.jobsApplied ? (
+ <Link
+ href={`/dashboard/myjobs?company=${encodeURIComponent(company.value)}&applied=true`}
+ className="text-primary underline-offset-4 hover:underline"
+ >
+ {company._count.jobsApplied}
+ </Link>
+ ) : (
+ (company._count?.jobsApplied ?? 0)
+ )}
+ </TableCell>
+ <TableCell className="font-medium">
+ {company._count?.jobsRejected ?? 0}
+ </TableCell>
+ </>
+ )}
<TableCell>
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -165,6 +268,17 @@ function CompaniesTable({
<Pencil className="mr-2 h-4 w-4" />
Edit Company
</DropdownMenuItem>
+ <DropdownMenuItem
+ className="cursor-pointer"
+ onClick={() => toggleWatch(company)}
+ >
+ {company.watched ? (
+ <EyeOff className="mr-2 h-4 w-4" />
+ ) : (
+ <Eye className="mr-2 h-4 w-4" />
+ )}
+ {company.watched ? "Unwatch" : "Watch"}
+ </DropdownMenuItem>
<DropdownMenuItem
className="text-red-600 cursor-pointer"
onClick={() => onDeleteCompany(company)}
diff --git a/src/components/admin/WatchMergeDialog.tsx b/src/components/admin/WatchMergeDialog.tsx
new file mode 100644
index 0000000..75ac98d
--- /dev/null
+++ b/src/components/admin/WatchMergeDialog.tsx
@@ -0,0 +1,49 @@
+"use client";
+
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@/components/ui/alert-dialog";
+import { PROVIDER_META } from "@/components/automations/ats-search-step/types";
+import type { JobBoard } from "@/models/automation.model";
+
+export type PendingMerge = {
+ provider: JobBoard;
+ board: { name: string; token: string; host?: "default" | "eu" };
+ existing: { id: string; label: string };
+};
+
+type Props = {
+ pending: PendingMerge | null;
+ onConfirm: () => void;
+ onCancel: () => void;
+};
+
+// There is no "create a separate entry" option: @@unique([value, createdBy])
+// forbids a second row with the same canonical value.
+export function WatchMergeDialog({ pending, onConfirm, onCancel }: Props) {
+ return (
+ <AlertDialog open={!!pending} onOpenChange={(o) => !o && onCancel()}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Link this board?</AlertDialogTitle>
+ <AlertDialogDescription>
+ You already track <strong>{pending?.existing.label}</strong>. Link
+ its {pending && PROVIDER_META[pending.provider].label} board{" "}
+ <code>{pending?.board.token}</code> to that company?
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel>
+ <AlertDialogAction onClick={onConfirm}>Link board</AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ );
+}
diff --git a/src/components/admin/companies-container/CompaniesScopeSelect.tsx b/src/components/admin/companies-container/CompaniesScopeSelect.tsx
new file mode 100644
index 0000000..491fb01
--- /dev/null
+++ b/src/components/admin/companies-container/CompaniesScopeSelect.tsx
@@ -0,0 +1,73 @@
+"use client";
+
+import { useCallback, useState } from "react";
+import {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectLabel,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { getAtsCompanyCount } from "@/actions/atsCompany.actions";
+import { ATS_BOARDS } from "@/models/automation.model";
+import { PROVIDER_META } from "@/components/automations/ats-search-step/types";
+import type { CompanyScope } from "./useCompanyScope";
+
+type Props = {
+ scope: CompanyScope;
+ onScopeChange: (next: CompanyScope) => void;
+};
+
+export function CompaniesScopeSelect({ scope, onScopeChange }: Props) {
+ // Counts are decoration; fetched on first open so a visit that never
+ // touches Browse pays no round-trips.
+ const [counts, setCounts] = useState<Record<string, number> | null>(null);
+
+ const onOpenChange = useCallback(
+ (open: boolean) => {
+ if (!open || counts) return;
+ Promise.all(ATS_BOARDS.map((p) => getAtsCompanyCount(p)))
+ .then((totals) =>
+ setCounts(
+ Object.fromEntries(ATS_BOARDS.map((p, i) => [p, totals[i]])),
+ ),
+ )
+ .catch(() => {});
+ },
+ [counts],
+ );
+
+ return (
+ <Select
+ value={scope}
+ onValueChange={(v) => onScopeChange(v as CompanyScope)}
+ onOpenChange={onOpenChange}
+ >
+ <SelectTrigger aria-label="Select company scope" className="h-8 w-[180px]">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ <SelectLabel>Library</SelectLabel>
+ <SelectItem value="mine">My Companies</SelectItem>
+ <SelectItem value="watchlist">Watchlist</SelectItem>
+ </SelectGroup>
+ <SelectGroup>
+ <SelectLabel>Browse boards</SelectLabel>
+ {ATS_BOARDS.map((provider) => (
+ <SelectItem key={provider} value={`board:${provider}`}>
+ {PROVIDER_META[provider].label}
+ {counts?.[provider] !== undefined && (
+ <span className="ml-2 text-xs text-muted-foreground">
+ {counts[provider].toLocaleString()}
+ </span>
+ )}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ );
+}
diff --git a/src/components/admin/companies-container/useBoardsBrowse.ts b/src/components/admin/companies-container/useBoardsBrowse.ts
new file mode 100644
index 0000000..f93740e
--- /dev/null
+++ b/src/components/admin/companies-container/useBoardsBrowse.ts
@@ -0,0 +1,114 @@
+"use client";
+
+import { useCallback, useEffect, useRef, useState } from "react";
+import {
+ getAtsCompanyCount,
+ searchAtsCompanies,
+} from "@/actions/atsCompany.actions";
+import { getWatchedBoards } from "@/actions/company.actions";
+import { APP_CONSTANTS } from "@/lib/constants";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import type { JobBoard, LeverCompany } from "@/models/automation.model";
+
+// Browse pages the JSON seed at 50 while the reference lists page the database
+// at 25 — different sources, different costs, deliberately not unified.
+export function useBoardsBrowse(provider: JobBoard | null, searchTerm: string) {
+ const [rows, setRows] = useState<LeverCompany[]>([]);
+ const [hasMore, setHasMore] = useState(false);
+ const [seedTotal, setSeedTotal] = useState<number | undefined>(undefined);
+ const [initialLoading, setInitialLoading] = useState(false);
+ const [loadingMore, setLoadingMore] = useState(false);
+ // token -> companyId, so "Watching ✓" can toggle back off in place.
+ const [watchedMap, setWatchedMap] = useState<Map<string, string>>(new Map());
+ const requestIdRef = useRef(0);
+
+ const load = useCallback(
+ async (offset: number, search: string) => {
+ if (!provider) return;
+ const requestId = ++requestIdRef.current;
+ if (offset === 0) setInitialLoading(true);
+ else setLoadingMore(true);
+ const { companies, hasMore: more } = await searchAtsCompanies(
+ provider,
+ search,
+ offset,
+ );
+ if (requestId !== requestIdRef.current) return;
+ setRows((prev) => {
+ if (offset === 0) return companies;
+ const seen = new Set(prev.map((c) => c.token));
+ return [...prev, ...companies.filter((c) => !seen.has(c.token))];
+ });
+ setHasMore(more);
+ setInitialLoading(false);
+ setLoadingMore(false);
+ },
+ [provider],
+ );
+
+ // The watchlist is tens of rows in a different store, so it is fetched once
+ // per provider change and held as a Map — infinite scroll then costs one
+ // JSON call per page and zero database calls.
+ useEffect(() => {
+ if (!provider) return;
+ let cancelled = false;
+ getWatchedBoards(provider).then((boards) => {
+ if (cancelled) return;
+ setWatchedMap(new Map(boards.map((b) => [b.token, b.id])));
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [provider]);
+
+ useEffect(() => {
+ if (!provider) return;
+ setSeedTotal(undefined);
+ getAtsCompanyCount(provider)
+ .then(setSeedTotal)
+ .catch(() => {});
+ }, [provider]);
+
+ useEffect(() => {
+ if (!provider) return;
+ setRows([]);
+ const timer = setTimeout(() => load(0, searchTerm), searchTerm ? 300 : 0);
+ return () => clearTimeout(timer);
+ }, [provider, searchTerm, load]);
+
+ const sentinelRef = useInfiniteScroll(
+ hasMore && !!provider,
+ initialLoading || loadingMore,
+ useCallback(
+ () => load(rows.length, searchTerm),
+ [load, rows.length, searchTerm],
+ ),
+ );
+
+ const markWatched = useCallback((token: string, companyId: string) => {
+ setWatchedMap((prev) => new Map(prev).set(token, companyId));
+ }, []);
+
+ const unmarkWatched = useCallback((token: string) => {
+ setWatchedMap((prev) => {
+ const next = new Map(prev);
+ next.delete(token);
+ return next;
+ });
+ }, []);
+
+ return {
+ rows,
+ hasMore,
+ // Only meaningful with an empty search box: searchAtsCompanies returns no
+ // filtered total, so during a search the header shows a loaded count only.
+ total: searchTerm ? undefined : seedTotal,
+ initialLoading,
+ loadingMore,
+ sentinelRef,
+ watchedMap,
+ markWatched,
+ unmarkWatched,
+ pageSize: APP_CONSTANTS.ATS_COMPANY_PAGE_SIZE,
+ };
+}
diff --git a/src/components/admin/companies-container/useCompaniesList.ts b/src/components/admin/companies-container/useCompaniesList.ts
new file mode 100644
index 0000000..481d2f7
--- /dev/null
+++ b/src/components/admin/companies-container/useCompaniesList.ts
@@ -0,0 +1,80 @@
+"use client";
+
+import { useCallback, useEffect, useRef, useState } from "react";
+import { getCompanyList } from "@/actions/company.actions";
+import { APP_CONSTANTS } from "@/lib/constants";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import type { Company } from "@/models/job.model";
+
+export function useCompaniesList(
+ scope: "mine" | "watchlist",
+ searchTerm: string,
+ active: boolean,
+) {
+ const [companies, setCompanies] = useState<Company[]>([]);
+ const [total, setTotal] = useState<number>(0);
+ const [page, setPage] = useState<number>(1);
+ const [initialLoading, setInitialLoading] = useState<boolean>(false);
+ const [loadingMore, setLoadingMore] = useState<boolean>(false);
+ const requestIdRef = useRef(0);
+
+ const load = useCallback(
+ async (nextPage: number, search?: string) => {
+ const requestId = ++requestIdRef.current;
+ if (nextPage === 1) setInitialLoading(true);
+ else setLoadingMore(true);
+ const { data, total: t } = await getCompanyList(
+ nextPage,
+ APP_CONSTANTS.RECORDS_PER_PAGE,
+ "applied",
+ search,
+ scope,
+ );
+ if (requestId !== requestIdRef.current) return;
+ if (data) {
+ setCompanies((prev) => (nextPage === 1 ? data : [...prev, ...data]));
+ setTotal(t);
+ setPage(nextPage);
+ }
+ setInitialLoading(false);
+ setLoadingMore(false);
+ },
+ [scope],
+ );
+
+ const reload = useCallback(
+ async () => load(1, searchTerm || undefined),
+ [load, searchTerm],
+ );
+
+ // One effect for scope changes and debounced search: both reset to page 1
+ // and replace the list, so a separate mount effect would double-fetch.
+ useEffect(() => {
+ if (!active) return;
+ const timer = setTimeout(
+ () => load(1, searchTerm || undefined),
+ searchTerm ? 300 : 0,
+ );
+ return () => clearTimeout(timer);
+ }, [active, scope, searchTerm, load]);
+
+ const hasMore = companies.length < total;
+ const sentinelRef = useInfiniteScroll(
+ hasMore && active,
+ initialLoading || loadingMore,
+ useCallback(
+ () => load(page + 1, searchTerm || undefined),
+ [load, page, searchTerm],
+ ),
+ );
+
+ return {
+ companies,
+ total,
+ initialLoading,
+ loadingMore,
+ hasMore,
+ sentinelRef,
+ reload,
+ };
+}
diff --git a/src/components/admin/companies-container/useCompanyScope.ts b/src/components/admin/companies-container/useCompanyScope.ts
new file mode 100644
index 0000000..35f020a
--- /dev/null
+++ b/src/components/admin/companies-container/useCompanyScope.ts
@@ -0,0 +1,49 @@
+"use client";
+
+import { useCallback } from "react";
+import { usePathname, useRouter, useSearchParams } from "next/navigation";
+import type { JobBoard } from "@/models/automation.model";
+
+export type CompanyScope =
+ | "mine"
+ | "watchlist"
+ | "board:greenhouse"
+ | "board:lever"
+ | "board:ashby";
+
+const SCOPES: CompanyScope[] = [
+ "mine",
+ "watchlist",
+ "board:greenhouse",
+ "board:lever",
+ "board:ashby",
+];
+
+export function boardProvider(scope: CompanyScope): JobBoard | null {
+ return scope.startsWith("board:")
+ ? (scope.slice("board:".length) as JobBoard)
+ : null;
+}
+
+// Owns ?scope= directly rather than hoisting it into AdminTabsContainer,
+// which is shared by all six tabs. Safe to have two writers on one query
+// string: each only sets its own key and rebuilds from the current params.
+export function useCompanyScope() {
+ const router = useRouter();
+ const pathname = usePathname();
+ const queryParams = useSearchParams();
+
+ const raw = queryParams.get("scope") as CompanyScope | null;
+ const scope: CompanyScope = raw && SCOPES.includes(raw) ? raw : "mine";
+
+ const setScope = useCallback(
+ (next: CompanyScope) => {
+ const params = new URLSearchParams(queryParams.toString());
+ params.set("scope", next);
+ router.push(`${pathname}?${params.toString()}`);
+ },
+ [pathname, queryParams, router],
+ );
+
+ return { scope, setScope };
+}
diff --git a/src/components/automations/ats-search-step/CompanyPicker.tsx b/src/components/automations/ats-search-step/CompanyPicker.tsx
index 44ad129..ff98168 100644
--- a/src/components/automations/ats-search-step/CompanyPicker.tsx
+++ b/src/components/automations/ats-search-step/CompanyPicker.tsx
@@ -23,7 +23,7 @@ import type { JobBoard, LeverCompany } from "@/models/automation.model";
import { companyBoardUrl } from "@/lib/atsBoardUrl";
import { PROVIDER_META } from "./types";
import { useAtsCompanySearch } from "./useAtsCompanySearch";
-import { CompanyUrlAdd } from "./CompanyUrlAdd";
+import { JobBoardUrlAdd } from "@/components/JobBoardUrlAdd";
interface CompanyPickerProps {
provider: JobBoard;
@@ -181,7 +181,7 @@ export function CompanyPicker({
</div>
)}
- <CompanyUrlAdd
+ <JobBoardUrlAdd
provider={provider}
placeholder={meta.urlHint}
disabled={atLimit}
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index ad82295..145b69e 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -12,6 +12,9 @@ import {
export const APP_CONSTANTS = {
RECORDS_PER_PAGE: 25,
+ // Page size for the ATS board directory (browse + typeahead). Kept here so
+ // the pager and searchAtsCompanies can never disagree.
+ ATS_COMPANY_PAGE_SIZE: 50,
MAX_AUTOMATIONS_PER_USER: 10,
MAX_JOB_TAGS: 10,
MIN_QUESTION_LENGTH: 5,