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: Refactor Greenhouse company loading and improve resume templates with location formatting

Khuram Niaza582dab98e1a
diff --git a/src/actions/greenhouseCompany.actions.ts b/src/actions/greenhouseCompany.actions.ts
index 13646d0..ee9c099 100644
--- a/src/actions/greenhouseCompany.actions.ts
+++ b/src/actions/greenhouseCompany.actions.ts
@@ -1,16 +1,10 @@
"use server";
-import fs from "fs/promises";
-import path from "path";
import { getCurrentUser } from "@/utils/user.utils";
import { APP_CONSTANTS } from "@/lib/constants";
+import companies from "@/lib/scraper/greenhouse/companies.json";
import type { GreenhouseCompany } from "@/models/automation.model";
-const COMPANIES_PATH = path.join(
- process.cwd(),
- "src/lib/scraper/greenhouse/companies.json",
-);
-
const TOKEN_REGEX = /^[a-z0-9][a-z0-9_-]{1,79}$/;
// Extract a board token from a Greenhouse board URL or accept a bare token.
@@ -33,19 +27,6 @@ function extractToken(input: string): string | null {
return null;
}
-let cachedCompanies: GreenhouseCompany[] | null = null;
-
-async function loadCompanies(): Promise<GreenhouseCompany[]> {
- if (cachedCompanies) return cachedCompanies;
- try {
- const raw = await fs.readFile(COMPANIES_PATH, "utf-8");
- cachedCompanies = JSON.parse(raw) as GreenhouseCompany[];
- } catch {
- cachedCompanies = [];
- }
- return cachedCompanies;
-}
-
// Validate a token or board URL; returns the official company name.
export async function resolveGreenhouseBoard(
input: string,
@@ -97,7 +78,6 @@ export async function resolveGreenhouseBoard(
export async function getGreenhouseCompanyCount(): Promise<number> {
const user = await getCurrentUser();
if (!user) return 0;
- const companies = await loadCompanies();
return companies.length;
}
@@ -109,7 +89,6 @@ export async function searchGreenhouseCompanies(
const user = await getCurrentUser();
if (!user) return [];
- const companies = await loadCompanies();
const q = query.trim().toLowerCase();
if (q.length < 1) return companies;
diff --git a/src/app/api/ai/resume/import/route.ts b/src/app/api/ai/resume/import/route.ts
index 3915f09..45b1c73 100644
--- a/src/app/api/ai/resume/import/route.ts
+++ b/src/app/api/ai/resume/import/route.ts
@@ -136,10 +136,8 @@ export const POST = async (req: NextRequest) => {
providerOptions: {
ollama: { options: { num_ctx: APP_CONSTANTS.AI_OLLAMA_NUM_CTX } },
},
- onFinish: ({ finishReason, usage }) => {
+ onFinish: () => {
clearTimeout(timer);
- // "length" => hit num_ctx/output limit; "stop" => model completed.
- console.info(`Resume import finished: reason=${finishReason}`, usage);
},
onError: ({ error }) => {
clearTimeout(timer);
diff --git a/src/app/api/ai/resume/match/route.ts b/src/app/api/ai/resume/match/route.ts
index 35594d2..1fc3c6c 100644
--- a/src/app/api/ai/resume/match/route.ts
+++ b/src/app/api/ai/resume/match/route.ts
@@ -115,10 +115,8 @@ export const POST = async (req: NextRequest) => {
providerOptions: {
ollama: { options: { num_ctx: APP_CONSTANTS.AI_OLLAMA_NUM_CTX } },
},
- onFinish: ({ finishReason, usage }) => {
+ onFinish: () => {
clearTimeout(timer);
- // "length" => hit num_ctx/output limit; "stop" => model completed.
- console.info(`Job match finished: reason=${finishReason}`, usage);
},
onError: ({ error }) => {
clearTimeout(timer);
diff --git a/src/app/api/ai/resume/review/route.ts b/src/app/api/ai/resume/review/route.ts
index 93e69c9..c524898 100644
--- a/src/app/api/ai/resume/review/route.ts
+++ b/src/app/api/ai/resume/review/route.ts
@@ -97,10 +97,8 @@ export const POST = async (req: NextRequest) => {
providerOptions: {
ollama: { options: { num_ctx: APP_CONSTANTS.AI_OLLAMA_NUM_CTX } },
},
- onFinish: ({ finishReason, usage }) => {
+ onFinish: () => {
clearTimeout(timer);
- // "length" => hit num_ctx/output limit; "stop" => model completed.
- console.info(`Resume review finished: reason=${finishReason}`, usage);
},
onError: ({ error }) => {
clearTimeout(timer);
diff --git a/src/components/admin/AddCompany.tsx b/src/components/admin/AddCompany.tsx
index 0b07d46..eddfa22 100644
--- a/src/components/admin/AddCompany.tsx
+++ b/src/components/admin/AddCompany.tsx
@@ -125,9 +125,9 @@ function AddCompany({
<DialogContent className="lg:max-h-screen overflow-y-scroll">
<DialogHeader>
<DialogTitle>{pageTitle}</DialogTitle>
- <DialogDescription className="text-primary">
+ <DialogDescription className="text-orange-600 dark:text-orange-500">
Caution: Editing name of the company will affect all the related
- job records.
+ job records including your resume.
</DialogDescription>
</DialogHeader>
<Form {...form}>
diff --git a/src/components/automations/AutomationContainer.tsx b/src/components/automations/AutomationContainer.tsx
index 57cbd4a..01ac688 100644
--- a/src/components/automations/AutomationContainer.tsx
+++ b/src/components/automations/AutomationContainer.tsx
@@ -72,25 +72,14 @@ export function AutomationContainer({ resumes }: AutomationContainerProps) {
<Button variant="outline" size="icon" onClick={loadAutomations}>
<RefreshCw className="h-4 w-4" />
</Button>
- <Button
- variant="outline"
- onClick={() => setWizardOpen(true)}
- disabled={resumes.length === 0}
- >
+ <Button variant="outline" onClick={() => setWizardOpen(true)}>
<Plus className="h-4 w-4 mr-2" />
Create Automation
</Button>
</div>
</CardHeader>
<CardContent>
- {resumes.length === 0 ? (
- <div className="text-center py-8 text-muted-foreground">
- <p>You need to create a resume before setting up automations.</p>
- <p className="text-sm mt-2">
- Go to your Profile to create a resume first.
- </p>
- </div>
- ) : loading ? (
+ {loading ? (
<Loading />
) : (
<AutomationList
diff --git a/src/components/profile/CreateResume.tsx b/src/components/profile/CreateResume.tsx
index 7b350ea..10a4e0d 100644
--- a/src/components/profile/CreateResume.tsx
+++ b/src/components/profile/CreateResume.tsx
@@ -29,6 +29,7 @@ import { AiModel, AiProvider, defaultModel } from "@/models/ai.model";
import { getUserSettings } from "@/actions/userSettings.actions";
import { checkOllamaConnection } from "@/utils/ai.utils";
import { useRouter } from "next/navigation";
+import Link from "next/link";
type CreateResumeProps = {
resumeDialogOpen: boolean;
@@ -276,7 +277,14 @@ function CreateResume({
</span>
{!aiAvailable && (
<span className="text-muted-foreground text-xs block mt-0.5">
- (AI unavailable — manual entry)
+ AI unavailable —{" "}
+ <Link
+ href="/dashboard/settings"
+ className="underline hover:text-foreground"
+ onClick={(e) => e.stopPropagation()}
+ >
+ Configure AI under Settings
+ </Link>
</span>
)}
</label>
diff --git a/src/components/profile/resume-pdf/ProfessionalTemplate.tsx b/src/components/profile/resume-pdf/ProfessionalTemplate.tsx
index 3763f41..7564b95 100644
--- a/src/components/profile/resume-pdf/ProfessionalTemplate.tsx
+++ b/src/components/profile/resume-pdf/ProfessionalTemplate.tsx
@@ -10,6 +10,10 @@ function formatDate(date: Date | undefined | null): string {
return format(new Date(date), "MMM yyyy");
}
+function formatLocation(label: string | undefined): string {
+ return label && label !== "Not specified" ? label : "";
+}
+
function yearRange(startDate: Date, endDate?: Date | null): string {
const start = format(new Date(startDate), "yyyy");
const end = endDate ? format(new Date(endDate), "yyyy") : "Present";
@@ -218,7 +222,8 @@ export function ProfessionalResumeDocument({ resume, htmlNodes }: Props) {
</View>
<Text style={s.entryMeta}>
{exp.Company.label}
- {exp.location?.label ? ` · ${exp.location.label}` : ""}
+ {formatLocation(exp.location?.label) &&
+ ` · ${formatLocation(exp.location?.label)}`}
</Text>
</View>
{htmlNodes.experiences[i]}
@@ -244,7 +249,8 @@ export function ProfessionalResumeDocument({ resume, htmlNodes }: Props) {
</View>
<Text style={s.entryMeta}>
{exp.Company.label}
- {exp.location?.label ? ` · ${exp.location.label}` : ""}
+ {formatLocation(exp.location?.label) &&
+ ` · ${formatLocation(exp.location?.label)}`}
</Text>
</View>
</View>
diff --git a/src/components/profile/resume-pdf/SimpleTemplate.tsx b/src/components/profile/resume-pdf/SimpleTemplate.tsx
index c41ba32..36c563f 100644
--- a/src/components/profile/resume-pdf/SimpleTemplate.tsx
+++ b/src/components/profile/resume-pdf/SimpleTemplate.tsx
@@ -10,6 +10,10 @@ function formatDate(date: Date | undefined | null): string {
return format(new Date(date), "MMM yyyy");
}
+function formatLocation(label: string | undefined): string {
+ return label && label !== "Not specified" ? label : "";
+}
+
function SectionHeading({ title }: { title: string }) {
return (
<View>
@@ -142,8 +146,9 @@ export function SimpleResumeDocument({ resume, htmlNodes }: Props) {
{exp.jobTitle.label} — {exp.Company.label}
</Text>
<Text style={simpleStyles.entryMeta}>
- {formatDate(exp.startDate)} – {formatDate(exp.endDate)} ·{" "}
- {exp.location.label}
+ {formatDate(exp.startDate)} – {formatDate(exp.endDate)}
+ {formatLocation(exp.location.label) &&
+ ` · ${formatLocation(exp.location.label)}`}
</Text>
</View>
{htmlNodes.experiences[i]}
@@ -166,8 +171,9 @@ export function SimpleResumeDocument({ resume, htmlNodes }: Props) {
</Text>
<Text style={simpleStyles.entryMeta}>
{formatDate(edu.startDate)} –{" "}
- {edu.endDate ? formatDate(edu.endDate) : "Present"} ·{" "}
- {edu.location.label}
+ {edu.endDate ? formatDate(edu.endDate) : "Present"}
+ {formatLocation(edu.location.label) &&
+ ` · ${formatLocation(edu.location.label)}`}
</Text>
</View>
{htmlNodes.educations[i]}