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 Greenhouse search functionality and add more companies

Khuram Niaz3816a66b57a7
diff --git a/__tests__/greenhouseCompany.actions.spec.ts b/__tests__/greenhouseCompany.actions.spec.ts
index 5f290d0..94ad50c 100644
--- a/__tests__/greenhouseCompany.actions.spec.ts
+++ b/__tests__/greenhouseCompany.actions.spec.ts
@@ -101,7 +101,8 @@ describe("searchGreenhouseCompanies", () => {
expect(results.length).toBeLessThanOrEqual(20);
});
- it("returns empty for empty query", async () => {
- expect(await searchGreenhouseCompanies("")).toEqual([]);
+ it("returns the full list for an empty query (browse mode)", async () => {
+ const results = await searchGreenhouseCompanies("");
+ expect(results.length).toBeGreaterThan(20);
});
});
diff --git a/src/actions/greenhouseCompany.actions.ts b/src/actions/greenhouseCompany.actions.ts
index c11433b..13646d0 100644
--- a/src/actions/greenhouseCompany.actions.ts
+++ b/src/actions/greenhouseCompany.actions.ts
@@ -93,17 +93,26 @@ export async function resolveGreenhouseBoard(
}
}
+// Total number of companies in the seeded directory (for a browse hint).
+export async function getGreenhouseCompanyCount(): Promise<number> {
+ const user = await getCurrentUser();
+ if (!user) return 0;
+ const companies = await loadCompanies();
+ return companies.length;
+}
+
// Typeahead over the seeded companies.json (server-side filter, capped).
+// An empty query returns the full list (alphabetical) as a browsable default.
export async function searchGreenhouseCompanies(
query: string,
): Promise<GreenhouseCompany[]> {
const user = await getCurrentUser();
if (!user) return [];
+ const companies = await loadCompanies();
const q = query.trim().toLowerCase();
- if (q.length < 1) return [];
+ if (q.length < 1) return companies;
- const companies = await loadCompanies();
return companies
.filter(
(c) =>
diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsx
index 723cffc..b6c29a2 100644
--- a/src/components/ComboBox.tsx
+++ b/src/components/ComboBox.tsx
@@ -19,7 +19,6 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
-import { ScrollArea } from "./ui/scroll-area";
import { useState, useTransition } from "react";
import { delay } from "@/utils/delay";
import { createLocation } from "@/actions/job.actions";
@@ -90,7 +89,7 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
};
return (
- <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
+ <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen} modal>
<PopoverTrigger asChild>
<FormControl>
<Button
@@ -113,7 +112,7 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
</Button>
</FormControl>
</PopoverTrigger>
- <PopoverContent className="md:w-[240px] lg:w-[280px] p-0 max-h-[var(--radix-popover-content-available-height)] overflow-hidden">
+ <PopoverContent className="md:w-[240px] lg:w-[280px] p-0">
<Command
filter={(value, search) =>
value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0
@@ -124,56 +123,52 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {
onValueChange={(val: string) => setNewOption(val)}
placeholder={`${creatable ? "Create or " : ""}Search ${field.name}`}
/>
- <CommandEmpty
- onClick={() => {
- onCreateOption(newOption);
- setNewOption("");
- }}
- className={cn(
- "flex cursor-pointer items-center justify-center gap-1 italic mt-2",
- !newOption && "text-muted-foreground cursor-default"
- )}
- >
- {creatable ? (
- <>
- <CirclePlus className="h-4 w-4" />
- <p>Create: </p>
- <p className="block max-w-48 truncate font-semibold text-primary">
- {newOption}
- </p>
- </>
- ) : (
- <p className="font-semibold text-primary">No source found!</p>
- )}
- </CommandEmpty>
- <ScrollArea className="max-h-[calc(var(--radix-popover-content-available-height)-2.75rem)]">
+ <CommandList className="capitalize">
+ <CommandEmpty
+ onClick={() => {
+ onCreateOption(newOption);
+ setNewOption("");
+ }}
+ className={cn(
+ "flex cursor-pointer items-center justify-center gap-1 italic mt-2",
+ !newOption && "text-muted-foreground cursor-default"
+ )}
+ >
+ {creatable ? (
+ <>
+ <CirclePlus className="h-4 w-4" />
+ <p>Create: </p>
+ <p className="block max-w-48 truncate font-semibold text-primary">
+ {newOption}
+ </p>
+ </>
+ ) : (
+ <p className="font-semibold text-primary">No source found!</p>
+ )}
+ </CommandEmpty>
<CommandGroup>
- <CommandList className="capitalize max-h-none overflow-visible">
- {options.map((option) => (
- <CommandItem
- value={option.value}
- key={option.id}
- onSelect={() => {
- if (field.onChange) {
- field.onChange(option.id);
- setIsPopoverOpen(false);
- }
- }}
- >
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- option.id === field.value
- ? "opacity-100"
- : "opacity-0"
- )}
- />
- {option.label}
- </CommandItem>
- ))}
- </CommandList>
+ {options.map((option) => (
+ <CommandItem
+ value={option.value}
+ key={option.id}
+ onSelect={() => {
+ if (field.onChange) {
+ field.onChange(option.id);
+ setIsPopoverOpen(false);
+ }
+ }}
+ >
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ option.id === field.value ? "opacity-100" : "opacity-0"
+ )}
+ />
+ {option.label}
+ </CommandItem>
+ ))}
</CommandGroup>
- </ScrollArea>
+ </CommandList>
</Command>
</PopoverContent>
</Popover>
diff --git a/src/components/automations/GreenhouseSearchStep.tsx b/src/components/automations/GreenhouseSearchStep.tsx
index f3f89a7..feb7694 100644
--- a/src/components/automations/GreenhouseSearchStep.tsx
+++ b/src/components/automations/GreenhouseSearchStep.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState, useTransition } from "react";
+import { useEffect, useState, useTransition } from "react";
import {
X,
Loader2,
@@ -8,6 +8,7 @@ import {
ChevronsUpDown,
CirclePlus,
TriangleAlert,
+ ExternalLink,
} from "lucide-react";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -30,6 +31,7 @@ import {
import {
searchGreenhouseCompanies,
resolveGreenhouseBoard,
+ getGreenhouseCompanyCount,
} from "@/actions/greenhouseCompany.actions";
import { getAllJobTitles, createJobTitle } from "@/actions/jobtitle.actions";
import { getAllTags, createTag } from "@/actions/tag.actions";
@@ -134,7 +136,7 @@ function EntityStringChipInput({
return (
<div className="space-y-2">
<Label>{label}</Label>
- <Popover open={open} onOpenChange={handleOpen}>
+ <Popover open={open} onOpenChange={handleOpen} modal>
<PopoverTrigger asChild>
<Button
type="button"
@@ -234,6 +236,7 @@ export function GreenhouseSearchStep({
const companies = value.companies ?? [];
const [query, setQuery] = useState("");
const [results, setResults] = useState<GreenhouseCompany[]>([]);
+ const [totalCount, setTotalCount] = useState<number | null>(null);
const [open, setOpen] = useState(false);
const [isSearching, startSearch] = useTransition();
@@ -241,18 +244,29 @@ export function GreenhouseSearchStep({
const [isResolving, setIsResolving] = useState(false);
const [urlError, setUrlError] = useState<string | null>(null);
- const handleQueryChange = (val: string) => {
- setQuery(val);
- if (val.trim().length < 1) {
- setResults([]);
- return;
- }
+ useEffect(() => {
+ getGreenhouseCompanyCount()
+ .then(setTotalCount)
+ .catch(() => {});
+ }, []);
+
+ const runSearch = (q: string) => {
startSearch(async () => {
- const found = await searchGreenhouseCompanies(val);
+ const found = await searchGreenhouseCompanies(q);
setResults(found);
});
};
+ const handleQueryChange = (val: string) => {
+ setQuery(val);
+ runSearch(val);
+ };
+
+ const handleOpen = (next: boolean) => {
+ setOpen(next);
+ if (next) runSearch(query);
+ };
+
const addCompany = (company: GreenhouseCompany) => {
if (companies.some((c) => c.token === company.token)) return;
if (companies.length >= APP_CONSTANTS.MAX_GREENHOUSE_COMPANIES) return;
@@ -296,14 +310,21 @@ export function GreenhouseSearchStep({
return (
<div className="space-y-5">
<div className="space-y-2">
- <Label>
- Greenhouse Companies{" "}
- <span className="text-muted-foreground">
- ({companies.length}/{APP_CONSTANTS.MAX_GREENHOUSE_COMPANIES})
+ <Label className="flex items-center justify-between">
+ <span>
+ Greenhouse Companies{" "}
+ <span className="font-normal text-muted-foreground">
+ ({companies.length}/{APP_CONSTANTS.MAX_GREENHOUSE_COMPANIES})
+ </span>
</span>
+ {totalCount !== null && (
+ <span className="text-xs font-normal text-muted-foreground">
+ {totalCount} available
+ </span>
+ )}
</Label>
- <Popover open={open} onOpenChange={setOpen}>
+ <Popover open={open} onOpenChange={handleOpen} modal>
<PopoverTrigger asChild>
<Button
type="button"
@@ -331,7 +352,7 @@ export function GreenhouseSearchStep({
>
<Command shouldFilter={false}>
<CommandInput
- placeholder="Type to search..."
+ placeholder="Search or browse companies..."
value={query}
onValueChange={handleQueryChange}
/>
@@ -342,10 +363,7 @@ export function GreenhouseSearchStep({
Searching...
</div>
)}
- {!isSearching && !query.trim() && (
- <CommandEmpty>Type a company name to search.</CommandEmpty>
- )}
- {!isSearching && query.trim() && results.length === 0 && (
+ {!isSearching && results.length === 0 && (
<CommandEmpty>
No matches. Try &quot;Add by URL&quot; below.
</CommandEmpty>
@@ -361,6 +379,18 @@ export function GreenhouseSearchStep({
<span className="ml-2 text-xs text-muted-foreground">
{c.token}
</span>
+ <a
+ href={`${APP_CONSTANTS.GREENHOUSE_BOARD_URL}/${c.token}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label={`Open ${c.name} job board`}
+ title="Open job board"
+ onClick={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ className="ml-auto text-muted-foreground hover:text-foreground"
+ >
+ <ExternalLink className="h-3.5 w-3.5" />
+ </a>
</CommandItem>
))}
</CommandGroup>
diff --git a/src/components/myjobs/TagInput.tsx b/src/components/myjobs/TagInput.tsx
index bcff91a..e92129c 100644
--- a/src/components/myjobs/TagInput.tsx
+++ b/src/components/myjobs/TagInput.tsx
@@ -118,7 +118,7 @@ export function TagInput({
return (
<div className="flex flex-col gap-2">
- <Popover open={open} onOpenChange={setOpen}>
+ <Popover open={open} onOpenChange={setOpen} modal>
<PopoverTrigger asChild>
<Button
variant="outline"
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 5abd2ac..edb2ac9 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -62,6 +62,7 @@ export const APP_CONSTANTS = {
// Greenhouse job source
GREENHOUSE_BASE_URL: "https://boards-api.greenhouse.io/v1/boards",
+ GREENHOUSE_BOARD_URL: "https://boards.greenhouse.io", // public job board (not API)
MAX_GREENHOUSE_COMPANIES: 25, // per automation
GREENHOUSE_LISTING_CAP: 50, // safety ceiling applied after the relevance floor
GREENHOUSE_FLOOR_MIN_TITLE_HITS: 1,
diff --git a/src/lib/scraper/greenhouse/companies.json b/src/lib/scraper/greenhouse/companies.json
index 97e4434..2fd24f0 100644
--- a/src/lib/scraper/greenhouse/companies.json
+++ b/src/lib/scraper/greenhouse/companies.json
@@ -2335,6 +2335,10 @@
"name": "iBanFirst",
"token": "ibanfirst"
},
+ {
+ "name": "Instacart",
+ "token": "instacart"
+ },
{
"name": "Job Board",
"token": "corelight"
@@ -2347,6 +2351,10 @@
"name": "Lantern",
"token": "employerdirecthealthcare"
},
+ {
+ "name": "Mercury",
+ "token": "mercury"
+ },
{
"name": "Meridial",
"token": "agency"
@@ -2359,10 +2367,26 @@
"name": "Mythical Games(EU)",
"token": "dmarket"
},
+ {
+ "name": "Okta",
+ "token": "okta"
+ },
{
"name": "Orion Global Solutions",
"token": "12jlkfsk"
},
+ {
+ "name": "Pinterest",
+ "token": "pinterest"
+ },
+ {
+ "name": "Robinhood",
+ "token": "robinhood"
+ },
+ {
+ "name": "Stripe",
+ "token": "stripe"
+ },
{
"name": "Tend",
"token": "hellotend"
@@ -2371,6 +2395,14 @@
"name": "The City of Fort Worth",
"token": "cityoffortworth"
},
+ {
+ "name": "Vercel",
+ "token": "vercel"
+ },
+ {
+ "name": "Webflow",
+ "token": "webflow"
+ },
{
"name": "Zipline",
"token": "flyzipline"