From ca5486fcb467ed4a6fd3a90f7a2bd6ba2aaf34f6 Mon Sep 17 00:00:00 2001 From: DaKheera47 Date: Sun, 25 Jan 2026 12:24:28 +0000 Subject: [PATCH] country dropdown --- .../settings/components/JobspySection.tsx | 173 +++++++++++++++++- 1 file changed, 165 insertions(+), 8 deletions(-) diff --git a/orchestrator/src/client/pages/settings/components/JobspySection.tsx b/orchestrator/src/client/pages/settings/components/JobspySection.tsx index fa25071..5d20bf6 100644 --- a/orchestrator/src/client/pages/settings/components/JobspySection.tsx +++ b/orchestrator/src/client/pages/settings/components/JobspySection.tsx @@ -3,6 +3,7 @@ import { useFormContext, Controller } from "react-hook-form" import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion" import { Checkbox } from "@/components/ui/checkbox" +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Separator } from "@/components/ui/separator" import { UpdateSettingsInput } from "@shared/settings-schema" import type { JobspyValues } from "@client/pages/settings/types" @@ -14,6 +15,118 @@ type JobspySectionProps = { isSaving: boolean } +const JOBSPY_INDEED_COUNTRIES = [ + "argentina", + "australia", + "austria", + "bahrain", + "bangladesh", + "belgium", + "bulgaria", + "brazil", + "canada", + "chile", + "china", + "colombia", + "costa rica", + "croatia", + "cyprus", + "czech republic", + "czechia", + "denmark", + "ecuador", + "egypt", + "estonia", + "finland", + "france", + "germany", + "greece", + "hong kong", + "hungary", + "india", + "indonesia", + "ireland", + "israel", + "italy", + "japan", + "kuwait", + "latvia", + "lithuania", + "luxembourg", + "malaysia", + "malta", + "mexico", + "morocco", + "netherlands", + "new zealand", + "nigeria", + "norway", + "oman", + "pakistan", + "panama", + "peru", + "philippines", + "poland", + "portugal", + "qatar", + "romania", + "saudi arabia", + "singapore", + "slovakia", + "slovenia", + "south africa", + "south korea", + "spain", + "sweden", + "switzerland", + "taiwan", + "thailand", + "türkiye", + "turkey", + "ukraine", + "united arab emirates", + "uk", + "united kingdom", + "usa", + "us", + "united states", + "uruguay", + "venezuela", + "vietnam", + "usa/ca", + "worldwide", +] + +const COUNTRY_ALIASES: Record = { + uk: "united kingdom", + us: "united states", + usa: "united states", + "türkiye": "turkey", + "czech republic": "czechia", +} + +const COUNTRY_LABELS: Record = { + "united kingdom": "United Kingdom", + "united states": "United States", + "usa/ca": "USA/CA", + turkey: "Turkey", + czechia: "Czechia", +} + +const normalizeCountryValue = (value: string) => COUNTRY_ALIASES[value] ?? value + +const formatCountryLabel = (value: string) => + COUNTRY_LABELS[value] || value.replace(/\b\w/g, (char) => char.toUpperCase()) + +const JOBSPY_INDEED_COUNTRY_OPTIONS = Array.from( + new Map( + JOBSPY_INDEED_COUNTRIES.map((country) => { + const normalized = normalizeCountryValue(country) + return [normalized, normalized] + }) + ).values() +) + export const JobspySection: React.FC = ({ values, isLoading, @@ -169,14 +282,58 @@ export const JobspySection: React.FC = ({ )} /> - { + const currentValue = (field.value ?? countryIndeed.default ?? "").toLowerCase() + const normalizedValue = normalizeCountryValue(currentValue) + const displayValue = JOBSPY_INDEED_COUNTRY_OPTIONS.includes(normalizedValue) + ? normalizedValue + : "__default__" + + return ( +
+ + + {errors.jobspyCountryIndeed && ( +

{errors.jobspyCountryIndeed.message}

+ )} +
+ Select one of JobSpy's supported Indeed country values. +
+
+ {`Effective: ${countryIndeed.effective || "—"} | Default: ${countryIndeed.default || "—"}`} +
+
+ ) + }} />